Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-11-07 17:36:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86ed44eb413b869aa15cd9648e7bba6ee065c368
86ed44eb
1 parent
1ee7be64
feat:优化我的收藏,点击视频详情,数据加载逻辑
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
15 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
sight_harmony/features/wdBean/src/main/ets/bean/component/extra/ExtraDTO.ts
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailVideoListPage.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
86ed44e
...
...
@@ -38,6 +38,11 @@ export class HttpUrlUtils {
static readonly PUBLISH_NEXT_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/publishNexts";
/**
* 号主收藏作品
*/
static readonly INTERACT_NEXT_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/interactNexts";
/**
* 获取视频直播间拉流地址
*/
static readonly PULL_STREAM_PATH: string = "/api/live-center-video/zh/c/vlive/pull-stream/";
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
View file @
86ed44e
...
...
@@ -458,7 +458,8 @@ export class ProcessUtils {
relId: content?.relId,
sourcePage: '5',
commentId: content?.commentInfo?.commentId,
showComment: content.showComment
showComment: content.showComment,
isMycollection:content.isCollection
} as ExtraDTO,
targetLayout: content.customParamTargetLayout
} as Params,
...
...
sight_harmony/features/wdBean/src/main/ets/bean/component/extra/ExtraDTO.ts
View file @
86ed44e
...
...
@@ -22,4 +22,5 @@ export interface ExtraDTO extends ItemDTO {
title
:
string
showComment
?:
boolean
rmhPlatform
?:
number
isMycollection
?:
boolean
}
\ No newline at end of file
...
...
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
View file @
86ed44e
...
...
@@ -14,6 +14,7 @@ export interface RmhPublishNextsParams {
nextFlag: number
pageSize: number
refreshTime:number
type:number //0 1我的收藏 2历史消息
}
export interface ContentDetailRequestParams {
...
...
@@ -221,10 +222,15 @@ export class ContentDetailRequest {
/**
* 获取号主发布的视频
* */
static getRmhPublishNextsUrl(creatorId: string,contentId: string, contentType: number, nextFlag: number, pageSize: number, refreshTime: number) { //params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime
let url = HttpUrlUtils.getHost() + HttpUrlUtils.PUBLISH_NEXT_PATH
url = url + "?creatorId=" + creatorId
+ "&contentId=" + contentId
static getRmhPublishNextsUrl(creatorId: string,contentId: string, contentType: number, nextFlag: number, pageSize: number, refreshTime: number, type: number) { //params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime
let url = ''
if (creatorId.length > 0) {
url = HttpUrlUtils.getHost() + HttpUrlUtils.PUBLISH_NEXT_PATH + "?creatorId=" + creatorId
}else {
url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_NEXT_PATH + "?type=" + type
}
url = url + "&contentId=" + contentId
+ "&contentType=" + contentType
+ "&nextFlag=" + nextFlag
+ "&pageSize=" + pageSize
...
...
@@ -258,7 +264,7 @@ export class ContentDetailRequest {
// if (mock_switch) {
// return ContentDetailRequest.getContentDetailDataMock(getContext());
// }
let url = ContentDetailRequest.getRmhPublishNextsUrl(params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime)
let url = ContentDetailRequest.getRmhPublishNextsUrl(params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime
,params.type
)
return WDHttp.get<ResponseDTO<PeopleShipNextListDTO>>(url)
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailVideoListPage.ets
View file @
86ed44e
import { Action,
ContentDetailDTO, ContentDTO, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean/Index';
import { EmitterEventId, EmitterUtils, NetworkType, NetworkUtil, WindowModel } from 'wdKit';
import { EmitterEventId, EmitterUtils, NetworkType, NetworkUtil,
ToastUtils,
WindowModel } from 'wdKit';
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index';
import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
...
...
@@ -26,6 +26,7 @@ interface peopleParams {
@Component
export struct DetailVideoListPage {
@State peopleShipHomeCreatorId: string = '';
@State isMycollection:boolean = false //是否是我的收藏
@State tabName: string = ''; // 人民好主页全部、文章、视频、动态等name
private contentId: string = ''
private relId: string = ''
...
...
@@ -106,7 +107,10 @@ export struct DetailVideoListPage {
aboutToAppear() {
// 在视频详情页
const action: Action = router.getParams() as Action
this.peopleShipHomeCreatorId = AppStorage.get<string>('peopleShipHomeCreatorId') || '';
this.isMycollection = action.params?.extra?.isMycollection || false
// console.info(TAG, `cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`)
if (this.peopleShipHomeCreatorId) {
const params: peopleParams = JSON.parse(this.peopleShipHomeCreatorId);
...
...
@@ -115,8 +119,10 @@ export struct DetailVideoListPage {
// console.info(TAG, `cj2024 tabName = ${this.tabName}`)
// 从人民号号主传过来的
this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId);
} else {
// 根据ID重新获取列表
} else if (this.isMycollection) {
// 我的收藏进入
this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId);
}else {
this.getDetail()
}
...
...
@@ -134,7 +140,7 @@ export struct DetailVideoListPage {
if (type != NetworkType.TYPE_UNKNOWN) {
console.log(TAG, '网络连接状态变化', type)
if(type == NetworkType.TYPE_CELLULAR || type == NetworkType.TYPE_WIFI) {
if (!this.peopleShipHomeCreatorId) {
if (!this.peopleShipHomeCreatorId
&& !this.isMycollection
) {
this.queryVideoList()
} else {
this.getRmhPublishNexts(this.peopleShipHomeCreatorId, `${this.data[this.currentIndex].newsId}`, 1, 1, 10, systemDateTime.getTime(false));
...
...
@@ -327,7 +333,7 @@ export struct DetailVideoListPage {
})
this.data.push(resDTO.data[0])
if(this.tabName == '全部' || this.tabName == '视频') { // 全部和视频查询号主关联视频
if(this.tabName == '全部' || this.tabName == '视频'
|| this.isMycollection
) { // 全部和视频查询号主关联视频
await this.getRmhPublishNexts(this.peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false));
} else { // 目前动态是查询随机视频
await this.queryVideoList()
...
...
@@ -353,10 +359,11 @@ export struct DetailVideoListPage {
contentType: contentType,
nextFlag: nextFlag,
pageSize: pageSize,
refreshTime: refreshTime
refreshTime: refreshTime,
type:this.isMycollection?1:0
}).then(async (resDTO: ResponseDTO<PeopleShipNextListDTO>) => {
// console.log(TAG, 'cj2024 getRmhPublishNexts:', JSON.stringify(resDTO.data))
this.isOffLine = resDTO.data == null ? true : false
this.isOffLine = resDTO.data == null
&& this.data.length === 0
? true : false
if (resDTO.data && resDTO.data.list && resDTO.data.list.length > 0) {
const params: contentListParams = {
contentList: [{
...
...
@@ -470,9 +477,9 @@ export struct DetailVideoListPage {
this.currentIndex = index
// if (this.currentIndex === this.data.length - 1) {
// 倒数第二个开始请求下一页数据解决视频上滑卡顿
if (this.currentIndex === this.data.length - 2) {
if (this.currentIndex === this.data.length - 2
&& this.data.length > 10
) {
// TODO:下拉刷新“努力加载中”
if (!this.peopleShipHomeCreatorId) {
if (!this.peopleShipHomeCreatorId
&& !this.isMycollection
) {
this.queryVideoList()
} else {
this.getRmhPublishNexts(this.peopleShipHomeCreatorId, `${this.data[this.data.length-1].newsId}`, 1, 1, 10, systemDateTime.getTime(false));
...
...
Please
register
or
login
to post a comment