Showing
12 changed files
with
144 additions
and
105 deletions
| @@ -5,9 +5,9 @@ import { | @@ -5,9 +5,9 @@ import { | ||
| 5 | ContentDetailRequest, | 5 | ContentDetailRequest, |
| 6 | postInteractAccentionOperateParams | 6 | postInteractAccentionOperateParams |
| 7 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 7 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 8 | -import { postBatchAttentionStatusParams, RmhInfoDTO } from 'wdBean/Index'; | 8 | +import { ContentDetailDTO, Params, postBatchAttentionStatusParams, RmhInfoDTO } from 'wdBean/Index'; |
| 9 | import { SpConstants } from 'wdConstant/Index'; | 9 | import { SpConstants } from 'wdConstant/Index'; |
| 10 | -import { Logger, SPHelper } from 'wdKit/Index'; | 10 | +import { Logger, SPHelper, ToastUtils } from 'wdKit/Index'; |
| 11 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 11 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 12 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | 12 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; |
| 13 | 13 | ||
| @@ -16,6 +16,8 @@ const TAG = 'LiveFollowComponent' | @@ -16,6 +16,8 @@ const TAG = 'LiveFollowComponent' | ||
| 16 | @Component | 16 | @Component |
| 17 | export struct LiveFollowComponent { | 17 | export struct LiveFollowComponent { |
| 18 | @Prop rmhInfo: RmhInfoDTO | 18 | @Prop rmhInfo: RmhInfoDTO |
| 19 | + @Consume contentDetailData: ContentDetailDTO | ||
| 20 | + @Consume @Watch('getBatchAttentionStatus') pageShow: number | ||
| 19 | 21 | ||
| 20 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 21 | this.getBatchAttentionStatus() | 23 | this.getBatchAttentionStatus() |
| @@ -42,6 +44,16 @@ export struct LiveFollowComponent { | @@ -42,6 +44,16 @@ export struct LiveFollowComponent { | ||
| 42 | .width(24) | 44 | .width(24) |
| 43 | .height(24) | 45 | .height(24) |
| 44 | .borderRadius(90) | 46 | .borderRadius(90) |
| 47 | + .onClick(() => { | ||
| 48 | + // 跳转到号主页 | ||
| 49 | + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | ||
| 50 | + const params: Params = { | ||
| 51 | + creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 52 | + pageID: '' | ||
| 53 | + } | ||
| 54 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 55 | + } | ||
| 56 | + }) | ||
| 45 | Text(this.rmhInfo.rmhName) | 57 | Text(this.rmhInfo.rmhName) |
| 46 | .fontColor(Color.White) | 58 | .fontColor(Color.White) |
| 47 | .maxLines(1) | 59 | .maxLines(1) |
| @@ -66,6 +78,7 @@ export struct LiveFollowComponent { | @@ -66,6 +78,7 @@ export struct LiveFollowComponent { | ||
| 66 | .borderRadius(2) | 78 | .borderRadius(2) |
| 67 | .margin({ right: 2 }) | 79 | .margin({ right: 2 }) |
| 68 | .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) | 80 | .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) |
| 81 | + .visibility(this.followStatus === '0' ? Visibility.Visible : Visibility.None) | ||
| 69 | .onClick(() => { | 82 | .onClick(() => { |
| 70 | this.handleAccention() | 83 | this.handleAccention() |
| 71 | }) | 84 | }) |
| @@ -114,6 +127,13 @@ export struct LiveFollowComponent { | @@ -114,6 +127,13 @@ export struct LiveFollowComponent { | ||
| 114 | this.followStatus = '0' | 127 | this.followStatus = '0' |
| 115 | } else { | 128 | } else { |
| 116 | this.followStatus = '1' | 129 | this.followStatus = '1' |
| 130 | + // 弹窗样式与何时调用待确认 | ||
| 131 | + ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => { | ||
| 132 | + console.log('关注号主获取积分==', JSON.stringify(res.data)) | ||
| 133 | + if (res.data?.showToast) { | ||
| 134 | + ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); | ||
| 135 | + } | ||
| 136 | + }) | ||
| 117 | } | 137 | } |
| 118 | }) | 138 | }) |
| 119 | } | 139 | } |
| @@ -7,6 +7,8 @@ import { ContentDetailDTO } from 'wdBean/Index' | @@ -7,6 +7,8 @@ import { ContentDetailDTO } from 'wdBean/Index' | ||
| 7 | @Preview | 7 | @Preview |
| 8 | @Component | 8 | @Component |
| 9 | export struct CommentTabComponent { | 9 | export struct CommentTabComponent { |
| 10 | + private onCommentFocus: () => void = () => { | ||
| 11 | + } | ||
| 10 | @ObjectLink publishCommentModel: publishCommentModel | 12 | @ObjectLink publishCommentModel: publishCommentModel |
| 11 | @Prop contentDetail: ContentDetailDTO | 13 | @Prop contentDetail: ContentDetailDTO |
| 12 | /*展示类型*/ | 14 | /*展示类型*/ |
| @@ -47,6 +49,7 @@ export struct CommentTabComponent { | @@ -47,6 +49,7 @@ export struct CommentTabComponent { | ||
| 47 | } | 49 | } |
| 48 | }.width(151).height(30) | 50 | }.width(151).height(30) |
| 49 | .onClick(() => { | 51 | .onClick(() => { |
| 52 | + this.onCommentFocus && this.onCommentFocus() | ||
| 50 | 53 | ||
| 51 | this.publishCommentModel.rootCommentId = '-1'; | 54 | this.publishCommentModel.rootCommentId = '-1'; |
| 52 | this.publishCommentModel.parentId = '-1'; | 55 | this.publishCommentModel.parentId = '-1'; |
| @@ -66,7 +69,6 @@ export struct CommentIconComponent { | @@ -66,7 +69,6 @@ export struct CommentIconComponent { | ||
| 66 | @ObjectLink publishCommentModel: publishCommentModel | 69 | @ObjectLink publishCommentModel: publishCommentModel |
| 67 | /*展示类型*/ | 70 | /*展示类型*/ |
| 68 | @State type: number = 1 | 71 | @State type: number = 1 |
| 69 | - | ||
| 70 | // aboutToAppear(): void { | 72 | // aboutToAppear(): void { |
| 71 | // setTimeout(() => { | 73 | // setTimeout(() => { |
| 72 | // this.publishCommentModel.totalCommentNumer = '444' | 74 | // this.publishCommentModel.totalCommentNumer = '444' |
| @@ -87,11 +89,18 @@ export struct CommentIconComponent { | @@ -87,11 +89,18 @@ export struct CommentIconComponent { | ||
| 87 | Stack({ alignContent: Alignment.TopEnd }) { | 89 | Stack({ alignContent: Alignment.TopEnd }) { |
| 88 | Image($r('app.media.comment_icon')).width(24).height(24) | 90 | Image($r('app.media.comment_icon')).width(24).height(24) |
| 89 | // Stack({alignContent:Alignment.Start}) { | 91 | // Stack({alignContent:Alignment.Start}) { |
| 90 | - if(Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0){ | 92 | + if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) { |
| 91 | RelativeContainer() { | 93 | RelativeContainer() { |
| 92 | Image($r('app.media.comment_icon_number_bg')) | 94 | Image($r('app.media.comment_icon_number_bg')) |
| 93 | .objectFit(ImageFit.Fill) | 95 | .objectFit(ImageFit.Fill) |
| 94 | - .resizable({ slice: { top: 1, left: 20, right: 1, bottom: 1 } }) | 96 | + .resizable({ |
| 97 | + slice: { | ||
| 98 | + top: 1, | ||
| 99 | + left: 20, | ||
| 100 | + right: 1, | ||
| 101 | + bottom: 1 | ||
| 102 | + } | ||
| 103 | + }) | ||
| 95 | .alignRules({ | 104 | .alignRules({ |
| 96 | top: { anchor: "Text", align: VerticalAlign.Top }, | 105 | top: { anchor: "Text", align: VerticalAlign.Top }, |
| 97 | left: { anchor: "Text", align: HorizontalAlign.Start }, | 106 | left: { anchor: "Text", align: HorizontalAlign.Start }, |
| @@ -113,7 +122,8 @@ export struct CommentIconComponent { | @@ -113,7 +122,8 @@ export struct CommentIconComponent { | ||
| 113 | })// .margin({left: 4,right:4 | 122 | })// .margin({left: 4,right:4 |
| 114 | // }) | 123 | // }) |
| 115 | /*动态计算文字宽度*/ | 124 | /*动态计算文字宽度*/ |
| 116 | - .width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + 12)// .backgroundColor(Color.Green) | 125 | + .width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + |
| 126 | + 12)// .backgroundColor(Color.Green) | ||
| 117 | .id("Text") | 127 | .id("Text") |
| 118 | // .offset({ | 128 | // .offset({ |
| 119 | // x: 3 | 129 | // x: 3 |
| @@ -45,6 +45,8 @@ const TAG = 'OperRowListView'; | @@ -45,6 +45,8 @@ const TAG = 'OperRowListView'; | ||
| 45 | export struct OperRowListView { | 45 | export struct OperRowListView { |
| 46 | private onBack: () => void = () => { | 46 | private onBack: () => void = () => { |
| 47 | } | 47 | } |
| 48 | + private onCommentFocus: () => void = () => { | ||
| 49 | + } | ||
| 48 | @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 | 50 | @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 |
| 49 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 | 51 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 |
| 50 | @ObjectLink publishCommentModel: publishCommentModel | 52 | @ObjectLink publishCommentModel: publishCommentModel |
| @@ -147,8 +149,10 @@ export struct OperRowListView { | @@ -147,8 +149,10 @@ export struct OperRowListView { | ||
| 147 | builderComment() { | 149 | builderComment() { |
| 148 | Column() { | 150 | Column() { |
| 149 | if (this.publishCommentModel?.targetId) { | 151 | if (this.publishCommentModel?.targetId) { |
| 150 | - CommentTabComponent({ publishCommentModel: this.publishCommentModel, | ||
| 151 | - contentDetail: this.contentDetailData | 152 | + CommentTabComponent({ |
| 153 | + publishCommentModel: this.publishCommentModel, | ||
| 154 | + contentDetail: this.contentDetailData, | ||
| 155 | + onCommentFocus: this.onCommentFocus | ||
| 152 | }) | 156 | }) |
| 153 | } | 157 | } |
| 154 | } | 158 | } |
| @@ -184,7 +188,8 @@ export struct OperRowListView { | @@ -184,7 +188,8 @@ export struct OperRowListView { | ||
| 184 | builderCollect() { | 188 | builderCollect() { |
| 185 | Column() { | 189 | Column() { |
| 186 | Stack({ alignContent: Alignment.TopEnd }) { | 190 | Stack({ alignContent: Alignment.TopEnd }) { |
| 187 | - Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check1') : $r('app.media.iv_live_comment_collect_un')) | 191 | + Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check1') : |
| 192 | + $r('app.media.iv_live_comment_collect_un')) | ||
| 188 | .width(24) | 193 | .width(24) |
| 189 | .height(24) | 194 | .height(24) |
| 190 | .interpolation(ImageInterpolation.High) | 195 | .interpolation(ImageInterpolation.High) |
| @@ -179,6 +179,12 @@ export interface postInteractAccentionOperateParams { | @@ -179,6 +179,12 @@ export interface postInteractAccentionOperateParams { | ||
| 179 | status: number; | 179 | status: number; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | +export interface OperateRespDTO { | ||
| 183 | + ruleName: string; | ||
| 184 | + rulePoint: number; | ||
| 185 | + showToast: boolean; | ||
| 186 | +} | ||
| 187 | + | ||
| 182 | export class ContentDetailRequest { | 188 | export class ContentDetailRequest { |
| 183 | static getContentDetailDataMock(context: Context): Promise<ResponseDTO<ContentDetailDTO[]>> { | 189 | static getContentDetailDataMock(context: Context): Promise<ResponseDTO<ContentDetailDTO[]>> { |
| 184 | Logger.info(TAG, `getContentDetailDataMock start`); | 190 | Logger.info(TAG, `getContentDetailDataMock start`); |
| @@ -216,7 +222,12 @@ export class ContentDetailRequest { | @@ -216,7 +222,12 @@ export class ContentDetailRequest { | ||
| 216 | */ | 222 | */ |
| 217 | static getRecCompInfo(params: getRecCompInfoParams): Promise<ResponseDTO<getRecCompInfoResult>> { | 223 | static getRecCompInfo(params: getRecCompInfoParams): Promise<ResponseDTO<getRecCompInfoResult>> { |
| 218 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.DISPLAY_REC_COMPINFO | 224 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.DISPLAY_REC_COMPINFO |
| 219 | - return WDHttp.request({ url, method: 'GET', params, headers: HttpRequest.buildHeaderWithGlobalHeader() }) | 225 | + return WDHttp.request({ |
| 226 | + url, | ||
| 227 | + method: 'GET', | ||
| 228 | + params, | ||
| 229 | + headers: HttpRequest.buildHeaderWithGlobalHeader() | ||
| 230 | + }) | ||
| 220 | } | 231 | } |
| 221 | 232 | ||
| 222 | /** | 233 | /** |
| @@ -296,7 +307,7 @@ export class ContentDetailRequest { | @@ -296,7 +307,7 @@ export class ContentDetailRequest { | ||
| 296 | *用户等级/积分-APP根据业务场景动态增减成长值(APP) | 307 | *用户等级/积分-APP根据业务场景动态增减成长值(APP) |
| 297 | * 操作类型:1阅读 2评论 3回复(积分任务同评论) 4分享 5点赞 6关注 7打开客户端 8上传头像 9打开推送开关 | 308 | * 操作类型:1阅读 2评论 3回复(积分任务同评论) 4分享 5点赞 6关注 7打开客户端 8上传头像 9打开推送开关 |
| 298 | */ | 309 | */ |
| 299 | - static postPointLevelOperate(params: postPointLevelOperateParams): Promise<ResponseDTO> { | 310 | + static postPointLevelOperate(params: postPointLevelOperateParams): Promise<ResponseDTO<OperateRespDTO>> { |
| 300 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.USERPOINT_OPERATE | 311 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.USERPOINT_OPERATE |
| 301 | return WDHttp.post(url, params) | 312 | return WDHttp.post(url, params) |
| 302 | } | 313 | } |
| @@ -344,7 +355,8 @@ export class ContentDetailRequest { | @@ -344,7 +355,8 @@ export class ContentDetailRequest { | ||
| 344 | success(resDTO); | 355 | success(resDTO); |
| 345 | }) | 356 | }) |
| 346 | .catch((err: Error) => { | 357 | .catch((err: Error) => { |
| 347 | - Logger.error(TAG, `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`); | 358 | + Logger.error(TAG, |
| 359 | + `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 348 | error(err); | 360 | error(err); |
| 349 | }) | 361 | }) |
| 350 | }) | 362 | }) |
| 1 | -import { Action, LiveDetailsBean } from 'wdBean/Index'; | 1 | +import { Action, ContentDetailDTO, LiveDetailsBean } from 'wdBean/Index'; |
| 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; | 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; |
| 3 | import router from '@ohos.router'; | 3 | import router from '@ohos.router'; |
| 4 | 4 | ||
| 5 | import { DetailPlayLivePage } from './DetailPlayLivePage'; | 5 | import { DetailPlayLivePage } from './DetailPlayLivePage'; |
| 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage'; | 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage'; |
| 7 | import { Logger } from 'wdKit/Index'; | 7 | import { Logger } from 'wdKit/Index'; |
| 8 | +import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; | ||
| 8 | 9 | ||
| 9 | const TAG = 'DetailPlayLiveCommon' | 10 | const TAG = 'DetailPlayLiveCommon' |
| 10 | 11 | ||
| @@ -21,8 +22,10 @@ export struct DetailPlayLiveCommon { | @@ -21,8 +22,10 @@ export struct DetailPlayLiveCommon { | ||
| 21 | @Provide pageShow: number = -1 | 22 | @Provide pageShow: number = -1 |
| 22 | @Provide pageHide: number = -1 | 23 | @Provide pageHide: number = -1 |
| 23 | @Provide pageBackPress: number = -1 | 24 | @Provide pageBackPress: number = -1 |
| 25 | + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 26 | + @Provide publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 24 | 27 | ||
| 25 | - aboutToAppear(): void { | 28 | + async aboutToAppear(): Promise<void> { |
| 26 | Logger.debug(TAG, 'aboutToAppear') | 29 | Logger.debug(TAG, 'aboutToAppear') |
| 27 | //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 | 30 | //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 |
| 28 | const par: Action = router.getParams() as Action; | 31 | const par: Action = router.getParams() as Action; |
| @@ -30,11 +33,13 @@ export struct DetailPlayLiveCommon { | @@ -30,11 +33,13 @@ export struct DetailPlayLiveCommon { | ||
| 30 | this.relId = params?.extra?.relId || ''; | 33 | this.relId = params?.extra?.relId || ''; |
| 31 | this.relType = params?.extra?.relType || ''; | 34 | this.relType = params?.extra?.relType || ''; |
| 32 | this.contentId = params?.contentID || ''; | 35 | this.contentId = params?.contentID || ''; |
| 36 | + await this.getContentDetail() | ||
| 33 | this.getLiveDetails() | 37 | this.getLiveDetails() |
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | build() { | 40 | build() { |
| 37 | Column() { | 41 | Column() { |
| 42 | + // 直播预约或横屏直播统一进横屏直播 | ||
| 38 | if (this.liveState === 'wait' || this.liveStyle === 0) { | 43 | if (this.liveState === 'wait' || this.liveStyle === 0) { |
| 39 | DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType }) | 44 | DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType }) |
| 40 | } else if (this.liveStyle === 1) { | 45 | } else if (this.liveStyle === 1) { |
| @@ -47,6 +52,32 @@ export struct DetailPlayLiveCommon { | @@ -47,6 +52,32 @@ export struct DetailPlayLiveCommon { | ||
| 47 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | 52 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) |
| 48 | } | 53 | } |
| 49 | 54 | ||
| 55 | + /** | ||
| 56 | + * 查询视频详情用于评论展示 | ||
| 57 | + */ | ||
| 58 | + async getContentDetail() { | ||
| 59 | + await this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 60 | + .then((data: Array<ContentDetailDTO>) => { | ||
| 61 | + console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) | ||
| 62 | + if (data) { | ||
| 63 | + this.contentDetailData = data[0]; | ||
| 64 | + // if (this.contentDetailData.openComment === 1) { | ||
| 65 | + console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment) | ||
| 66 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 67 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 68 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 69 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 70 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 71 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 72 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 73 | + // } | ||
| 74 | + } | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 获取直播信息,可区分横竖屏直播 | ||
| 80 | + */ | ||
| 50 | getLiveDetails() { | 81 | getLiveDetails() { |
| 51 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) | 82 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) |
| 52 | .then( | 83 | .then( |
| @@ -65,17 +96,17 @@ export struct DetailPlayLiveCommon { | @@ -65,17 +96,17 @@ export struct DetailPlayLiveCommon { | ||
| 65 | 96 | ||
| 66 | onPageShow() { | 97 | onPageShow() { |
| 67 | this.pageShow = Math.random() | 98 | this.pageShow = Math.random() |
| 68 | - Logger.debug(TAG, 'onPageShow') | 99 | + Logger.info(TAG, 'onPageShow') |
| 69 | } | 100 | } |
| 70 | 101 | ||
| 71 | onPageHide() { | 102 | onPageHide() { |
| 72 | this.pageHide = Math.random() | 103 | this.pageHide = Math.random() |
| 73 | - Logger.debug(TAG, 'onPageHide') | 104 | + Logger.info(TAG, 'onPageHide') |
| 74 | } | 105 | } |
| 75 | 106 | ||
| 76 | onBackPress(): boolean | void { | 107 | onBackPress(): boolean | void { |
| 77 | this.pageBackPress = Math.random() | 108 | this.pageBackPress = Math.random() |
| 78 | - Logger.debug(TAG, 'onBackPress') | 109 | + Logger.info(TAG, 'onBackPress') |
| 79 | return true | 110 | return true |
| 80 | } | 111 | } |
| 81 | } | 112 | } |
| @@ -27,13 +27,14 @@ export struct DetailPlayLivePage { | @@ -27,13 +27,14 @@ export struct DetailPlayLivePage { | ||
| 27 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean | 27 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean |
| 28 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean | 28 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean |
| 29 | @State tabs: string[] = [] | 29 | @State tabs: string[] = [] |
| 30 | + @State changeToTab: number = -1 | ||
| 30 | //监听屏幕横竖屏变化 | 31 | //监听屏幕横竖屏变化 |
| 31 | listener = mediaquery.matchMediaSync('(orientation: landscape)'); | 32 | listener = mediaquery.matchMediaSync('(orientation: landscape)'); |
| 32 | @Consume @Watch('onPageShowCus') pageShow: number | 33 | @Consume @Watch('onPageShowCus') pageShow: number |
| 33 | @Consume @Watch('onPageHideCus') pageHide: number | 34 | @Consume @Watch('onPageHideCus') pageHide: number |
| 34 | @Consume @Watch('onBackPressCus') pageBackPress: number | 35 | @Consume @Watch('onBackPressCus') pageBackPress: number |
| 35 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 36 | - @State publishCommentModel: publishCommentModel = new publishCommentModel() | 36 | + @Consume contentDetailData: ContentDetailDTO |
| 37 | + @Consume publishCommentModel: publishCommentModel | ||
| 37 | 38 | ||
| 38 | aboutToAppear(): void { | 39 | aboutToAppear(): void { |
| 39 | Logger.info(TAG, `wyj-aboutToAppear`) | 40 | Logger.info(TAG, `wyj-aboutToAppear`) |
| @@ -48,25 +49,30 @@ export struct DetailPlayLivePage { | @@ -48,25 +49,30 @@ export struct DetailPlayLivePage { | ||
| 48 | }) | 49 | }) |
| 49 | this.getLiveDetails() | 50 | this.getLiveDetails() |
| 50 | this.getLiveRoomData() | 51 | this.getLiveRoomData() |
| 51 | - this.getContentDetail() | 52 | + |
| 53 | + console.error(TAG, 'this.publishCommentModel', this.publishCommentModel.targetId) | ||
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | build() { | 56 | build() { |
| 55 | Column() { | 57 | Column() { |
| 56 | TopPlayComponent({ playerController: this.playerController }) | 58 | TopPlayComponent({ playerController: this.playerController }) |
| 57 | .layoutWeight(211) | 59 | .layoutWeight(211) |
| 58 | - TabComponent({ tabs: this.tabs }) | 60 | + TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab }) |
| 59 | .layoutWeight(503) | 61 | .layoutWeight(503) |
| 60 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 62 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 61 | 63 | ||
| 64 | + if (this.contentDetailData?.newsId) { | ||
| 62 | OperRowListView({ | 65 | OperRowListView({ |
| 63 | operationButtonList: ['comment', 'collect', 'share', 'like'], | 66 | operationButtonList: ['comment', 'collect', 'share', 'like'], |
| 64 | contentDetailData: this.contentDetailData, | 67 | contentDetailData: this.contentDetailData, |
| 65 | publishCommentModel: this.publishCommentModel, | 68 | publishCommentModel: this.publishCommentModel, |
| 69 | + onCommentFocus: () => { | ||
| 70 | + // 切换到大家聊 | ||
| 71 | + this.changeToTab = Math.random() | ||
| 72 | + } | ||
| 66 | }) | 73 | }) |
| 67 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 74 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 68 | - | ||
| 69 | - | 75 | + } |
| 70 | // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) | 76 | // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) |
| 71 | // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 77 | // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 72 | } | 78 | } |
| @@ -106,28 +112,6 @@ export struct DetailPlayLivePage { | @@ -106,28 +112,6 @@ export struct DetailPlayLivePage { | ||
| 106 | return true | 112 | return true |
| 107 | } | 113 | } |
| 108 | 114 | ||
| 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 | - | ||
| 131 | getLiveDetails() { | 115 | getLiveDetails() { |
| 132 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) | 116 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) |
| 133 | .then( | 117 | .then( |
| @@ -26,6 +26,8 @@ export struct DetailPlayVLivePage { | @@ -26,6 +26,8 @@ export struct DetailPlayVLivePage { | ||
| 26 | @Provide liveState: string = '' | 26 | @Provide liveState: string = '' |
| 27 | @Provide playUrl: string = '' | 27 | @Provide playUrl: string = '' |
| 28 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL //横竖屏,默认竖屏 | 28 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL //横竖屏,默认竖屏 |
| 29 | + @Consume @Watch('openFullScreen') pageShow: number | ||
| 30 | + @Consume @Watch('closeFullScreen') pageHide: number | ||
| 29 | @State relId: string = '' | 31 | @State relId: string = '' |
| 30 | @State contentId: string = '' | 32 | @State contentId: string = '' |
| 31 | @State relType: string = '' | 33 | @State relType: string = '' |
| @@ -34,9 +36,7 @@ export struct DetailPlayVLivePage { | @@ -34,9 +36,7 @@ export struct DetailPlayVLivePage { | ||
| 34 | 36 | ||
| 35 | aboutToAppear(): void { | 37 | aboutToAppear(): void { |
| 36 | console.log(TAG, 'aboutToAppear') | 38 | console.log(TAG, 'aboutToAppear') |
| 37 | - WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 38 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 39 | - | 39 | + this.openFullScreen() |
| 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 |
| 41 | let par: Action = router.getParams() as Action; | 41 | let par: Action = router.getParams() as Action; |
| 42 | let params = par?.params; | 42 | let params = par?.params; |
| @@ -48,6 +48,17 @@ export struct DetailPlayVLivePage { | @@ -48,6 +48,17 @@ export struct DetailPlayVLivePage { | ||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | aboutToDisappear(): void { | 50 | aboutToDisappear(): void { |
| 51 | + this.closeFullScreen() | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + openFullScreen() { | ||
| 55 | + console.log(TAG, 'openFullScreen') | ||
| 56 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 57 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + closeFullScreen() { | ||
| 61 | + console.log(TAG, 'closeFullScreen') | ||
| 51 | WindowModel.shared.setWindowLayoutFullScreen(false) | 62 | WindowModel.shared.setWindowLayoutFullScreen(false) |
| 52 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | 63 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) |
| 53 | } | 64 | } |
| @@ -25,32 +25,6 @@ export class LiveViewModel { | @@ -25,32 +25,6 @@ export class LiveViewModel { | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | 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 | - | ||
| 54 | //直播详情 | 28 | //直播详情 |
| 55 | getLiveDetails(contentId: string, relId: string, relType: string) { | 29 | getLiveDetails(contentId: string, relId: string, relType: string) { |
| 56 | return new Promise<Array<LiveDetailsBean>>((success, fail) => { | 30 | return new Promise<Array<LiveDetailsBean>>((success, fail) => { |
| @@ -4,6 +4,7 @@ import { TabLiveComponent } from './TabLiveComponent' | @@ -4,6 +4,7 @@ import { TabLiveComponent } from './TabLiveComponent' | ||
| 4 | 4 | ||
| 5 | @Component | 5 | @Component |
| 6 | export struct TabComponent { | 6 | export struct TabComponent { |
| 7 | + @Prop @Watch('changeToChart') changeToTab: number | ||
| 7 | @State fontColor: string = '#999999' | 8 | @State fontColor: string = '#999999' |
| 8 | @State selectedFontColor: string = '#222222' | 9 | @State selectedFontColor: string = '#222222' |
| 9 | @State currentIndex: number = 0 | 10 | @State currentIndex: number = 0 |
| @@ -14,6 +15,16 @@ export struct TabComponent { | @@ -14,6 +15,16 @@ export struct TabComponent { | ||
| 14 | 15 | ||
| 15 | } | 16 | } |
| 16 | 17 | ||
| 18 | + /** | ||
| 19 | + * 评论切换到大家聊 | ||
| 20 | + */ | ||
| 21 | + changeToChart() { | ||
| 22 | + const index = this.tabs.findIndex(item => item === '大家聊') | ||
| 23 | + if (index !== -1) { | ||
| 24 | + this.controller.changeIndex(index) | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + | ||
| 17 | build() { | 28 | build() { |
| 18 | Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { | 29 | Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { |
| 19 | ForEach(this.tabs, (item: string, index: number) => { | 30 | ForEach(this.tabs, (item: string, index: number) => { |
| @@ -22,15 +22,15 @@ export struct PlayerCommentComponent { | @@ -22,15 +22,15 @@ export struct PlayerCommentComponent { | ||
| 22 | @Consume displayDirection: DisplayDirection | 22 | @Consume displayDirection: DisplayDirection |
| 23 | @State private pageModel: PageModel = new PageModel() | 23 | @State private pageModel: PageModel = new PageModel() |
| 24 | @State liveChatList: Array<LiveRoomItemBean> = [] | 24 | @State liveChatList: Array<LiveRoomItemBean> = [] |
| 25 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 26 | - @State publishCommentModel: publishCommentModel = new publishCommentModel() | 25 | + @Consume contentDetailData: ContentDetailDTO |
| 26 | + @Consume publishCommentModel: publishCommentModel | ||
| 27 | @State contentId: string = '' | 27 | @State contentId: string = '' |
| 28 | @State relId: string = '' | 28 | @State relId: string = '' |
| 29 | @State relType: string = '' | 29 | @State relType: string = '' |
| 30 | scroller: Scroller = new Scroller() | 30 | scroller: Scroller = new Scroller() |
| 31 | 31 | ||
| 32 | - aboutToAppear(): void { | ||
| 33 | - this.getLiveChatList() | 32 | + async aboutToAppear(): Promise<void> { |
| 33 | + | ||
| 34 | const action: Action = router.getParams() as Action | 34 | const action: Action = router.getParams() as Action |
| 35 | if (action) { | 35 | if (action) { |
| 36 | this.contentId = action.params?.contentID || '' | 36 | this.contentId = action.params?.contentID || '' |
| @@ -38,8 +38,9 @@ export struct PlayerCommentComponent { | @@ -38,8 +38,9 @@ export struct PlayerCommentComponent { | ||
| 38 | this.relId = action.params.extra.relId || '' | 38 | this.relId = action.params.extra.relId || '' |
| 39 | this.relType = action.params.extra.relType || '' | 39 | this.relType = action.params.extra.relType || '' |
| 40 | } | 40 | } |
| 41 | - this.getContentDetail(this.contentId, this.relId, this.relType) | 41 | + |
| 42 | } | 42 | } |
| 43 | + this.getLiveChatList() | ||
| 43 | 44 | ||
| 44 | } | 45 | } |
| 45 | 46 | ||
| @@ -80,32 +81,6 @@ export struct PlayerCommentComponent { | @@ -80,32 +81,6 @@ export struct PlayerCommentComponent { | ||
| 80 | }) | 81 | }) |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | - async getContentDetail(contentId: string, relId: string, relType: string) { | ||
| 84 | - await ContentDetailRequest.getContentDetail({ | ||
| 85 | - contentId: contentId, | ||
| 86 | - relId: relId, | ||
| 87 | - relType: relType | ||
| 88 | - }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 89 | - console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | ||
| 90 | - if (resDTO.data) { | ||
| 91 | - | ||
| 92 | - this.contentDetailData = resDTO.data?.[0]; | ||
| 93 | - | ||
| 94 | - if (this.contentDetailData?.openComment) { | ||
| 95 | - this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 96 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 97 | - this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 98 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 99 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 100 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 101 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - } | ||
| 106 | - }) | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | build() { | 84 | build() { |
| 110 | Column() { | 85 | Column() { |
| 111 | List({ scroller: this.scroller }) { | 86 | List({ scroller: this.scroller }) { |
| 1 | +import { ContentDetailDTO } from 'wdBean/Index'; | ||
| 1 | import { WDPlayerController } from 'wdPlayer/Index'; | 2 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 2 | import { PlayerCommentComponent } from './PlayerCommentComponent'; | 3 | import { PlayerCommentComponent } from './PlayerCommentComponent'; |
| 3 | import { PlayerTitleComponent } from './PlayerTitleComponent'; | 4 | import { PlayerTitleComponent } from './PlayerTitleComponent'; |
| @@ -152,6 +152,11 @@ export struct PlayerRightView { | @@ -152,6 +152,11 @@ export struct PlayerRightView { | ||
| 152 | this.followStatus = '0' | 152 | this.followStatus = '0' |
| 153 | } else { | 153 | } else { |
| 154 | this.followStatus = '1' | 154 | this.followStatus = '1' |
| 155 | + ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => { | ||
| 156 | + if (res.data?.showToast) { | ||
| 157 | + ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); | ||
| 158 | + } | ||
| 159 | + }) | ||
| 155 | } | 160 | } |
| 156 | }) | 161 | }) |
| 157 | } | 162 | } |
-
Please register or login to post a comment