Showing
5 changed files
with
189 additions
and
6 deletions
| @@ -32,6 +32,10 @@ export class HttpUrlUtils { | @@ -32,6 +32,10 @@ export class HttpUrlUtils { | ||
| 32 | * 详情页面详情接口 | 32 | * 详情页面详情接口 |
| 33 | */ | 33 | */ |
| 34 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | 34 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; |
| 35 | + /** | ||
| 36 | + * 号主作品 | ||
| 37 | + */ | ||
| 38 | + static readonly PUBLISH_NEXT_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/publishNexts"; | ||
| 35 | 39 | ||
| 36 | /** | 40 | /** |
| 37 | * 获取视频直播间拉流地址 | 41 | * 获取视频直播间拉流地址 |
| 1 | +import { ContentDTO } from '../content/ContentDTO' | ||
| 2 | +import { ContentDetailDTO } from '../detail/ContentDetailDTO'; | ||
| 3 | + | ||
| 4 | + | ||
| 5 | +export interface PeopleShipNextListDTO { | ||
| 6 | + followCreators: boolean; | ||
| 7 | + hasNext: number; | ||
| 8 | + list: ContentDetailDTO[]; | ||
| 9 | + pageNum: number; | ||
| 10 | + pageSize: number; | ||
| 11 | + totalCount: number; | ||
| 12 | +} |
| @@ -13,7 +13,8 @@ import { | @@ -13,7 +13,8 @@ import { | ||
| 13 | ArticleTypeData, | 13 | ArticleTypeData, |
| 14 | ArticleListData, | 14 | ArticleListData, |
| 15 | PeopleShipUserDetailData, | 15 | PeopleShipUserDetailData, |
| 16 | - CompDTO | 16 | + CompDTO, |
| 17 | + ContentDetailDTO | ||
| 17 | } from 'wdBean' | 18 | } from 'wdBean' |
| 18 | import { CardParser } from '../CardParser' | 19 | import { CardParser } from '../CardParser' |
| 19 | import { PageRepository } from '../../repository/PageRepository' | 20 | import { PageRepository } from '../../repository/PageRepository' |
| @@ -28,6 +29,7 @@ const TAG = 'PeopleShipHomeArticleListComponent'; | @@ -28,6 +29,7 @@ const TAG = 'PeopleShipHomeArticleListComponent'; | ||
| 28 | @Component | 29 | @Component |
| 29 | export struct PeopleShipHomeArticleListComponent { | 30 | export struct PeopleShipHomeArticleListComponent { |
| 30 | @State arr: ContentDTO[] = [] | 31 | @State arr: ContentDTO[] = [] |
| 32 | + //@State arrDetailList: ContentDetailDTO[] = [] | ||
| 31 | // @State arr: LazyDataSource<ContentDTO> = new LazyDataSource(); | 33 | // @State arr: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 32 | @State typeModel: ArticleTypeData = new ArticleTypeData() | 34 | @State typeModel: ArticleTypeData = new ArticleTypeData() |
| 33 | @State creatorId: string = '' | 35 | @State creatorId: string = '' |
| @@ -125,12 +127,19 @@ export struct PeopleShipHomeArticleListComponent { | @@ -125,12 +127,19 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 125 | } | 127 | } |
| 126 | 128 | ||
| 127 | aboutToAppear() { | 129 | aboutToAppear() { |
| 130 | + console.log(TAG, 'cj2024 aboutToAppear') | ||
| 131 | + AppStorage.setOrCreate<string>('peopleShipHomeCreatorId', this.creatorId) | ||
| 128 | if (this.currentIndex == this.currentTopSelectedIndex) { | 132 | if (this.currentIndex == this.currentTopSelectedIndex) { |
| 129 | this.currentPage = 1 | 133 | this.currentPage = 1 |
| 130 | this.getPeopleShipPageArticleList() | 134 | this.getPeopleShipPageArticleList() |
| 131 | } | 135 | } |
| 132 | } | 136 | } |
| 133 | 137 | ||
| 138 | + aboutToDisappear(): void { | ||
| 139 | + console.log(TAG, 'cj2024 aboutToDisappear') | ||
| 140 | + AppStorage.setOrCreate<string>('peopleShipHomeCreatorId', '') //清空人民号动态等过来的数据 | ||
| 141 | + } | ||
| 142 | + | ||
| 134 | onChange() { | 143 | onChange() { |
| 135 | if (this.currentIndex == this.currentTopSelectedIndex && this.arr.length == 0) { | 144 | if (this.currentIndex == this.currentTopSelectedIndex && this.arr.length == 0) { |
| 136 | this.currentPage = 1 | 145 | this.currentPage = 1 |
| @@ -223,6 +232,7 @@ export struct PeopleShipHomeArticleListComponent { | @@ -223,6 +232,7 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 223 | } | 232 | } |
| 224 | for (const element of listData.list) { | 233 | for (const element of listData.list) { |
| 225 | let contentDTO = new ContentDTO() | 234 | let contentDTO = new ContentDTO() |
| 235 | + //let contentDetailDTO = new ContentDetailDTO() | ||
| 226 | console.info(TAG, 'element.appStyle'+`${element.appStyle}`) | 236 | console.info(TAG, 'element.appStyle'+`${element.appStyle}`) |
| 227 | contentDTO.appStyle = this.changeCommon(element.appStyle) | 237 | contentDTO.appStyle = this.changeCommon(element.appStyle) |
| 228 | contentDTO.newsTitle = element.title; | 238 | contentDTO.newsTitle = element.title; |
| 1 | import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit'; | 1 | import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | -import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO } from 'wdBean'; | 3 | +import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 5 | 5 | ||
| 6 | const TAG = 'ContentDetailRequest'; | 6 | const TAG = 'ContentDetailRequest'; |
| 7 | 7 | ||
| 8 | const mock_switch = false; | 8 | const mock_switch = false; |
| 9 | 9 | ||
| 10 | +export interface RmhPublishNextsParams { | ||
| 11 | + creatorId: string | ||
| 12 | + contentId: string | ||
| 13 | + contentType: number | ||
| 14 | + nextFlag: number | ||
| 15 | + pageSize: number | ||
| 16 | + refreshTime:number | ||
| 17 | +} | ||
| 18 | + | ||
| 10 | export interface ContentDetailRequestParams { | 19 | export interface ContentDetailRequestParams { |
| 11 | contentId: string | 20 | contentId: string |
| 12 | relId: string | 21 | relId: string |
| @@ -209,6 +218,21 @@ export class ContentDetailRequest { | @@ -209,6 +218,21 @@ export class ContentDetailRequest { | ||
| 209 | return url; | 218 | return url; |
| 210 | } | 219 | } |
| 211 | 220 | ||
| 221 | + /** | ||
| 222 | + * 获取号主发布的视频 | ||
| 223 | + * */ | ||
| 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 | ||
| 228 | + + "&contentType=" + contentType | ||
| 229 | + + "&nextFlag=" + nextFlag | ||
| 230 | + + "&pageSize=" + pageSize | ||
| 231 | + + "&refreshTime=" + refreshTime; | ||
| 232 | + console.info(`cj2024 getRmhPublishNextsUrl url = ${url}`) | ||
| 233 | + return url; | ||
| 234 | + } | ||
| 235 | + | ||
| 212 | 236 | ||
| 213 | static getLiveRoomPullStreamUrl(vliveId:string){ | 237 | static getLiveRoomPullStreamUrl(vliveId:string){ |
| 214 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.PULL_STREAM_PATH | 238 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.PULL_STREAM_PATH |
| @@ -230,6 +254,14 @@ export class ContentDetailRequest { | @@ -230,6 +254,14 @@ export class ContentDetailRequest { | ||
| 230 | return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url) | 254 | return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url) |
| 231 | } | 255 | } |
| 232 | 256 | ||
| 257 | + static getRmhPublishNexts(params: RmhPublishNextsParams): Promise<ResponseDTO<PeopleShipNextListDTO>> { | ||
| 258 | + // if (mock_switch) { | ||
| 259 | + // return ContentDetailRequest.getContentDetailDataMock(getContext()); | ||
| 260 | + // } | ||
| 261 | + let url = ContentDetailRequest.getRmhPublishNextsUrl(params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime) | ||
| 262 | + return WDHttp.get<ResponseDTO<PeopleShipNextListDTO>>(url) | ||
| 263 | + } | ||
| 264 | + | ||
| 233 | 265 | ||
| 234 | 266 | ||
| 235 | /** | 267 | /** |
| 1 | -import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; | 1 | +import { Action, ContentDetailDTO, ContentDTO, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean/Index'; |
| 2 | import { NetworkUtil, WindowModel } from 'wdKit'; | 2 | import { NetworkUtil, WindowModel } from 'wdKit'; |
| 3 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | 3 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' |
| 4 | import { ResponseDTO } from 'wdNetwork/Index'; | 4 | import { ResponseDTO } from 'wdNetwork/Index'; |
| @@ -11,7 +11,7 @@ import { EmptyComponent, LottieView } from 'wdComponent/Index'; | @@ -11,7 +11,7 @@ import { EmptyComponent, LottieView } from 'wdComponent/Index'; | ||
| 11 | import { DateTimeUtils } from 'wdKit/Index'; | 11 | import { DateTimeUtils } from 'wdKit/Index'; |
| 12 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; | 12 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; |
| 13 | import { AudioSuspensionModel } from 'wdComponent' | 13 | import { AudioSuspensionModel } from 'wdComponent' |
| 14 | -import { BusinessError } from '@kit.BasicServicesKit'; | 14 | +import { BusinessError, systemDateTime } from '@kit.BasicServicesKit'; |
| 15 | 15 | ||
| 16 | const storage = LocalStorage.getShared(); | 16 | const storage = LocalStorage.getShared(); |
| 17 | const TAG = 'DetailVideoListPage' | 17 | const TAG = 'DetailVideoListPage' |
| @@ -19,6 +19,7 @@ const TAG = 'DetailVideoListPage' | @@ -19,6 +19,7 @@ const TAG = 'DetailVideoListPage' | ||
| 19 | @Entry(storage) | 19 | @Entry(storage) |
| 20 | @Component | 20 | @Component |
| 21 | export struct DetailVideoListPage { | 21 | export struct DetailVideoListPage { |
| 22 | + @State peopleShipHomeCreatorId: string = ''; | ||
| 22 | private contentId: string = '' | 23 | private contentId: string = '' |
| 23 | private relId: string = '' | 24 | private relId: string = '' |
| 24 | private relType: string = '' | 25 | private relType: string = '' |
| @@ -48,6 +49,30 @@ export struct DetailVideoListPage { | @@ -48,6 +49,30 @@ export struct DetailVideoListPage { | ||
| 48 | @State isShowAudioCom: boolean = false | 49 | @State isShowAudioCom: boolean = false |
| 49 | @StorageLink('GestureLoadStrategy') GestureLoadStrategy: number = 0 | 50 | @StorageLink('GestureLoadStrategy') GestureLoadStrategy: number = 0 |
| 50 | 51 | ||
| 52 | + // async getRmhDetail() { | ||
| 53 | + // // 注册监听网络连接 | ||
| 54 | + // this.netStatus = undefined | ||
| 55 | + // let netStatus = NetworkUtil.isNetConnected() | ||
| 56 | + // if (netStatus) { | ||
| 57 | + // this.openFullScreen() | ||
| 58 | + // const action: Action = router.getParams() as Action | ||
| 59 | + // if (action) { | ||
| 60 | + // this.contentId = action.params?.contentID || '' | ||
| 61 | + // if (action.params && action.params.extra) { | ||
| 62 | + // this.relId = action.params.extra.relId || '' | ||
| 63 | + // this.relType = action.params.extra.relType || '' | ||
| 64 | + // } | ||
| 65 | + // await this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 66 | + // } | ||
| 67 | + // await this.queryVideoList() | ||
| 68 | + // // console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) | ||
| 69 | + // | ||
| 70 | + // } else { | ||
| 71 | + // // 无网络 | ||
| 72 | + // this.netStatus = 1 | ||
| 73 | + // } | ||
| 74 | + // } | ||
| 75 | + | ||
| 51 | async getDetail() { | 76 | async getDetail() { |
| 52 | // 注册监听网络连接 | 77 | // 注册监听网络连接 |
| 53 | this.netStatus = undefined | 78 | this.netStatus = undefined |
| @@ -73,11 +98,37 @@ export struct DetailVideoListPage { | @@ -73,11 +98,37 @@ export struct DetailVideoListPage { | ||
| 73 | } | 98 | } |
| 74 | 99 | ||
| 75 | aboutToAppear() { | 100 | aboutToAppear() { |
| 76 | - this.getDetail() | 101 | + // 在视频详情页 |
| 102 | + this.peopleShipHomeCreatorId = AppStorage.get<string>('peopleShipHomeCreatorId') || ''; | ||
| 103 | + console.info(`cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`) | ||
| 104 | + if (this.peopleShipHomeCreatorId) { | ||
| 105 | + // 从人民号号主传过来的 | ||
| 106 | + this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId); | ||
| 107 | + } else { | ||
| 108 | + // 根据ID重新获取列表 | ||
| 109 | + this.getDetail() | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + async getPeopleShipHomeDetail(peopleShipHomeCreatorId: string) { | ||
| 115 | + this.openFullScreen(); | ||
| 116 | + const action: Action = router.getParams() as Action; | ||
| 117 | + if (action) { | ||
| 118 | + this.contentId = action.params?.contentID || ''; | ||
| 119 | + if (action.params && action.params.extra) { | ||
| 120 | + this.relId = action.params.extra.relId || ''; | ||
| 121 | + this.relType = action.params.extra.relType || ''; | ||
| 122 | + } | ||
| 123 | + console.info(`cj2024 getPeopleShipHomeDetail contentId = ${this.contentId}`) | ||
| 124 | + await this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 125 | + this.getRmhPublishNexts(peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false)); | ||
| 126 | + } | ||
| 77 | } | 127 | } |
| 78 | 128 | ||
| 79 | aboutToDisappear(): void { | 129 | aboutToDisappear(): void { |
| 80 | // console.log(TAG, 'aboutToDisappear') | 130 | // console.log(TAG, 'aboutToDisappear') |
| 131 | + // AppStorage.setOrCreate<string>('peopleShipHomeCreatorId', '') //清空人民号动态等过来的数据 | ||
| 81 | this.closeFullScreen() | 132 | this.closeFullScreen() |
| 82 | } | 133 | } |
| 83 | 134 | ||
| @@ -191,6 +242,76 @@ export struct DetailVideoListPage { | @@ -191,6 +242,76 @@ export struct DetailVideoListPage { | ||
| 191 | }) | 242 | }) |
| 192 | } | 243 | } |
| 193 | 244 | ||
| 245 | + //获取号主关联视频 | ||
| 246 | + async getRmhContentDetail(contentId: string, relId: string, relType: string) { | ||
| 247 | + await ContentDetailRequest.getContentDetail({ | ||
| 248 | + contentId: contentId, | ||
| 249 | + relId: relId, | ||
| 250 | + relType: relType | ||
| 251 | + }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 252 | + console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | ||
| 253 | + this.isOffLine = resDTO.data == null ? true : false | ||
| 254 | + if (resDTO.data) { | ||
| 255 | + const params: contentListParams = { | ||
| 256 | + contentList: [{ | ||
| 257 | + contentId: resDTO.data[0].newsId + '', | ||
| 258 | + contentType: resDTO.data[0].newsType | ||
| 259 | + }] | ||
| 260 | + } | ||
| 261 | + // 批量查询内容当前用户点赞、收藏状态 | ||
| 262 | + await ContentDetailRequest.getContentInteract(params).then(res => { | ||
| 263 | + if (res.data) { | ||
| 264 | + this.interactDataList = this.interactDataList.concat(res.data) | ||
| 265 | + } | ||
| 266 | + // console.log('获取互动点赞等数据===', JSON.stringify(res)) | ||
| 267 | + }) | ||
| 268 | + this.data.push(resDTO.data[0]) | ||
| 269 | + } | ||
| 270 | + }) | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + /** | ||
| 274 | + * 获取号主相关视频 | ||
| 275 | + creatorId 创作者id | ||
| 276 | + contentId 播放视频id | ||
| 277 | + contentType 1-视频 | ||
| 278 | + nextFlag 0:上页,1:下页 | ||
| 279 | + pageSize 10 返回数量 | ||
| 280 | + refreshTime 1694073009294 | ||
| 281 | + * */ | ||
| 282 | + async getRmhPublishNexts(creatorId: string, contentId: string, contentType: number,nextFlag: number,pageSize: number,refreshTime:number) { | ||
| 283 | + await ContentDetailRequest.getRmhPublishNexts({ | ||
| 284 | + creatorId: creatorId, | ||
| 285 | + contentId: contentId, | ||
| 286 | + contentType: contentType, | ||
| 287 | + nextFlag: nextFlag, | ||
| 288 | + pageSize: pageSize, | ||
| 289 | + refreshTime: refreshTime | ||
| 290 | + }).then(async (resDTO: ResponseDTO<PeopleShipNextListDTO>) => { | ||
| 291 | + console.log(TAG, 'cj2024 getRmhPublishNexts:', JSON.stringify(resDTO.data)) | ||
| 292 | + this.isOffLine = resDTO.data == null ? true : false | ||
| 293 | + if (resDTO.data && resDTO.data.list && resDTO.data.list.length > 0) { | ||
| 294 | + const params: contentListParams = { | ||
| 295 | + contentList: [{ | ||
| 296 | + contentId: resDTO.data.list[0].newsId + '', | ||
| 297 | + contentType: resDTO.data.list[0].newsType | ||
| 298 | + }] | ||
| 299 | + } | ||
| 300 | + // 批量查询内容当前用户点赞、收藏状态 | ||
| 301 | + await ContentDetailRequest.getContentInteract(params).then(res => { | ||
| 302 | + if (res.data) { | ||
| 303 | + this.interactDataList = this.interactDataList.concat(res.data) | ||
| 304 | + } | ||
| 305 | + // console.log('获取互动点赞等数据===', JSON.stringify(res)) | ||
| 306 | + }) | ||
| 307 | + resDTO.data.list.forEach(element => { | ||
| 308 | + this.data.push(element) | ||
| 309 | + }); | ||
| 310 | + | ||
| 311 | + } | ||
| 312 | + }) | ||
| 313 | + } | ||
| 314 | + | ||
| 194 | /** | 315 | /** |
| 195 | * 查询视频列表用于翻页 | 316 | * 查询视频列表用于翻页 |
| 196 | */ | 317 | */ |
| @@ -200,6 +321,7 @@ export struct DetailVideoListPage { | @@ -200,6 +321,7 @@ export struct DetailVideoListPage { | ||
| 200 | refreshCnt: 1 | 321 | refreshCnt: 1 |
| 201 | }).then(async res => { | 322 | }).then(async res => { |
| 202 | if (res.data) { | 323 | if (res.data) { |
| 324 | + console.log(TAG, 'cj2024 queryVideoList:', JSON.stringify(res.data)) | ||
| 203 | await this.getContentInteract(res.data) | 325 | await this.getContentInteract(res.data) |
| 204 | this.data = this.data.concat(res.data) | 326 | this.data = this.data.concat(res.data) |
| 205 | // console.log('视频列表===', JSON.stringify(res.data)) | 327 | // console.log('视频列表===', JSON.stringify(res.data)) |
| @@ -279,7 +401,10 @@ export struct DetailVideoListPage { | @@ -279,7 +401,10 @@ export struct DetailVideoListPage { | ||
| 279 | this.currentIndex = index | 401 | this.currentIndex = index |
| 280 | if (this.currentIndex === this.data.length - 1) { | 402 | if (this.currentIndex === this.data.length - 1) { |
| 281 | // TODO:下拉刷新“努力加载中” | 403 | // TODO:下拉刷新“努力加载中” |
| 282 | - this.queryVideoList() | 404 | + if (!this.peopleShipHomeCreatorId) { |
| 405 | + this.queryVideoList() | ||
| 406 | + } | ||
| 407 | + // this.getRmhPublishNexts(this.peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false)); | ||
| 283 | } | 408 | } |
| 284 | }) | 409 | }) |
| 285 | // 作为手势动画的背景 | 410 | // 作为手势动画的背景 |
-
Please register or login to post a comment