chenjun

人民号号主视频页点击进入到播放详情页上下翻页应该和号主视频关联

... ... @@ -32,6 +32,10 @@ export class HttpUrlUtils {
* 详情页面详情接口
*/
static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
/**
* 号主作品
*/
static readonly PUBLISH_NEXT_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/publishNexts";
/**
* 获取视频直播间拉流地址
... ...
import { ContentDTO } from '../content/ContentDTO'
import { ContentDetailDTO } from '../detail/ContentDetailDTO';
export interface PeopleShipNextListDTO {
followCreators: boolean;
hasNext: number;
list: ContentDetailDTO[];
pageNum: number;
pageSize: number;
totalCount: number;
}
\ No newline at end of file
... ...
... ... @@ -13,7 +13,8 @@ import {
ArticleTypeData,
ArticleListData,
PeopleShipUserDetailData,
CompDTO
CompDTO,
ContentDetailDTO
} from 'wdBean'
import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
... ... @@ -28,6 +29,7 @@ const TAG = 'PeopleShipHomeArticleListComponent';
@Component
export struct PeopleShipHomeArticleListComponent {
@State arr: ContentDTO[] = []
//@State arrDetailList: ContentDetailDTO[] = []
// @State arr: LazyDataSource<ContentDTO> = new LazyDataSource();
@State typeModel: ArticleTypeData = new ArticleTypeData()
@State creatorId: string = ''
... ... @@ -125,12 +127,19 @@ export struct PeopleShipHomeArticleListComponent {
}
aboutToAppear() {
console.log(TAG, 'cj2024 aboutToAppear')
AppStorage.setOrCreate<string>('peopleShipHomeCreatorId', this.creatorId)
if (this.currentIndex == this.currentTopSelectedIndex) {
this.currentPage = 1
this.getPeopleShipPageArticleList()
}
}
aboutToDisappear(): void {
console.log(TAG, 'cj2024 aboutToDisappear')
AppStorage.setOrCreate<string>('peopleShipHomeCreatorId', '') //清空人民号动态等过来的数据
}
onChange() {
if (this.currentIndex == this.currentTopSelectedIndex && this.arr.length == 0) {
this.currentPage = 1
... ... @@ -223,6 +232,7 @@ export struct PeopleShipHomeArticleListComponent {
}
for (const element of listData.list) {
let contentDTO = new ContentDTO()
//let contentDetailDTO = new ContentDetailDTO()
console.info(TAG, 'element.appStyle'+`${element.appStyle}`)
contentDTO.appStyle = this.changeCommon(element.appStyle)
contentDTO.newsTitle = element.title;
... ...
import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO } from 'wdBean';
import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
const TAG = 'ContentDetailRequest';
const mock_switch = false;
export interface RmhPublishNextsParams {
creatorId: string
contentId: string
contentType: number
nextFlag: number
pageSize: number
refreshTime:number
}
export interface ContentDetailRequestParams {
contentId: string
relId: string
... ... @@ -209,6 +218,21 @@ export class ContentDetailRequest {
return url;
}
/**
* 获取号主发布的视频
* */
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
+ "&contentType=" + contentType
+ "&nextFlag=" + nextFlag
+ "&pageSize=" + pageSize
+ "&refreshTime=" + refreshTime;
console.info(`cj2024 getRmhPublishNextsUrl url = ${url}`)
return url;
}
static getLiveRoomPullStreamUrl(vliveId:string){
let url = HttpUrlUtils.getHost() + HttpUrlUtils.PULL_STREAM_PATH
... ... @@ -230,6 +254,14 @@ export class ContentDetailRequest {
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url)
}
static getRmhPublishNexts(params: RmhPublishNextsParams): Promise<ResponseDTO<PeopleShipNextListDTO>> {
// if (mock_switch) {
// return ContentDetailRequest.getContentDetailDataMock(getContext());
// }
let url = ContentDetailRequest.getRmhPublishNextsUrl(params.creatorId,params.contentId, params.contentType, params.nextFlag, params.pageSize, params.refreshTime)
return WDHttp.get<ResponseDTO<PeopleShipNextListDTO>>(url)
}
/**
... ...
import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
import { Action, ContentDetailDTO, ContentDTO, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean/Index';
import { NetworkUtil, WindowModel } from 'wdKit';
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index';
... ... @@ -11,7 +11,7 @@ import { EmptyComponent, LottieView } from 'wdComponent/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
import { AudioSuspensionModel } from 'wdComponent'
import { BusinessError } from '@kit.BasicServicesKit';
import { BusinessError, systemDateTime } from '@kit.BasicServicesKit';
const storage = LocalStorage.getShared();
const TAG = 'DetailVideoListPage'
... ... @@ -19,6 +19,7 @@ const TAG = 'DetailVideoListPage'
@Entry(storage)
@Component
export struct DetailVideoListPage {
@State peopleShipHomeCreatorId: string = '';
private contentId: string = ''
private relId: string = ''
private relType: string = ''
... ... @@ -48,6 +49,30 @@ export struct DetailVideoListPage {
@State isShowAudioCom: boolean = false
@StorageLink('GestureLoadStrategy') GestureLoadStrategy: number = 0
// async getRmhDetail() {
// // 注册监听网络连接
// this.netStatus = undefined
// let netStatus = NetworkUtil.isNetConnected()
// if (netStatus) {
// this.openFullScreen()
// const action: Action = router.getParams() as Action
// if (action) {
// this.contentId = action.params?.contentID || ''
// if (action.params && action.params.extra) {
// this.relId = action.params.extra.relId || ''
// this.relType = action.params.extra.relType || ''
// }
// await this.getContentDetail(this.contentId, this.relId, this.relType)
// }
// await this.queryVideoList()
// // console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
//
// } else {
// // 无网络
// this.netStatus = 1
// }
// }
async getDetail() {
// 注册监听网络连接
this.netStatus = undefined
... ... @@ -73,11 +98,37 @@ export struct DetailVideoListPage {
}
aboutToAppear() {
// 在视频详情页
this.peopleShipHomeCreatorId = AppStorage.get<string>('peopleShipHomeCreatorId') || '';
console.info(`cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`)
if (this.peopleShipHomeCreatorId) {
// 从人民号号主传过来的
this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId);
} else {
// 根据ID重新获取列表
this.getDetail()
}
}
async getPeopleShipHomeDetail(peopleShipHomeCreatorId: string) {
this.openFullScreen();
const action: Action = router.getParams() as Action;
if (action) {
this.contentId = action.params?.contentID || '';
if (action.params && action.params.extra) {
this.relId = action.params.extra.relId || '';
this.relType = action.params.extra.relType || '';
}
console.info(`cj2024 getPeopleShipHomeDetail contentId = ${this.contentId}`)
await this.getContentDetail(this.contentId, this.relId, this.relType)
this.getRmhPublishNexts(peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false));
}
}
aboutToDisappear(): void {
// console.log(TAG, 'aboutToDisappear')
// AppStorage.setOrCreate<string>('peopleShipHomeCreatorId', '') //清空人民号动态等过来的数据
this.closeFullScreen()
}
... ... @@ -191,6 +242,76 @@ export struct DetailVideoListPage {
})
}
//获取号主关联视频
async getRmhContentDetail(contentId: string, relId: string, relType: string) {
await ContentDetailRequest.getContentDetail({
contentId: contentId,
relId: relId,
relType: relType
}).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
this.isOffLine = resDTO.data == null ? true : false
if (resDTO.data) {
const params: contentListParams = {
contentList: [{
contentId: resDTO.data[0].newsId + '',
contentType: resDTO.data[0].newsType
}]
}
// 批量查询内容当前用户点赞、收藏状态
await ContentDetailRequest.getContentInteract(params).then(res => {
if (res.data) {
this.interactDataList = this.interactDataList.concat(res.data)
}
// console.log('获取互动点赞等数据===', JSON.stringify(res))
})
this.data.push(resDTO.data[0])
}
})
}
/**
* 获取号主相关视频
creatorId 创作者id
contentId 播放视频id
contentType 1-视频
nextFlag 0:上页,1:下页
pageSize 10 返回数量
refreshTime 1694073009294
* */
async getRmhPublishNexts(creatorId: string, contentId: string, contentType: number,nextFlag: number,pageSize: number,refreshTime:number) {
await ContentDetailRequest.getRmhPublishNexts({
creatorId: creatorId,
contentId: contentId,
contentType: contentType,
nextFlag: nextFlag,
pageSize: pageSize,
refreshTime: refreshTime
}).then(async (resDTO: ResponseDTO<PeopleShipNextListDTO>) => {
console.log(TAG, 'cj2024 getRmhPublishNexts:', JSON.stringify(resDTO.data))
this.isOffLine = resDTO.data == null ? true : false
if (resDTO.data && resDTO.data.list && resDTO.data.list.length > 0) {
const params: contentListParams = {
contentList: [{
contentId: resDTO.data.list[0].newsId + '',
contentType: resDTO.data.list[0].newsType
}]
}
// 批量查询内容当前用户点赞、收藏状态
await ContentDetailRequest.getContentInteract(params).then(res => {
if (res.data) {
this.interactDataList = this.interactDataList.concat(res.data)
}
// console.log('获取互动点赞等数据===', JSON.stringify(res))
})
resDTO.data.list.forEach(element => {
this.data.push(element)
});
}
})
}
/**
* 查询视频列表用于翻页
*/
... ... @@ -200,6 +321,7 @@ export struct DetailVideoListPage {
refreshCnt: 1
}).then(async res => {
if (res.data) {
console.log(TAG, 'cj2024 queryVideoList:', JSON.stringify(res.data))
await this.getContentInteract(res.data)
this.data = this.data.concat(res.data)
// console.log('视频列表===', JSON.stringify(res.data))
... ... @@ -279,8 +401,11 @@ export struct DetailVideoListPage {
this.currentIndex = index
if (this.currentIndex === this.data.length - 1) {
// TODO:下拉刷新“努力加载中”
if (!this.peopleShipHomeCreatorId) {
this.queryVideoList()
}
// this.getRmhPublishNexts(this.peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false));
}
})
// 作为手势动画的背景
Row() {}
... ...