Showing
4 changed files
with
81 additions
and
14 deletions
| @@ -49,13 +49,16 @@ export struct OperRowListView { | @@ -49,13 +49,16 @@ export struct OperRowListView { | ||
| 49 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 49 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 50 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 50 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 51 | @State likeBean: Record<string, string> = {} | 51 | @State likeBean: Record<string, string> = {} |
| 52 | - @State audioUrl: string= '' | 52 | + @State audioUrl: string = '' |
| 53 | + @State bgColor: ResourceColor = Color.White | ||
| 53 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 54 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 54 | needLike: boolean = true | 55 | needLike: boolean = true |
| 55 | 56 | ||
| 56 | // async aboutToAppear() { | 57 | // async aboutToAppear() { |
| 57 | async onDetailUpdated() { | 58 | async onDetailUpdated() { |
| 58 | - if (!this.contentDetailData) return | 59 | + if (!this.contentDetailData) { |
| 60 | + return | ||
| 61 | + } | ||
| 59 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | 62 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 60 | if (user_id) { | 63 | if (user_id) { |
| 61 | this.getInteractDataStatus() | 64 | this.getInteractDataStatus() |
| @@ -123,7 +126,7 @@ export struct OperRowListView { | @@ -123,7 +126,7 @@ export struct OperRowListView { | ||
| 123 | .justifyContent(FlexAlign.Start) | 126 | .justifyContent(FlexAlign.Start) |
| 124 | } | 127 | } |
| 125 | .width('100%') | 128 | .width('100%') |
| 126 | - .backgroundColor(Color.White) | 129 | + .backgroundColor(this.bgColor) |
| 127 | .padding({ | 130 | .padding({ |
| 128 | top: 10, | 131 | top: 10, |
| 129 | // bottom: `${this.bottomSafeHeight}px` | 132 | // bottom: `${this.bottomSafeHeight}px` |
| @@ -173,7 +176,8 @@ export struct OperRowListView { | @@ -173,7 +176,8 @@ export struct OperRowListView { | ||
| 173 | builderCollect() { | 176 | builderCollect() { |
| 174 | Column() { | 177 | Column() { |
| 175 | Stack({ alignContent: Alignment.TopEnd }) { | 178 | Stack({ alignContent: Alignment.TopEnd }) { |
| 176 | - Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check') : $r('app.media.iv_live_comment_collect_un')) | 179 | + Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check') : |
| 180 | + $r('app.media.iv_live_comment_collect_un')) | ||
| 177 | .width(24) | 181 | .width(24) |
| 178 | .height(24) | 182 | .height(24) |
| 179 | .interpolation(ImageInterpolation.High) | 183 | .interpolation(ImageInterpolation.High) |
| @@ -273,7 +277,7 @@ export struct OperRowListView { | @@ -273,7 +277,7 @@ export struct OperRowListView { | ||
| 273 | PageRepository.postExecuteCollectRecord(params).then(res => { | 277 | PageRepository.postExecuteCollectRecord(params).then(res => { |
| 274 | if (this.newsStatusOfUser) { | 278 | if (this.newsStatusOfUser) { |
| 275 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | 279 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 |
| 276 | - if(this.newsStatusOfUser.collectStatus === 1){ | 280 | + if (this.newsStatusOfUser.collectStatus === 1) { |
| 277 | promptAction.showToast({ message: '收藏成功' }) | 281 | promptAction.showToast({ message: '收藏成功' }) |
| 278 | } | 282 | } |
| 279 | this.queryContentInteractCount() | 283 | this.queryContentInteractCount() |
| @@ -299,7 +303,8 @@ export struct OperRowListView { | @@ -299,7 +303,8 @@ export struct OperRowListView { | ||
| 299 | this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum) | 303 | this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum) |
| 300 | this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum) | 304 | this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum) |
| 301 | // 评论组件需要数据 | 305 | // 评论组件需要数据 |
| 302 | - if (Number.parseInt(this.interactData.commentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | 306 | + if (Number.parseInt(this.interactData.commentNum) > |
| 307 | + Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | ||
| 303 | this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0' | 308 | this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0' |
| 304 | } | 309 | } |
| 305 | } | 310 | } |
| 1 | -import { LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index' | 1 | +import { Action, ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index' |
| 2 | import { LiveCommentComponent } from 'wdComponent/Index' | 2 | import { LiveCommentComponent } from 'wdComponent/Index' |
| 3 | +import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | ||
| 4 | +import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView' | ||
| 3 | import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | 5 | import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' |
| 4 | import { DisplayDirection, ViewType } from 'wdConstant/Index' | 6 | import { DisplayDirection, ViewType } from 'wdConstant/Index' |
| 7 | +import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | ||
| 8 | +import { ResponseDTO } from 'wdNetwork/Index' | ||
| 5 | import { LiveViewModel } from '../../viewModel/LiveViewModel' | 9 | import { LiveViewModel } from '../../viewModel/LiveViewModel' |
| 6 | import { ChartItemCompereComponent } from './ChartItemCompereComponent' | 10 | import { ChartItemCompereComponent } from './ChartItemCompereComponent' |
| 7 | import { ChatItemComponent } from './ChartItemComponent' | 11 | import { ChatItemComponent } from './ChartItemComponent' |
| 12 | +import { router } from '@kit.ArkUI' | ||
| 8 | 13 | ||
| 14 | +const TAG = "PlayerCommentComponent" | ||
| 9 | 15 | ||
| 10 | @Component | 16 | @Component |
| 11 | export struct PlayerCommentComponent { | 17 | export struct PlayerCommentComponent { |
| @@ -15,10 +21,25 @@ export struct PlayerCommentComponent { | @@ -15,10 +21,25 @@ export struct PlayerCommentComponent { | ||
| 15 | @Consume displayDirection: DisplayDirection | 21 | @Consume displayDirection: DisplayDirection |
| 16 | @State private pageModel: PageModel = new PageModel() | 22 | @State private pageModel: PageModel = new PageModel() |
| 17 | @State liveChatList: Array<LiveRoomItemBean> = [] | 23 | @State liveChatList: Array<LiveRoomItemBean> = [] |
| 24 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 25 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 26 | + @State contentId: string = '' | ||
| 27 | + @State relId: string = '' | ||
| 28 | + @State relType: string = '' | ||
| 18 | scroller: Scroller = new Scroller() | 29 | scroller: Scroller = new Scroller() |
| 19 | 30 | ||
| 20 | aboutToAppear(): void { | 31 | aboutToAppear(): void { |
| 21 | this.getLiveChatList() | 32 | this.getLiveChatList() |
| 33 | + const action: Action = router.getParams() as Action | ||
| 34 | + if (action) { | ||
| 35 | + this.contentId = action.params?.contentID || '' | ||
| 36 | + if (action.params && action.params.extra) { | ||
| 37 | + this.relId = action.params.extra.relId || '' | ||
| 38 | + this.relType = action.params.extra.relType || '' | ||
| 39 | + } | ||
| 40 | + this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 41 | + } | ||
| 42 | + | ||
| 22 | } | 43 | } |
| 23 | 44 | ||
| 24 | liveDetailsBeanChange() { | 45 | liveDetailsBeanChange() { |
| @@ -58,6 +79,32 @@ export struct PlayerCommentComponent { | @@ -58,6 +79,32 @@ export struct PlayerCommentComponent { | ||
| 58 | }) | 79 | }) |
| 59 | } | 80 | } |
| 60 | 81 | ||
| 82 | + async getContentDetail(contentId: string, relId: string, relType: string) { | ||
| 83 | + await ContentDetailRequest.getContentDetail({ | ||
| 84 | + contentId: contentId, | ||
| 85 | + relId: relId, | ||
| 86 | + relType: relType | ||
| 87 | + }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 88 | + console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | ||
| 89 | + if (resDTO.data) { | ||
| 90 | + | ||
| 91 | + this.contentDetailData = resDTO.data?.[0]; | ||
| 92 | + | ||
| 93 | + if (this.contentDetailData?.openComment) { | ||
| 94 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 95 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 96 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 97 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 98 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 99 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 100 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + } | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + | ||
| 61 | build() { | 108 | build() { |
| 62 | Column() { | 109 | Column() { |
| 63 | List({ scroller: this.scroller }) { | 110 | List({ scroller: this.scroller }) { |
| @@ -76,9 +123,17 @@ export struct PlayerCommentComponent { | @@ -76,9 +123,17 @@ export struct PlayerCommentComponent { | ||
| 76 | .scrollBar(BarState.Off) | 123 | .scrollBar(BarState.Off) |
| 77 | .margin({ bottom: 20 }) | 124 | .margin({ bottom: 20 }) |
| 78 | 125 | ||
| 79 | - LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) | 126 | + OperRowListView({ |
| 127 | + bgColor: Color.Transparent, | ||
| 128 | + operationButtonList: ['comment', 'collect', 'share', 'like'], | ||
| 129 | + contentDetailData: this.contentDetailData, | ||
| 130 | + publishCommentModel: this.publishCommentModel, | ||
| 131 | + }) | ||
| 80 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 132 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 81 | - .backgroundColor(Color.Black) | 133 | + |
| 134 | + // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) | ||
| 135 | + // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | ||
| 136 | + // .backgroundColor(Color.Black) | ||
| 82 | }.alignItems(HorizontalAlign.Start) | 137 | }.alignItems(HorizontalAlign.Start) |
| 83 | 138 | ||
| 84 | } | 139 | } |
| @@ -10,6 +10,8 @@ export struct PlayerComponent { | @@ -10,6 +10,8 @@ export struct PlayerComponent { | ||
| 10 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | 10 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean |
| 11 | @Consume @Watch('pageShowChange') pageShow: number | 11 | @Consume @Watch('pageShowChange') pageShow: number |
| 12 | @Consume @Watch('pageHideChange') pageHide: number | 12 | @Consume @Watch('pageHideChange') pageHide: number |
| 13 | + @Consume isShowControl: boolean | ||
| 14 | + @Consume liveState: string | ||
| 13 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 15 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 14 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 16 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 15 | @State imgUrl: string = '' | 17 | @State imgUrl: string = '' |
| @@ -92,6 +94,11 @@ export struct PlayerComponent { | @@ -92,6 +94,11 @@ export struct PlayerComponent { | ||
| 92 | .width('100%') | 94 | .width('100%') |
| 93 | .align(Alignment.Top) | 95 | .align(Alignment.Top) |
| 94 | .alignContent(Alignment.Top) | 96 | .alignContent(Alignment.Top) |
| 97 | + .onClick(() => { | ||
| 98 | + if (this.liveState === 'end') { | ||
| 99 | + this.isShowControl = !this.isShowControl | ||
| 100 | + } | ||
| 101 | + }) | ||
| 95 | } | 102 | } |
| 96 | .height('100%') | 103 | .height('100%') |
| 97 | .width('100%') | 104 | .width('100%') |
| @@ -26,11 +26,11 @@ export struct PlayerInfoComponent { | @@ -26,11 +26,11 @@ export struct PlayerInfoComponent { | ||
| 26 | .width('100%') | 26 | .width('100%') |
| 27 | .height('100%') | 27 | .height('100%') |
| 28 | .index(this.swiperIndex) | 28 | .index(this.swiperIndex) |
| 29 | - .onClick(() => { | ||
| 30 | - if (this.liveState === 'end') { | ||
| 31 | - this.isShowControl = !this.isShowControl | ||
| 32 | - } | ||
| 33 | - }) | 29 | + // .onClick(() => { |
| 30 | + // if (this.liveState === 'end') { | ||
| 31 | + // this.isShowControl = !this.isShowControl | ||
| 32 | + // } | ||
| 33 | + // }) | ||
| 34 | .onChange((index) => { | 34 | .onChange((index) => { |
| 35 | this.swiperIndex = index | 35 | this.swiperIndex = index |
| 36 | }) | 36 | }) |
-
Please register or login to post a comment