wangliang_wd

feat:优化我的收藏,点击视频详情,数据加载逻辑

@@ -38,6 +38,11 @@ export class HttpUrlUtils { @@ -38,6 +38,11 @@ export class HttpUrlUtils {
38 static readonly PUBLISH_NEXT_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/publishNexts"; 38 static readonly PUBLISH_NEXT_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/publishNexts";
39 39
40 /** 40 /**
  41 + * 号主收藏作品
  42 + */
  43 + static readonly INTERACT_NEXT_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/interactNexts";
  44 +
  45 + /**
41 * 获取视频直播间拉流地址 46 * 获取视频直播间拉流地址
42 */ 47 */
43 static readonly PULL_STREAM_PATH: string = "/api/live-center-video/zh/c/vlive/pull-stream/"; 48 static readonly PULL_STREAM_PATH: string = "/api/live-center-video/zh/c/vlive/pull-stream/";
@@ -458,7 +458,8 @@ export class ProcessUtils { @@ -458,7 +458,8 @@ export class ProcessUtils {
458 relId: content?.relId, 458 relId: content?.relId,
459 sourcePage: '5', 459 sourcePage: '5',
460 commentId: content?.commentInfo?.commentId, 460 commentId: content?.commentInfo?.commentId,
461 - showComment: content.showComment 461 + showComment: content.showComment,
  462 + isMycollection:content.isCollection
462 } as ExtraDTO, 463 } as ExtraDTO,
463 targetLayout: content.customParamTargetLayout 464 targetLayout: content.customParamTargetLayout
464 } as Params, 465 } as Params,
@@ -22,4 +22,5 @@ export interface ExtraDTO extends ItemDTO { @@ -22,4 +22,5 @@ export interface ExtraDTO extends ItemDTO {
22 title: string 22 title: string
23 showComment?:boolean 23 showComment?:boolean
24 rmhPlatform?: number 24 rmhPlatform?: number
  25 + isMycollection?:boolean
25 } 26 }
@@ -14,6 +14,7 @@ export interface RmhPublishNextsParams { @@ -14,6 +14,7 @@ export interface RmhPublishNextsParams {
14 nextFlag: number 14 nextFlag: number
15 pageSize: number 15 pageSize: number
16 refreshTime:number 16 refreshTime:number
  17 + type:number //0 1我的收藏 2历史消息
17 } 18 }
18 19
19 export interface ContentDetailRequestParams { 20 export interface ContentDetailRequestParams {
@@ -221,10 +222,15 @@ export class ContentDetailRequest { @@ -221,10 +222,15 @@ export class ContentDetailRequest {
221 /** 222 /**
222 * 获取号主发布的视频 223 * 获取号主发布的视频
223 * */ 224 * */
224 - 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  
225 - let url = HttpUrlUtils.getHost() + HttpUrlUtils.PUBLISH_NEXT_PATH  
226 - url = url + "?creatorId=" + creatorId  
227 - + "&contentId=" + contentId 225 + 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
  226 + let url = ''
  227 + if (creatorId.length > 0) {
  228 + url = HttpUrlUtils.getHost() + HttpUrlUtils.PUBLISH_NEXT_PATH + "?creatorId=" + creatorId
  229 + }else {
  230 + url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_NEXT_PATH + "?type=" + type
  231 + }
  232 +
  233 + url = url + "&contentId=" + contentId
228 + "&contentType=" + contentType 234 + "&contentType=" + contentType
229 + "&nextFlag=" + nextFlag 235 + "&nextFlag=" + nextFlag
230 + "&pageSize=" + pageSize 236 + "&pageSize=" + pageSize
@@ -258,7 +264,7 @@ export class ContentDetailRequest { @@ -258,7 +264,7 @@ export class ContentDetailRequest {
258 // if (mock_switch) { 264 // if (mock_switch) {
259 // return ContentDetailRequest.getContentDetailDataMock(getContext()); 265 // return ContentDetailRequest.getContentDetailDataMock(getContext());
260 // } 266 // }
261 - let url = ContentDetailRequest.getRmhPublishNextsUrl(params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime) 267 + let url = ContentDetailRequest.getRmhPublishNextsUrl(params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime,params.type)
262 return WDHttp.get<ResponseDTO<PeopleShipNextListDTO>>(url) 268 return WDHttp.get<ResponseDTO<PeopleShipNextListDTO>>(url)
263 } 269 }
264 270
1 import { Action, 1 import { Action,
2 ContentDetailDTO, ContentDTO, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean/Index'; 2 ContentDetailDTO, ContentDTO, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean/Index';
3 -import { EmitterEventId, EmitterUtils, NetworkType, NetworkUtil, WindowModel } from 'wdKit'; 3 +import { EmitterEventId, EmitterUtils, NetworkType, NetworkUtil, ToastUtils, WindowModel } from 'wdKit';
4 import { ContentDetailRequest } from 'wdDetailPlayApi/Index' 4 import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
5 import { ResponseDTO } from 'wdNetwork/Index'; 5 import { ResponseDTO } from 'wdNetwork/Index';
6 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' 6 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
@@ -26,6 +26,7 @@ interface peopleParams { @@ -26,6 +26,7 @@ interface peopleParams {
26 @Component 26 @Component
27 export struct DetailVideoListPage { 27 export struct DetailVideoListPage {
28 @State peopleShipHomeCreatorId: string = ''; 28 @State peopleShipHomeCreatorId: string = '';
  29 + @State isMycollection:boolean = false //是否是我的收藏
29 @State tabName: string = ''; // 人民好主页全部、文章、视频、动态等name 30 @State tabName: string = ''; // 人民好主页全部、文章、视频、动态等name
30 private contentId: string = '' 31 private contentId: string = ''
31 private relId: string = '' 32 private relId: string = ''
@@ -106,7 +107,10 @@ export struct DetailVideoListPage { @@ -106,7 +107,10 @@ export struct DetailVideoListPage {
106 107
107 aboutToAppear() { 108 aboutToAppear() {
108 // 在视频详情页 109 // 在视频详情页
  110 + const action: Action = router.getParams() as Action
  111 +
109 this.peopleShipHomeCreatorId = AppStorage.get<string>('peopleShipHomeCreatorId') || ''; 112 this.peopleShipHomeCreatorId = AppStorage.get<string>('peopleShipHomeCreatorId') || '';
  113 + this.isMycollection = action.params?.extra?.isMycollection || false
110 // console.info(TAG, `cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`) 114 // console.info(TAG, `cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`)
111 if (this.peopleShipHomeCreatorId) { 115 if (this.peopleShipHomeCreatorId) {
112 const params: peopleParams = JSON.parse(this.peopleShipHomeCreatorId); 116 const params: peopleParams = JSON.parse(this.peopleShipHomeCreatorId);
@@ -115,8 +119,10 @@ export struct DetailVideoListPage { @@ -115,8 +119,10 @@ export struct DetailVideoListPage {
115 // console.info(TAG, `cj2024 tabName = ${this.tabName}`) 119 // console.info(TAG, `cj2024 tabName = ${this.tabName}`)
116 // 从人民号号主传过来的 120 // 从人民号号主传过来的
117 this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId); 121 this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId);
118 - } else {  
119 - // 根据ID重新获取列表 122 + } else if (this.isMycollection) {
  123 + // 我的收藏进入
  124 + this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId);
  125 + }else {
120 this.getDetail() 126 this.getDetail()
121 } 127 }
122 128
@@ -134,7 +140,7 @@ export struct DetailVideoListPage { @@ -134,7 +140,7 @@ export struct DetailVideoListPage {
134 if (type != NetworkType.TYPE_UNKNOWN) { 140 if (type != NetworkType.TYPE_UNKNOWN) {
135 console.log(TAG, '网络连接状态变化', type) 141 console.log(TAG, '网络连接状态变化', type)
136 if(type == NetworkType.TYPE_CELLULAR || type == NetworkType.TYPE_WIFI) { 142 if(type == NetworkType.TYPE_CELLULAR || type == NetworkType.TYPE_WIFI) {
137 - if (!this.peopleShipHomeCreatorId) { 143 + if (!this.peopleShipHomeCreatorId && !this.isMycollection) {
138 this.queryVideoList() 144 this.queryVideoList()
139 } else { 145 } else {
140 this.getRmhPublishNexts(this.peopleShipHomeCreatorId, `${this.data[this.currentIndex].newsId}`, 1, 1, 10, systemDateTime.getTime(false)); 146 this.getRmhPublishNexts(this.peopleShipHomeCreatorId, `${this.data[this.currentIndex].newsId}`, 1, 1, 10, systemDateTime.getTime(false));
@@ -327,7 +333,7 @@ export struct DetailVideoListPage { @@ -327,7 +333,7 @@ export struct DetailVideoListPage {
327 }) 333 })
328 this.data.push(resDTO.data[0]) 334 this.data.push(resDTO.data[0])
329 335
330 - if(this.tabName == '全部' || this.tabName == '视频') { // 全部和视频查询号主关联视频 336 + if(this.tabName == '全部' || this.tabName == '视频'|| this.isMycollection) { // 全部和视频查询号主关联视频
331 await this.getRmhPublishNexts(this.peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false)); 337 await this.getRmhPublishNexts(this.peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false));
332 } else { // 目前动态是查询随机视频 338 } else { // 目前动态是查询随机视频
333 await this.queryVideoList() 339 await this.queryVideoList()
@@ -353,10 +359,11 @@ export struct DetailVideoListPage { @@ -353,10 +359,11 @@ export struct DetailVideoListPage {
353 contentType: contentType, 359 contentType: contentType,
354 nextFlag: nextFlag, 360 nextFlag: nextFlag,
355 pageSize: pageSize, 361 pageSize: pageSize,
356 - refreshTime: refreshTime 362 + refreshTime: refreshTime,
  363 + type:this.isMycollection?1:0
357 }).then(async (resDTO: ResponseDTO<PeopleShipNextListDTO>) => { 364 }).then(async (resDTO: ResponseDTO<PeopleShipNextListDTO>) => {
358 // console.log(TAG, 'cj2024 getRmhPublishNexts:', JSON.stringify(resDTO.data)) 365 // console.log(TAG, 'cj2024 getRmhPublishNexts:', JSON.stringify(resDTO.data))
359 - this.isOffLine = resDTO.data == null ? true : false 366 + this.isOffLine = resDTO.data == null && this.data.length === 0 ? true : false
360 if (resDTO.data && resDTO.data.list && resDTO.data.list.length > 0) { 367 if (resDTO.data && resDTO.data.list && resDTO.data.list.length > 0) {
361 const params: contentListParams = { 368 const params: contentListParams = {
362 contentList: [{ 369 contentList: [{
@@ -470,9 +477,9 @@ export struct DetailVideoListPage { @@ -470,9 +477,9 @@ export struct DetailVideoListPage {
470 this.currentIndex = index 477 this.currentIndex = index
471 // if (this.currentIndex === this.data.length - 1) { 478 // if (this.currentIndex === this.data.length - 1) {
472 // 倒数第二个开始请求下一页数据解决视频上滑卡顿 479 // 倒数第二个开始请求下一页数据解决视频上滑卡顿
473 - if (this.currentIndex === this.data.length - 2) { 480 + if (this.currentIndex === this.data.length - 2 && this.data.length > 10) {
474 // TODO:下拉刷新“努力加载中” 481 // TODO:下拉刷新“努力加载中”
475 - if (!this.peopleShipHomeCreatorId) { 482 + if (!this.peopleShipHomeCreatorId && !this.isMycollection) {
476 this.queryVideoList() 483 this.queryVideoList()
477 } else { 484 } else {
478 this.getRmhPublishNexts(this.peopleShipHomeCreatorId, `${this.data[this.data.length-1].newsId}`, 1, 1, 10, systemDateTime.getTime(false)); 485 this.getRmhPublishNexts(this.peopleShipHomeCreatorId, `${this.data[this.data.length-1].newsId}`, 1, 1, 10, systemDateTime.getTime(false));