zhenghy

直播评论接入

@@ -18,7 +18,8 @@ @@ -18,7 +18,8 @@
18 "wdRouter": "file:../../commons/wdRouter", 18 "wdRouter": "file:../../commons/wdRouter",
19 "wdNetwork": "file:../../commons/wdNetwork", 19 "wdNetwork": "file:../../commons/wdNetwork",
20 "wdJsBridge": "file:../../commons/wdJsBridge", 20 "wdJsBridge": "file:../../commons/wdJsBridge",
21 - "wdDetailPlayApi":"file:../../features/wdDetailPlayApi",  
22 - "wdHwAbility": "file:../../features/wdHwAbility" 21 + "wdDetailPlayApi": "file:../../features/wdDetailPlayApi",
  22 + "wdHwAbility": "file:../../features/wdHwAbility",
  23 + "wdShare": "file:../../features/wdShare"
23 } 24 }
24 } 25 }
@@ -43,6 +43,8 @@ export struct DetailPlayLiveCommon { @@ -43,6 +43,8 @@ export struct DetailPlayLiveCommon {
43 } 43 }
44 .height('100%') 44 .height('100%')
45 .width('100%') 45 .width('100%')
  46 + .backgroundColor(Color.Black)
  47 + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
46 } 48 }
47 49
48 getLiveDetails() { 50 getLiveDetails() {
1 -import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'; 1 +import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index';
2 import { LiveViewModel } from '../viewModel/LiveViewModel'; 2 import { LiveViewModel } from '../viewModel/LiveViewModel';
3 import { TabComponent } from '../widgets/details/TabComponent'; 3 import { TabComponent } from '../widgets/details/TabComponent';
4 import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; 4 import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
@@ -9,6 +9,9 @@ import { router, window } from '@kit.ArkUI'; @@ -9,6 +9,9 @@ import { router, window } from '@kit.ArkUI';
9 import { devicePLSensorManager } from 'wdDetailPlayApi/Index'; 9 import { devicePLSensorManager } from 'wdDetailPlayApi/Index';
10 import { LiveCommentComponent } from 'wdComponent/Index'; 10 import { LiveCommentComponent } from 'wdComponent/Index';
11 import { WDPlayerController } from 'wdPlayer/Index'; 11 import { WDPlayerController } from 'wdPlayer/Index';
  12 +import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView';
  13 +import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
  14 +import { ResponseDTO } from 'wdNetwork/Index';
12 15
13 let TAG: string = 'DetailPlayLivePage'; 16 let TAG: string = 'DetailPlayLivePage';
14 17
@@ -29,6 +32,8 @@ export struct DetailPlayLivePage { @@ -29,6 +32,8 @@ export struct DetailPlayLivePage {
29 @Consume @Watch('onPageShowCus') pageShow: number 32 @Consume @Watch('onPageShowCus') pageShow: number
30 @Consume @Watch('onPageHideCus') pageHide: number 33 @Consume @Watch('onPageHideCus') pageHide: number
31 @Consume @Watch('onBackPressCus') pageBackPress: number 34 @Consume @Watch('onBackPressCus') pageBackPress: number
  35 + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  36 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
32 37
33 aboutToAppear(): void { 38 aboutToAppear(): void {
34 Logger.info(TAG, `wyj-aboutToAppear`) 39 Logger.info(TAG, `wyj-aboutToAppear`)
@@ -43,6 +48,7 @@ export struct DetailPlayLivePage { @@ -43,6 +48,7 @@ export struct DetailPlayLivePage {
43 }) 48 })
44 this.getLiveDetails() 49 this.getLiveDetails()
45 this.getLiveRoomData() 50 this.getLiveRoomData()
  51 + this.getContentDetail()
46 } 52 }
47 53
48 build() { 54 build() {
@@ -52,8 +58,17 @@ export struct DetailPlayLivePage { @@ -52,8 +58,17 @@ export struct DetailPlayLivePage {
52 TabComponent({ tabs: this.tabs }) 58 TabComponent({ tabs: this.tabs })
53 .layoutWeight(503) 59 .layoutWeight(503)
54 .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) 60 .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
55 - LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) 61 +
  62 + OperRowListView({
  63 + operationButtonList: ['comment', 'collect', 'share', 'like'],
  64 + contentDetailData: this.contentDetailData,
  65 + publishCommentModel: this.publishCommentModel,
  66 + })
56 .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) 67 .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
  68 +
  69 +
  70 + // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
  71 + // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
57 } 72 }
58 .height('100%') 73 .height('100%')
59 .width('100%') 74 .width('100%')
@@ -91,6 +106,28 @@ export struct DetailPlayLivePage { @@ -91,6 +106,28 @@ export struct DetailPlayLivePage {
91 return true 106 return true
92 } 107 }
93 108
  109 + /**
  110 + * 查询视频详情用于评论展示
  111 + */
  112 + getContentDetail() {
  113 + this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType)
  114 + .then((data: Array<ContentDetailDTO>) => {
  115 + console.log(TAG, 'getContentDetail:', JSON.stringify(data))
  116 + if (data) {
  117 + this.contentDetailData = data?.[0];
  118 + if (this.contentDetailData?.openComment) {
  119 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  120 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  121 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  122 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  123 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  124 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  125 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
  126 + }
  127 + }
  128 + })
  129 + }
  130 +
94 getLiveDetails() { 131 getLiveDetails() {
95 this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) 132 this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType)
96 .then( 133 .then(
@@ -34,7 +34,7 @@ export struct DetailPlayVLivePage { @@ -34,7 +34,7 @@ export struct DetailPlayVLivePage {
34 34
35 aboutToAppear(): void { 35 aboutToAppear(): void {
36 console.log(TAG, 'aboutToAppear') 36 console.log(TAG, 'aboutToAppear')
37 - WindowModel.shared.setWindowLayoutFullScreen(true) 37 + // WindowModel.shared.setWindowLayoutFullScreen(true)
38 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) 38 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
39 39
40 //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 40 //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
@@ -48,7 +48,7 @@ export struct DetailPlayVLivePage { @@ -48,7 +48,7 @@ export struct DetailPlayVLivePage {
48 } 48 }
49 49
50 aboutToDisappear(): void { 50 aboutToDisappear(): void {
51 - WindowModel.shared.setWindowLayoutFullScreen(false) 51 + // WindowModel.shared.setWindowLayoutFullScreen(false)
52 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) 52 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
53 } 53 }
54 54
@@ -107,7 +107,8 @@ export struct DetailPlayVLivePage { @@ -107,7 +107,8 @@ export struct DetailPlayVLivePage {
107 (data) => { 107 (data) => {
108 if (data.length > 0) { 108 if (data.length > 0) {
109 this.liveDetailsBean = data[0] 109 this.liveDetailsBean = data[0]
110 - this.liveState = this.liveDetailsBean.liveInfo?.liveState //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 110 + this.liveState =
  111 + this.liveDetailsBean.liveInfo?.liveState //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
111 if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { 112 if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
112 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url 113 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
113 } 114 }
1 import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; 1 import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
2 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 2 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
3 import { Logger, ToastUtils } from 'wdKit'; 3 import { Logger, ToastUtils } from 'wdKit';
4 -import { LiveDetailsBean, LiveRoomBean, LiveRoomDataBean } from 'wdBean/Index'; 4 +import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean } from 'wdBean/Index';
  5 +import { ContentDetailRequest } from 'wdDetailPlayApi/Index';
5 6
6 const TAG = 'LiveModel' 7 const TAG = 'LiveModel'
7 8
8 export class LiveModel { 9 export class LiveModel {
  10 + getContentDetail(contentId: string, relId: string, relType: string) {
  11 + return new Promise<Array<ContentDetailDTO>>((success, fail) => {
  12 + ContentDetailRequest.getContentDetail({
  13 + contentId: contentId,
  14 + relId: relId,
  15 + relType: relType
  16 + }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
  17 + console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
  18 + if (resDTO.data) {
  19 + success(resDTO.data)
  20 + }
  21 + }).catch(() => {
  22 + fail("数据为空")
  23 + })
  24 +
  25 + })
  26 +
  27 + }
  28 +
9 /** 29 /**
10 * 直播内容详情 30 * 直播内容详情
11 * @param contentId 31 * @param contentId
1 -import { LiveDetailsBean, LiveRoomBean, LiveRoomDataBean } from 'wdBean/Index' 1 +import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean } from 'wdBean/Index'
  2 +
2 import { ResponseDTO } from 'wdNetwork/Index' 3 import { ResponseDTO } from 'wdNetwork/Index'
3 import { LiveModel } from './LiveModel' 4 import { LiveModel } from './LiveModel'
4 5
@@ -11,6 +12,45 @@ export class LiveViewModel { @@ -11,6 +12,45 @@ export class LiveViewModel {
11 this.liveModel = new LiveModel() 12 this.liveModel = new LiveModel()
12 } 13 }
13 14
  15 + // 视频信息
  16 + getContentDetail(contentId: string, relId: string, relType: string) {
  17 + return new Promise<Array<ContentDetailDTO>>((success, fail) => {
  18 + this.liveModel.getContentDetail(contentId, relId, relType).then((data) => {
  19 + success(data)
  20 + }).catch((message: string) => {
  21 + fail(message)
  22 + })
  23 + })
  24 +
  25 + }
  26 +
  27 +
  28 + // async getContentDetail(contentId: string, relId: string, relType: string) {
  29 + // return ContentDetailRequest.getContentDetail({
  30 + // contentId: contentId,
  31 + // relId: relId,
  32 + // relType: relType
  33 + // }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
  34 + // console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
  35 + // if (resDTO.data) {
  36 + //
  37 + // this.contentDetailData = resDTO.data?.[0];
  38 + //
  39 + // if (this.contentDetailData?.openComment) {
  40 + // this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  41 + // this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  42 + // this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  43 + // this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  44 + // this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  45 + // this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  46 + // this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
  47 + // }
  48 + //
  49 + //
  50 + // }
  51 + // })
  52 + // }
  53 +
14 //直播详情 54 //直播详情
15 getLiveDetails(contentId: string, relId: string, relType: string) { 55 getLiveDetails(contentId: string, relId: string, relType: string) {
16 return new Promise<Array<LiveDetailsBean>>((success, fail) => { 56 return new Promise<Array<LiveDetailsBean>>((success, fail) => {