Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: feat: 1)处理直播预告视频播放;2)处理视频资源播放完毕状态,支持重新播放 feat: 埋点 fix:somebug fix:somebug ref |> 解决评论重复问题 ref |> 解决评论列表用户昵称太长问题和人民号icon显示判断 ref |> 解决评论列表翻页新问题 ref |> 解决发布评论后,评论数量没加1的问题 desc:减少缓存大小
Showing
32 changed files
with
310 additions
and
164 deletions
| @@ -11,7 +11,7 @@ import { UserInfoDTO } from './UserInfoDTO' | @@ -11,7 +11,7 @@ import { UserInfoDTO } from './UserInfoDTO' | ||
| 11 | * 接口定义: | 11 | * 接口定义: |
| 12 | * http://192.168.1.3:3300/project/3802/interface/api/200915 | 12 | * http://192.168.1.3:3300/project/3802/interface/api/200915 |
| 13 | */ | 13 | */ |
| 14 | -export interface ContentDetailDTO { | 14 | +export class ContentDetailDTO { |
| 15 | newsId: number; | 15 | newsId: number; |
| 16 | newsTitle: string; | 16 | newsTitle: string; |
| 17 | newsShortTitle: string; | 17 | newsShortTitle: string; |
| @@ -72,4 +72,8 @@ export interface ContentDetailDTO { | @@ -72,4 +72,8 @@ export interface ContentDetailDTO { | ||
| 72 | isNewspaper: boolean; | 72 | isNewspaper: boolean; |
| 73 | oldNewsId: string; | 73 | oldNewsId: string; |
| 74 | serials: any; | 74 | serials: any; |
| 75 | + | ||
| 76 | + | ||
| 77 | + // 本地字段 | ||
| 78 | + showTime:boolean = false; | ||
| 75 | } | 79 | } |
| @@ -32,12 +32,6 @@ export struct CardParser { | @@ -32,12 +32,6 @@ export struct CardParser { | ||
| 32 | pageShowTime:number = 0; | 32 | pageShowTime:number = 0; |
| 33 | pageHideTime:number = 0; | 33 | pageHideTime:number = 0; |
| 34 | 34 | ||
| 35 | - aboutToAppear(): void { | ||
| 36 | - | ||
| 37 | - console.log('CardParser-contentDTO', JSON.stringify(this.contentDTO)) | ||
| 38 | - console.log('CardParser-compDTO', JSON.stringify(this.compDTO)) | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | onPageShow() { | 35 | onPageShow() { |
| 42 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 36 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 43 | } | 37 | } |
| @@ -42,6 +42,9 @@ export struct CompParser { | @@ -42,6 +42,9 @@ export struct CompParser { | ||
| 42 | @State noneAudioItems: ContentDTO[] = []; | 42 | @State noneAudioItems: ContentDTO[] = []; |
| 43 | 43 | ||
| 44 | aboutToAppear(): void { | 44 | aboutToAppear(): void { |
| 45 | + | ||
| 46 | + | ||
| 47 | + console.log('CompParser-compDTO', JSON.stringify(this.compDTO)) | ||
| 45 | // 轮播图屏蔽音频类型稿件 | 48 | // 轮播图屏蔽音频类型稿件 |
| 46 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 49 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 47 | this.audioItems = this.compDTO.operDataList.filter(item => { | 50 | this.audioItems = this.compDTO.operDataList.filter(item => { |
| @@ -5,7 +5,7 @@ import { | @@ -5,7 +5,7 @@ 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 { RmhInfoDTO } from 'wdBean' | 8 | +import { RmhInfoDTO, CompDTO, ContentDTO } from 'wdBean' |
| 9 | import { CommonConstants } from 'wdConstant/Index'; | 9 | import { CommonConstants } from 'wdConstant/Index'; |
| 10 | import { DateTimeUtils, SPHelper, Logger, ToastUtils } from 'wdKit'; | 10 | import { DateTimeUtils, SPHelper, Logger, ToastUtils } from 'wdKit'; |
| 11 | import { SpConstants } from 'wdConstant/Index' | 11 | import { SpConstants } from 'wdConstant/Index' |
| @@ -14,9 +14,14 @@ import router from '@ohos.router' | @@ -14,9 +14,14 @@ import router from '@ohos.router' | ||
| 14 | import { postBatchAttentionStatusParams } from 'wdBean/Index'; | 14 | import { postBatchAttentionStatusParams } from 'wdBean/Index'; |
| 15 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel' | 15 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel' |
| 16 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 16 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 17 | +import { InfomationCardClick } from '../../utils/infomationCardClick' | ||
| 17 | 18 | ||
| 18 | @Component | 19 | @Component |
| 19 | export struct RmhTitle { | 20 | export struct RmhTitle { |
| 21 | + @State compDTO: CompDTO = new CompDTO() | ||
| 22 | + @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 23 | + @State pageId: string = ''; | ||
| 24 | + @State pageName: string = ''; | ||
| 20 | @Prop rmhInfo: RmhInfoDTO | 25 | @Prop rmhInfo: RmhInfoDTO |
| 21 | @Prop publishTime: string | undefined | 26 | @Prop publishTime: string | undefined |
| 22 | @State loadImg: boolean = false; | 27 | @State loadImg: boolean = false; |
| @@ -48,6 +53,16 @@ export struct RmhTitle { | @@ -48,6 +53,16 @@ export struct RmhTitle { | ||
| 48 | } | 53 | } |
| 49 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | 54 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { |
| 50 | console.log('rmhTitle-data', JSON.stringify(res.data)) | 55 | console.log('rmhTitle-data', JSON.stringify(res.data)) |
| 56 | + | ||
| 57 | + InfomationCardClick.track( | ||
| 58 | + this.compDTO, | ||
| 59 | + this.contentDTO, | ||
| 60 | + this.pageId, | ||
| 61 | + this.pageName, | ||
| 62 | + 'follow', // like, commentClick, follow | ||
| 63 | + this.followStatus == '0' ? true : false, | ||
| 64 | + ) | ||
| 65 | + | ||
| 51 | if (this.followStatus == '1') { | 66 | if (this.followStatus == '1') { |
| 52 | this.followStatus = '0' | 67 | this.followStatus = '0' |
| 53 | } else { | 68 | } else { |
| @@ -38,7 +38,16 @@ export struct Card12Component { | @@ -38,7 +38,16 @@ export struct Card12Component { | ||
| 38 | Column() { | 38 | Column() { |
| 39 | // rmh信息 | 39 | // rmh信息 |
| 40 | if (this.contentDTO.rmhInfo) { | 40 | if (this.contentDTO.rmhInfo) { |
| 41 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | 41 | + RmhTitle( |
| 42 | + { | ||
| 43 | + rmhInfo: this.contentDTO.rmhInfo, | ||
| 44 | + publishTime: this.contentDTO.publishTime, | ||
| 45 | + contentDTO: this.contentDTO, | ||
| 46 | + compDTO: this.compDTO, | ||
| 47 | + pageId: this.pageId, | ||
| 48 | + pageName: this.pageName | ||
| 49 | + } | ||
| 50 | + ) | ||
| 42 | } | 51 | } |
| 43 | // 标题 | 52 | // 标题 |
| 44 | if (this.contentDTO.newsTitle) { | 53 | if (this.contentDTO.newsTitle) { |
| @@ -41,7 +41,16 @@ export struct Card14Component { | @@ -41,7 +41,16 @@ export struct Card14Component { | ||
| 41 | Column() { | 41 | Column() { |
| 42 | // rmh信息 | 42 | // rmh信息 |
| 43 | if (this.contentDTO.rmhInfo) { | 43 | if (this.contentDTO.rmhInfo) { |
| 44 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | 44 | + RmhTitle( |
| 45 | + { | ||
| 46 | + rmhInfo: this.contentDTO.rmhInfo, | ||
| 47 | + publishTime: this.contentDTO.publishTime, | ||
| 48 | + contentDTO: this.contentDTO, | ||
| 49 | + compDTO: this.compDTO, | ||
| 50 | + pageId: this.pageId, | ||
| 51 | + pageName: this.pageName | ||
| 52 | + } | ||
| 53 | + ) | ||
| 45 | } | 54 | } |
| 46 | // 左标题,右图 | 55 | // 左标题,右图 |
| 47 | Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { | 56 | Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { |
| @@ -44,8 +44,16 @@ export struct Card15Component { | @@ -44,8 +44,16 @@ export struct Card15Component { | ||
| 44 | build() { | 44 | build() { |
| 45 | Column() { | 45 | Column() { |
| 46 | // rmh信息 | 46 | // rmh信息 |
| 47 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | ||
| 48 | - //新闻标题 | 47 | + RmhTitle( |
| 48 | + { | ||
| 49 | + rmhInfo: this.contentDTO.rmhInfo, | ||
| 50 | + publishTime: this.contentDTO.publishTime, | ||
| 51 | + contentDTO: this.contentDTO, | ||
| 52 | + compDTO: this.compDTO, | ||
| 53 | + pageId: this.pageId, | ||
| 54 | + pageName: this.pageName | ||
| 55 | + } | ||
| 56 | + ) //新闻标题 | ||
| 49 | if (this.contentDTO.newsTitle) { | 57 | if (this.contentDTO.newsTitle) { |
| 50 | Text() { | 58 | Text() { |
| 51 | if (this.titleMarked) { | 59 | if (this.titleMarked) { |
| @@ -46,7 +46,16 @@ export struct Card16Component { | @@ -46,7 +46,16 @@ export struct Card16Component { | ||
| 46 | Column() { | 46 | Column() { |
| 47 | // rmh信息 | 47 | // rmh信息 |
| 48 | if (this.contentDTO.rmhInfo) { | 48 | if (this.contentDTO.rmhInfo) { |
| 49 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | 49 | + RmhTitle( |
| 50 | + { | ||
| 51 | + rmhInfo: this.contentDTO.rmhInfo, | ||
| 52 | + publishTime: this.contentDTO.publishTime, | ||
| 53 | + contentDTO: this.contentDTO, | ||
| 54 | + compDTO: this.compDTO, | ||
| 55 | + pageId: this.pageId, | ||
| 56 | + pageName: this.pageName | ||
| 57 | + } | ||
| 58 | + ) | ||
| 50 | } | 59 | } |
| 51 | // 标题 | 60 | // 标题 |
| 52 | if (this.contentDTO.newsTitle) { | 61 | if (this.contentDTO.newsTitle) { |
| @@ -38,8 +38,16 @@ export struct Card19Component { | @@ -38,8 +38,16 @@ export struct Card19Component { | ||
| 38 | build() { | 38 | build() { |
| 39 | Column() { | 39 | Column() { |
| 40 | // rmh信息 | 40 | // rmh信息 |
| 41 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | ||
| 42 | - // 标题 | 41 | + RmhTitle( |
| 42 | + { | ||
| 43 | + rmhInfo: this.contentDTO.rmhInfo, | ||
| 44 | + publishTime: this.contentDTO.publishTime, | ||
| 45 | + contentDTO: this.contentDTO, | ||
| 46 | + compDTO: this.compDTO, | ||
| 47 | + pageId: this.pageId, | ||
| 48 | + pageName: this.pageName | ||
| 49 | + } | ||
| 50 | + ) // 标题 | ||
| 43 | if (this.contentDTO.newsTitle) { | 51 | if (this.contentDTO.newsTitle) { |
| 44 | Text() { | 52 | Text() { |
| 45 | if (this.titleMarked) { | 53 | if (this.titleMarked) { |
| @@ -38,8 +38,16 @@ export struct Card20Component { | @@ -38,8 +38,16 @@ export struct Card20Component { | ||
| 38 | build() { | 38 | build() { |
| 39 | Column() { | 39 | Column() { |
| 40 | // rmh信息 | 40 | // rmh信息 |
| 41 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | ||
| 42 | - // 标题 | 41 | + RmhTitle( |
| 42 | + { | ||
| 43 | + rmhInfo: this.contentDTO.rmhInfo, | ||
| 44 | + publishTime: this.contentDTO.publishTime, | ||
| 45 | + contentDTO: this.contentDTO, | ||
| 46 | + compDTO: this.compDTO, | ||
| 47 | + pageId: this.pageId, | ||
| 48 | + pageName: this.pageName | ||
| 49 | + } | ||
| 50 | + ) // 标题 | ||
| 43 | if (this.contentDTO.newsTitle) { | 51 | if (this.contentDTO.newsTitle) { |
| 44 | Text() { | 52 | Text() { |
| 45 | 53 |
| @@ -40,8 +40,16 @@ export struct Card21Component { | @@ -40,8 +40,16 @@ export struct Card21Component { | ||
| 40 | build() { | 40 | build() { |
| 41 | Column() { | 41 | Column() { |
| 42 | // 顶部 rmh信息 | 42 | // 顶部 rmh信息 |
| 43 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | ||
| 44 | - // 中间内容 | 43 | + RmhTitle( |
| 44 | + { | ||
| 45 | + rmhInfo: this.contentDTO.rmhInfo, | ||
| 46 | + publishTime: this.contentDTO.publishTime, | ||
| 47 | + contentDTO: this.contentDTO, | ||
| 48 | + compDTO: this.compDTO, | ||
| 49 | + pageId: this.pageId, | ||
| 50 | + pageName: this.pageName | ||
| 51 | + } | ||
| 52 | + ) // 中间内容 | ||
| 45 | Grid() { | 53 | Grid() { |
| 46 | GridItem() { | 54 | GridItem() { |
| 47 | Text() { | 55 | Text() { |
| @@ -44,10 +44,25 @@ export struct Card5Component { | @@ -44,10 +44,25 @@ export struct Card5Component { | ||
| 44 | Image(this.loadImg ? this.contentDTO.coverUrl : '') | 44 | Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 45 | .backgroundColor(0xf5f5f5) | 45 | .backgroundColor(0xf5f5f5) |
| 46 | .width(CommonConstants.FULL_WIDTH) | 46 | .width(CommonConstants.FULL_WIDTH) |
| 47 | - .borderRadius($r('app.float.image_border_radius')) | 47 | + .borderRadius( |
| 48 | + { | ||
| 49 | + topLeft: $r('app.float.image_border_radius'), | ||
| 50 | + topRight: $r('app.float.image_border_radius'), | ||
| 51 | + bottomLeft: $r('app.float.image_border_radius'), | ||
| 52 | + bottomRight: $r('app.float.image_border_radius') | ||
| 53 | + } | ||
| 54 | + ) | ||
| 48 | .aspectRatio(343 / 225) | 55 | .aspectRatio(343 / 225) |
| 49 | if (this.titleShowPolicy === 1 || this.titleShowPolicy === null || this.titleShowPolicy === '') { | 56 | if (this.titleShowPolicy === 1 || this.titleShowPolicy === null || this.titleShowPolicy === '') { |
| 50 | Row() | 57 | Row() |
| 58 | + .borderRadius( | ||
| 59 | + { | ||
| 60 | + topLeft: $r('app.float.image_border_radius'), | ||
| 61 | + topRight: $r('app.float.image_border_radius'), | ||
| 62 | + bottomLeft: $r('app.float.image_border_radius'), | ||
| 63 | + bottomRight: $r('app.float.image_border_radius') | ||
| 64 | + } | ||
| 65 | + ) | ||
| 51 | .width(CommonConstants.FULL_WIDTH) | 66 | .width(CommonConstants.FULL_WIDTH) |
| 52 | .height(59) | 67 | .height(59) |
| 53 | .linearGradient({ | 68 | .linearGradient({ |
| @@ -55,6 +70,7 @@ export struct Card5Component { | @@ -55,6 +70,7 @@ export struct Card5Component { | ||
| 55 | ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0] | 70 | ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0] |
| 56 | ] | 71 | ] |
| 57 | }) | 72 | }) |
| 73 | + | ||
| 58 | Row() { | 74 | Row() { |
| 59 | Stack() { | 75 | Stack() { |
| 60 | if(this.contentDTO.objectType == '5'){ | 76 | if(this.contentDTO.objectType == '5'){ |
| @@ -69,7 +85,7 @@ export struct Card5Component { | @@ -69,7 +85,7 @@ export struct Card5Component { | ||
| 69 | } | 85 | } |
| 70 | 86 | ||
| 71 | Text() { | 87 | Text() { |
| 72 | - if (this.titleMarked) { | 88 | + if (this.titleMarked) { |
| 73 | ForEach(this.textArr, (textItem: textItem) => { | 89 | ForEach(this.textArr, (textItem: textItem) => { |
| 74 | if (textItem.isRed) { | 90 | if (textItem.isRed) { |
| 75 | Span(textItem.content) | 91 | Span(textItem.content) |
| @@ -256,12 +256,14 @@ export struct CommentComponent { | @@ -256,12 +256,14 @@ export struct CommentComponent { | ||
| 256 | 256 | ||
| 257 | //获取数据 | 257 | //获取数据 |
| 258 | async getData() { | 258 | async getData() { |
| 259 | - commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, | 259 | + let pageIndex = this.currentPage |
| 260 | + commentViewModel.fetchContentCommentList(pageIndex + '', this.publishCommentModel.targetId, | ||
| 260 | this.publishCommentModel.targetType) | 261 | this.publishCommentModel.targetType) |
| 261 | .then(commentListModel => { | 262 | .then(commentListModel => { |
| 262 | console.log('评论:', JSON.stringify(commentListModel.list)) | 263 | console.log('评论:', JSON.stringify(commentListModel.list)) |
| 263 | - this.currentPage++ | ||
| 264 | 264 | ||
| 265 | + // 这里需要先赋值,否则下次UI刷新可能重复进入第1页两次 | ||
| 266 | + this.currentPage = pageIndex + 1 | ||
| 265 | if (Number.parseInt(commentListModel.totalCommentNum) > | 267 | if (Number.parseInt(commentListModel.totalCommentNum) > |
| 266 | Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | 268 | Number.parseInt(this.publishCommentModel.totalCommentNumer)) { |
| 267 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' | 269 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' |
| @@ -279,7 +281,9 @@ export struct CommentComponent { | @@ -279,7 +281,9 @@ export struct CommentComponent { | ||
| 279 | 281 | ||
| 280 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | 282 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { |
| 281 | 283 | ||
| 282 | - this.allDatas.clearAllData() // 防止数据重复问题 | 284 | + if (pageIndex == 1) { |
| 285 | + this.allDatas.clearAllData() // 防止数据重复问题 | ||
| 286 | + } | ||
| 283 | commentListModel.list.forEach(element => { | 287 | commentListModel.list.forEach(element => { |
| 284 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false | 288 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false |
| 285 | let newModel = commentViewModel.deepCopyCommentItemModel(element) | 289 | let newModel = commentViewModel.deepCopyCommentItemModel(element) |
| @@ -289,7 +293,6 @@ export struct CommentComponent { | @@ -289,7 +293,6 @@ export struct CommentComponent { | ||
| 289 | this.allDatas.push(newModel) | 293 | this.allDatas.push(newModel) |
| 290 | }); | 294 | }); |
| 291 | 295 | ||
| 292 | - | ||
| 293 | } else { | 296 | } else { |
| 294 | this.hasMore = false | 297 | this.hasMore = false |
| 295 | } | 298 | } |
| @@ -327,7 +330,7 @@ struct ChildCommentItem { | @@ -327,7 +330,7 @@ struct ChildCommentItem { | ||
| 327 | } | 330 | } |
| 328 | } | 331 | } |
| 329 | .maxLines(1) | 332 | .maxLines(1) |
| 330 | - .layoutWeight(1) | 333 | + .flexShrink(1) |
| 331 | .fontSize(14) | 334 | .fontSize(14) |
| 332 | .fontColor($r('app.color.color_222222')) | 335 | .fontColor($r('app.color.color_222222')) |
| 333 | .fontWeight(FontWeight.Medium) | 336 | .fontWeight(FontWeight.Medium) |
| @@ -338,7 +341,7 @@ struct ChildCommentItem { | @@ -338,7 +341,7 @@ struct ChildCommentItem { | ||
| 338 | /// 人民号>置顶>作者 | 341 | /// 人民号>置顶>作者 |
| 339 | 342 | ||
| 340 | //人民号 | 343 | //人民号 |
| 341 | - if (this.item.fromUserType !== 1) { | 344 | + if (this.item.fromUserType == 2) { |
| 342 | Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 }); | 345 | Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 }); |
| 343 | } | 346 | } |
| 344 | //置顶 | 347 | //置顶 |
| @@ -541,6 +544,8 @@ struct commentHeaderView { | @@ -541,6 +544,8 @@ struct commentHeaderView { | ||
| 541 | //昵称 | 544 | //昵称 |
| 542 | Text(this.item.fromUserName) | 545 | Text(this.item.fromUserName) |
| 543 | .fontSize(14) | 546 | .fontSize(14) |
| 547 | + .maxLines(1) | ||
| 548 | + .flexShrink(1) | ||
| 544 | .fontColor($r('app.color.color_222222')) | 549 | .fontColor($r('app.color.color_222222')) |
| 545 | .fontWeight(FontWeight.Medium) | 550 | .fontWeight(FontWeight.Medium) |
| 546 | .margin({ left: 5 }) | 551 | .margin({ left: 5 }) |
| @@ -550,7 +555,7 @@ struct commentHeaderView { | @@ -550,7 +555,7 @@ struct commentHeaderView { | ||
| 550 | /// 人民号>置顶>作者 | 555 | /// 人民号>置顶>作者 |
| 551 | 556 | ||
| 552 | //人民号 | 557 | //人民号 |
| 553 | - if (this.item.fromUserType !== 1) { | 558 | + if (this.item.fromUserType == 2) { |
| 554 | Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 }); | 559 | Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 }); |
| 555 | } | 560 | } |
| 556 | //置顶 | 561 | //置顶 |
| @@ -11,6 +11,7 @@ export struct CommentListDialogView { | @@ -11,6 +11,7 @@ export struct CommentListDialogView { | ||
| 11 | @Link @Watch('showCommentListChange') showCommentList: boolean | 11 | @Link @Watch('showCommentListChange') showCommentList: boolean |
| 12 | @Link contentDetailData: ContentDetailDTO // 详情页传 | 12 | @Link contentDetailData: ContentDetailDTO // 详情页传 |
| 13 | @Link pageInfo: PageInfoDTO // 专题页传 | 13 | @Link pageInfo: PageInfoDTO // 专题页传 |
| 14 | + @Link publishCommentModel: publishCommentModel | ||
| 14 | onClose?: () => void | 15 | onClose?: () => void |
| 15 | 16 | ||
| 16 | // @Consume pageId: TrackConstants.PageName | 17 | // @Consume pageId: TrackConstants.PageName |
| @@ -19,6 +20,7 @@ export struct CommentListDialogView { | @@ -19,6 +20,7 @@ export struct CommentListDialogView { | ||
| 19 | private dialogController: CustomDialogController = new CustomDialogController({ | 20 | private dialogController: CustomDialogController = new CustomDialogController({ |
| 20 | builder: CommentListDialog({ | 21 | builder: CommentListDialog({ |
| 21 | contentDetailData: this.contentDetailData, | 22 | contentDetailData: this.contentDetailData, |
| 23 | + publishCommentModel:this.publishCommentModel, | ||
| 22 | pageInfo: this.pageInfo, | 24 | pageInfo: this.pageInfo, |
| 23 | onClose: this.onClose | 25 | onClose: this.onClose |
| 24 | }), | 26 | }), |
| @@ -47,7 +49,7 @@ export struct CommentListDialogView { | @@ -47,7 +49,7 @@ export struct CommentListDialogView { | ||
| 47 | struct CommentListDialog { | 49 | struct CommentListDialog { |
| 48 | 50 | ||
| 49 | /// 内部使用 | 51 | /// 内部使用 |
| 50 | - @State private publishCommentModel: publishCommentModel = new publishCommentModel() | 52 | + @Link publishCommentModel: publishCommentModel |
| 51 | @State private operationButtonList: string[] = [] | 53 | @State private operationButtonList: string[] = [] |
| 52 | controller?: CustomDialogController | 54 | controller?: CustomDialogController |
| 53 | @State windowWidth: number = AppStorage.get<number>('windowWidth') || 0 | 55 | @State windowWidth: number = AppStorage.get<number>('windowWidth') || 0 |
| @@ -224,7 +224,8 @@ struct CarouselLayout01CardView { | @@ -224,7 +224,8 @@ struct CarouselLayout01CardView { | ||
| 224 | // if (this.item.objectType == '5' || this.item.objectType == '6') { | 224 | // if (this.item.objectType == '5' || this.item.objectType == '6') { |
| 225 | // Notes({ objectType: this.item.objectType }) | 225 | // Notes({ objectType: this.item.objectType }) |
| 226 | // } | 226 | // } |
| 227 | - Text(`${this.item.corner}${this.item.newsTitle}`) | 227 | + //Text(`${this.item.corner}${this.item.newsTitle}`) |
| 228 | + Text(`${this.item.newsTitle}`) | ||
| 228 | .width(CommonConstants.FULL_PARENT) | 229 | .width(CommonConstants.FULL_PARENT) |
| 229 | .fontColor(Color.White) | 230 | .fontColor(Color.White) |
| 230 | .fontSize($r('app.float.font_size_18')) | 231 | .fontSize($r('app.float.font_size_18')) |
| @@ -102,7 +102,8 @@ export struct FollowListDetailUI { | @@ -102,7 +102,8 @@ export struct FollowListDetailUI { | ||
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | - .cachedCount(10) | 105 | + .edgeEffect(EdgeEffect.None) |
| 106 | + .cachedCount(5) | ||
| 106 | .padding({ left: '31lpx', right: '31lpx' }) | 107 | .padding({ left: '31lpx', right: '31lpx' }) |
| 107 | .layoutWeight(1) | 108 | .layoutWeight(1) |
| 108 | .scrollBar(BarState.Off) | 109 | .scrollBar(BarState.Off) |
| @@ -109,7 +109,7 @@ export struct HomePageBottomCommentComponent { | @@ -109,7 +109,7 @@ export struct HomePageBottomCommentComponent { | ||
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | - .cachedCount(15) | 112 | + .cachedCount(5) |
| 113 | .layoutWeight(1) | 113 | .layoutWeight(1) |
| 114 | .scrollBar(BarState.Off) | 114 | .scrollBar(BarState.Off) |
| 115 | .edgeEffect(EdgeEffect.None) | 115 | .edgeEffect(EdgeEffect.None) |
| @@ -177,7 +177,7 @@ export struct HomePageBottomFollowComponent { | @@ -177,7 +177,7 @@ export struct HomePageBottomFollowComponent { | ||
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| 179 | } | 179 | } |
| 180 | - .cachedCount(15) | 180 | + .cachedCount(5) |
| 181 | .padding({ left: '31lpx', right: '31lpx' }) | 181 | .padding({ left: '31lpx', right: '31lpx' }) |
| 182 | .layoutWeight(1) | 182 | .layoutWeight(1) |
| 183 | .scrollBar(BarState.Off) | 183 | .scrollBar(BarState.Off) |
| @@ -109,7 +109,7 @@ export struct OtherHomePageBottomCommentComponent { | @@ -109,7 +109,7 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | - .cachedCount(15) | 112 | + .cachedCount(5) |
| 113 | .layoutWeight(1) | 113 | .layoutWeight(1) |
| 114 | .scrollBar(BarState.Off) | 114 | .scrollBar(BarState.Off) |
| 115 | .edgeEffect(EdgeEffect.None) | 115 | .edgeEffect(EdgeEffect.None) |
| @@ -138,7 +138,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -138,7 +138,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 138 | ListHasNoMoreDataUI() | 138 | ListHasNoMoreDataUI() |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | - }.cachedCount(15) | 141 | + }.cachedCount(5) |
| 142 | .padding({left:'31lpx',right:'31lpx'}) | 142 | .padding({left:'31lpx',right:'31lpx'}) |
| 143 | .layoutWeight(1) | 143 | .layoutWeight(1) |
| 144 | .scrollBar(BarState.Off) | 144 | .scrollBar(BarState.Off) |
| @@ -289,7 +289,7 @@ export struct SearchResultContentComponent { | @@ -289,7 +289,7 @@ export struct SearchResultContentComponent { | ||
| 289 | ListHasNoMoreDataUI() | 289 | ListHasNoMoreDataUI() |
| 290 | } | 290 | } |
| 291 | } | 291 | } |
| 292 | - }.cachedCount(10) | 292 | + }.cachedCount(5) |
| 293 | .edgeEffect(EdgeEffect.None) | 293 | .edgeEffect(EdgeEffect.None) |
| 294 | .scrollBar(BarState.Off) | 294 | .scrollBar(BarState.Off) |
| 295 | .onReachEnd(() => { | 295 | .onReachEnd(() => { |
| @@ -305,57 +305,6 @@ export struct SearchResultContentComponent { | @@ -305,57 +305,6 @@ export struct SearchResultContentComponent { | ||
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | @Builder | 307 | @Builder |
| 308 | - multiCreatorUI() { | ||
| 309 | - Column() { | ||
| 310 | - List() { | ||
| 311 | - ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | ||
| 312 | - ListItem() { | ||
| 313 | - SearchCreatorComponent({ item: item }) | ||
| 314 | - } | ||
| 315 | - .width('150lpx') | ||
| 316 | - .height('100%') | ||
| 317 | - }) | ||
| 318 | - | ||
| 319 | - ListItem() { | ||
| 320 | - Column() { | ||
| 321 | - Text("查看更多") | ||
| 322 | - .width('19lpx') | ||
| 323 | - .fontSize('19lpx') | ||
| 324 | - .fontWeight('400lpx') | ||
| 325 | - .lineHeight('27lpx') | ||
| 326 | - .fontColor($r('app.color.color_9E9E9E')) | ||
| 327 | - } | ||
| 328 | - .borderRadius({ topLeft: '4lpx', bottomLeft: '4lpx' }) | ||
| 329 | - .height('180lpx') | ||
| 330 | - .width('77lpx') | ||
| 331 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 332 | - .justifyContent(FlexAlign.Center) | ||
| 333 | - | ||
| 334 | - }.height('100%') | ||
| 335 | - .margin({ left: '23lpx' }) | ||
| 336 | - .onClick(() => { | ||
| 337 | - let params: Params = { | ||
| 338 | - pageID: this.keywords | ||
| 339 | - } | ||
| 340 | - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage, params) | ||
| 341 | - }) | ||
| 342 | - } | ||
| 343 | - .cachedCount(6) | ||
| 344 | - .edgeEffect(EdgeEffect.None) | ||
| 345 | - .scrollBar(BarState.Off) | ||
| 346 | - .listDirection(Axis.Horizontal) | ||
| 347 | - .width('100%') | ||
| 348 | - .height('219lpx') | ||
| 349 | - | ||
| 350 | - Divider() | ||
| 351 | - .width('100%') | ||
| 352 | - .height('12lpx') | ||
| 353 | - .color($r('app.color.color_F5F5F5')) | ||
| 354 | - .strokeWidth('12lpx') | ||
| 355 | - } | ||
| 356 | - } | ||
| 357 | - | ||
| 358 | - @Builder | ||
| 359 | SearchListUI() { | 308 | SearchListUI() { |
| 360 | List({space:'8lpx'}) { | 309 | List({space:'8lpx'}) { |
| 361 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | 310 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { |
| @@ -505,7 +505,7 @@ export struct OperRowListView { | @@ -505,7 +505,7 @@ export struct OperRowListView { | ||
| 505 | // 评论组件需要数据 | 505 | // 评论组件需要数据 |
| 506 | if (Number.parseInt(this.interactData.commentNum) > | 506 | if (Number.parseInt(this.interactData.commentNum) > |
| 507 | Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | 507 | Number.parseInt(this.publishCommentModel.totalCommentNumer)) { |
| 508 | - this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0' | 508 | + this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' |
| 509 | } | 509 | } |
| 510 | } | 510 | } |
| 511 | // console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res)) | 511 | // console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res)) |
| @@ -182,7 +182,7 @@ struct SearchCreatorPage { | @@ -182,7 +182,7 @@ struct SearchCreatorPage { | ||
| 182 | ListHasNoMoreDataUI() | 182 | ListHasNoMoreDataUI() |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
| 185 | - }.cachedCount(10) | 185 | + }.cachedCount(5) |
| 186 | .padding({left:'31lpx',right:'31lpx'}) | 186 | .padding({left:'31lpx',right:'31lpx'}) |
| 187 | .layoutWeight(1) | 187 | .layoutWeight(1) |
| 188 | .scrollBar(BarState.Off) | 188 | .scrollBar(BarState.Off) |
| @@ -43,10 +43,19 @@ export class InfomationCardClick { | @@ -43,10 +43,19 @@ export class InfomationCardClick { | ||
| 43 | return summaryType; | 43 | return summaryType; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | - public static track(compDTO: CompDTO, contentDTO: ContentDTO, pageId: string, pageName: string): void { | 46 | + public static track( |
| 47 | + compDTO: CompDTO, | ||
| 48 | + contentDTO: ContentDTO, | ||
| 49 | + pageId: string, | ||
| 50 | + pageName: string, | ||
| 51 | + action = 'detailPageShow', // like, commentClick, follow | ||
| 52 | + bl = false, | ||
| 53 | + followUserId = '', | ||
| 54 | + followUserName = '' | ||
| 55 | + ): void { | ||
| 47 | try { | 56 | try { |
| 48 | const extParams: ParamType = { | 57 | const extParams: ParamType = { |
| 49 | - 'action': 'detailPageShow', | 58 | + 'action': action, |
| 50 | 'shareChannel': '', | 59 | 'shareChannel': '', |
| 51 | 'duration': 0, | 60 | 'duration': 0, |
| 52 | 'contentName': contentDTO.newsTitle, | 61 | 'contentName': contentDTO.newsTitle, |
| @@ -87,7 +96,15 @@ export class InfomationCardClick { | @@ -87,7 +96,15 @@ export class InfomationCardClick { | ||
| 87 | extParams['saAuthorName'] = contentDTO.source; | 96 | extParams['saAuthorName'] = contentDTO.source; |
| 88 | } | 97 | } |
| 89 | console.log('InfomationCardClick-params:', JSON.stringify(extParams)) | 98 | console.log('InfomationCardClick-params:', JSON.stringify(extParams)) |
| 90 | - TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams) | 99 | + if (action === 'detailPageShow') { |
| 100 | + TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams); | ||
| 101 | + } else if (action === 'like') { | ||
| 102 | + TrackingContent.like(bl, pageId, pageName, extParams); | ||
| 103 | + } else if (action === 'commentClick') { | ||
| 104 | + TrackingContent.commentClick(pageId, pageName, extParams); | ||
| 105 | + } else if (action === 'follow') { | ||
| 106 | + TrackingContent.follow(bl, followUserId, followUserName, pageId, pageName, extParams) | ||
| 107 | + } | ||
| 91 | } catch (err) { | 108 | } catch (err) { |
| 92 | console.log('InfomationCardClick-err', JSON.stringify(err)) | 109 | console.log('InfomationCardClick-err', JSON.stringify(err)) |
| 93 | } | 110 | } |
| @@ -112,6 +112,23 @@ export struct DetailPlayLiveCommon { | @@ -112,6 +112,23 @@ export struct DetailPlayLiveCommon { | ||
| 112 | }) | 112 | }) |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | + // /** | ||
| 116 | + // * | ||
| 117 | + // * @returns true : 沉浸式;false : 非沉浸式 | ||
| 118 | + // */ | ||
| 119 | + // isImmersionLive(): boolean { | ||
| 120 | + // | ||
| 121 | + // let flag = false | ||
| 122 | + // | ||
| 123 | + // if (this.liveState === 'wait' || this.liveLandscape === 'news') { | ||
| 124 | + // flag = false | ||
| 125 | + // } else if (this.liveLandscape === 'general') { | ||
| 126 | + // flag = true | ||
| 127 | + // } | ||
| 128 | + // | ||
| 129 | + // return flag | ||
| 130 | + // } | ||
| 131 | + | ||
| 115 | onPageShow() { | 132 | onPageShow() { |
| 116 | this.pageShow = Math.random() | 133 | this.pageShow = Math.random() |
| 117 | Logger.info(TAG, 'onPageShow') | 134 | Logger.info(TAG, 'onPageShow') |
| @@ -119,8 +119,8 @@ export struct DetailPlayLivePage { | @@ -119,8 +119,8 @@ export struct DetailPlayLivePage { | ||
| 119 | 119 | ||
| 120 | getLiveDetails() { | 120 | getLiveDetails() { |
| 121 | const data = this.contentDetailData | 121 | const data = this.contentDetailData |
| 122 | - console.error("XXXXZZZZ", 'contentDetailData ----liveState==>' + data.liveInfo?.liveState) | ||
| 123 | - console.error("XXXXZZZZ", 'contentDetailData ----liveStyle==>' + data.liveInfo?.liveStyle) | 122 | + // console.error("XXXXZZZZ", 'contentDetailData ----liveState==>' + data.liveInfo?.liveState) |
| 123 | + // console.error("XXXXZZZZ", 'contentDetailData ----liveStyle==>' + data.liveInfo?.liveStyle) | ||
| 124 | if (data.liveInfo?.liveState == 'wait') { | 124 | if (data.liveInfo?.liveState == 'wait') { |
| 125 | //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】 | 125 | //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】 |
| 126 | if (data.liveInfo?.liveStyle == 1) { | 126 | if (data.liveInfo?.liveStyle == 1) { |
| 1 | -import { window } from '@kit.ArkUI' | 1 | +import { window } from '@kit.ArkUI'; |
| 2 | import lottie from '@ohos/lottie'; | 2 | import lottie from '@ohos/lottie'; |
| 3 | 3 | ||
| 4 | -import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index' | ||
| 5 | -import { DateFormatUtil, WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index' | ||
| 6 | -import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | ||
| 7 | -import { DisplayDirection } from 'wdConstant/Index' | ||
| 8 | -import { LiveFollowComponent, LottieView } from 'wdComponent/Index' | 4 | +import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index'; |
| 5 | +import { DateFormatUtil, PlayerConstants, WDAliPlayerController } from 'wdPlayer/Index'; | ||
| 6 | +import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index'; | ||
| 7 | +import { DisplayDirection } from 'wdConstant/Index'; | ||
| 8 | +import { LiveFollowComponent, LottieView } from 'wdComponent/Index'; | ||
| 9 | 9 | ||
| 10 | @Component | 10 | @Component |
| 11 | export struct PlayUIComponent { | 11 | export struct PlayUIComponent { |
| 12 | playerController?: WDAliPlayerController; | 12 | playerController?: WDAliPlayerController; |
| 13 | //菜单键是否可见 | 13 | //菜单键是否可见 |
| 14 | @State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true | 14 | @State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true |
| 15 | -// @Consume liveDetailsBean: LiveDetailsBean | ||
| 16 | @Consume contentDetailData: ContentDetailDTO | 15 | @Consume contentDetailData: ContentDetailDTO |
| 17 | @Consume liveRoomDataBean: LiveRoomDataBean | 16 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 18 | @State currentTime: string = '' | 17 | @State currentTime: string = '' |
| @@ -21,8 +20,11 @@ export struct PlayUIComponent { | @@ -21,8 +20,11 @@ export struct PlayUIComponent { | ||
| 21 | //是否处于播放状态中 | 20 | //是否处于播放状态中 |
| 22 | @State isPlayStatus: boolean = true | 21 | @State isPlayStatus: boolean = true |
| 23 | @Consume displayDirection: DisplayDirection | 22 | @Consume displayDirection: DisplayDirection |
| 24 | - | ||
| 25 | @Prop isShowBottom: boolean | 23 | @Prop isShowBottom: boolean |
| 24 | + // 播放地址 (视频或者 直播地址) | ||
| 25 | + @Prop liveUrl: string | ||
| 26 | + // 当前播放资源的状态 | ||
| 27 | + @Consume playSourceState: number | ||
| 26 | 28 | ||
| 27 | onChangeMenuVisible() { | 29 | onChangeMenuVisible() { |
| 28 | if (!this.contentDetailData || !this.contentDetailData.liveInfo || | 30 | if (!this.contentDetailData || !this.contentDetailData.liveInfo || |
| @@ -41,6 +43,21 @@ export struct PlayUIComponent { | @@ -41,6 +43,21 @@ export struct PlayUIComponent { | ||
| 41 | 43 | ||
| 42 | aboutToAppear(): void { | 44 | aboutToAppear(): void { |
| 43 | this.onChangeMenuVisible() | 45 | this.onChangeMenuVisible() |
| 46 | + | ||
| 47 | + this.initPlayerSet() | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + aboutToDisappear(): void { | ||
| 51 | + if (this.contentDetailData.liveInfo?.liveState == 'running') { | ||
| 52 | + lottie.destroy('live_status_wait') | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /* | ||
| 57 | + 初始话播放器设置 | ||
| 58 | + */ | ||
| 59 | + initPlayerSet(){ | ||
| 60 | + | ||
| 44 | //播放进度监听 | 61 | //播放进度监听 |
| 45 | if (this.playerController) { | 62 | if (this.playerController) { |
| 46 | this.playerController.onTimeUpdate = (position: number, duration: number) => { | 63 | this.playerController.onTimeUpdate = (position: number, duration: number) => { |
| @@ -49,12 +66,7 @@ export struct PlayUIComponent { | @@ -49,12 +66,7 @@ export struct PlayUIComponent { | ||
| 49 | this.progressVal = Math.floor(position * 100 / duration); | 66 | this.progressVal = Math.floor(position * 100 / duration); |
| 50 | } | 67 | } |
| 51 | } | 68 | } |
| 52 | - } | ||
| 53 | 69 | ||
| 54 | - aboutToDisappear(): void { | ||
| 55 | - if (this.contentDetailData.liveInfo?.liveState == 'running') { | ||
| 56 | - lottie.destroy('live_status_wait') | ||
| 57 | - } | ||
| 58 | } | 70 | } |
| 59 | 71 | ||
| 60 | build() { | 72 | build() { |
| @@ -62,7 +74,7 @@ export struct PlayUIComponent { | @@ -62,7 +74,7 @@ export struct PlayUIComponent { | ||
| 62 | if (this.contentDetailData && this.contentDetailData.liveInfo) { | 74 | if (this.contentDetailData && this.contentDetailData.liveInfo) { |
| 63 | this.getTopUIComponent() | 75 | this.getTopUIComponent() |
| 64 | this.getMiddleUIComponent() | 76 | this.getMiddleUIComponent() |
| 65 | - if(this.isShowBottom){ | 77 | + if (this.isShowBottom) { |
| 66 | this.getBottomUIComponent() | 78 | this.getBottomUIComponent() |
| 67 | } | 79 | } |
| 68 | 80 | ||
| @@ -251,16 +263,13 @@ export struct PlayUIComponent { | @@ -251,16 +263,13 @@ export struct PlayUIComponent { | ||
| 251 | @Builder | 263 | @Builder |
| 252 | getBottomUIComponent() { | 264 | getBottomUIComponent() { |
| 253 | Row() { | 265 | Row() { |
| 254 | - if (this.contentDetailData?.liveInfo?.liveState == 'wait') { | ||
| 255 | - Blank() | ||
| 256 | - } else if (this.contentDetailData?.liveInfo?.liveState == 'running') { | 266 | + |
| 267 | + // 视频资源 | ||
| 268 | + if (!StringUtils.isEmpty(this.liveUrl)) { | ||
| 269 | + // 暂定和播放按钮 | ||
| 257 | this.playOrPauseBtn() | 270 | this.playOrPauseBtn() |
| 258 | - Blank() | ||
| 259 | - } else if (this.contentDetailData?.liveInfo?.liveState == 'end') { | ||
| 260 | - if (StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri)) { | ||
| 261 | - Blank() | ||
| 262 | - } else { | ||
| 263 | - this.playOrPauseBtn() | 271 | + // 开始时间 |
| 272 | + if (this.contentDetailData?.liveInfo?.liveState != 'running' || this.contentDetailData.showTime) { | ||
| 264 | Text(this.currentTime) | 273 | Text(this.currentTime) |
| 265 | .fontColor(Color.White) | 274 | .fontColor(Color.White) |
| 266 | .fontWeight(600) | 275 | .fontWeight(600) |
| @@ -268,7 +277,12 @@ export struct PlayUIComponent { | @@ -268,7 +277,12 @@ export struct PlayUIComponent { | ||
| 268 | .margin({ | 277 | .margin({ |
| 269 | left: 16 | 278 | left: 16 |
| 270 | }) | 279 | }) |
| 271 | - this.playProgressView() | 280 | + } |
| 281 | + | ||
| 282 | + // 进度条 | ||
| 283 | + this.playProgressView() | ||
| 284 | + // 总的播放时间 | ||
| 285 | + if (this.contentDetailData?.liveInfo?.liveState != 'running' || this.contentDetailData.showTime) { | ||
| 272 | Text(this.totalTime) | 286 | Text(this.totalTime) |
| 273 | .fontColor(Color.White) | 287 | .fontColor(Color.White) |
| 274 | .fontWeight(600) | 288 | .fontWeight(600) |
| @@ -277,11 +291,13 @@ export struct PlayUIComponent { | @@ -277,11 +291,13 @@ export struct PlayUIComponent { | ||
| 277 | right: 16 | 291 | right: 16 |
| 278 | }) | 292 | }) |
| 279 | } | 293 | } |
| 294 | + | ||
| 295 | + } else { | ||
| 296 | + Blank() | ||
| 280 | } | 297 | } |
| 281 | - if (this.contentDetailData?.liveInfo?.liveState == 'running' | ||
| 282 | - || (this.contentDetailData?.liveInfo?.liveState == 'end' && | ||
| 283 | - StringUtils.isNotEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri)) | ||
| 284 | - ) { | 298 | + |
| 299 | + // 全屏按钮 | ||
| 300 | + if (!StringUtils.isEmpty(this.liveUrl)) { | ||
| 285 | Image($r('app.media.icon_live_player_full_screen')) | 301 | Image($r('app.media.icon_live_player_full_screen')) |
| 286 | .width(24) | 302 | .width(24) |
| 287 | .height(24) | 303 | .height(24) |
| @@ -298,6 +314,7 @@ export struct PlayUIComponent { | @@ -298,6 +314,7 @@ export struct PlayUIComponent { | ||
| 298 | }) | 314 | }) |
| 299 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 315 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 300 | } | 316 | } |
| 317 | + | ||
| 301 | } | 318 | } |
| 302 | .alignItems(VerticalAlign.Center) | 319 | .alignItems(VerticalAlign.Center) |
| 303 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | 320 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) |
| @@ -313,19 +330,34 @@ export struct PlayUIComponent { | @@ -313,19 +330,34 @@ export struct PlayUIComponent { | ||
| 313 | 330 | ||
| 314 | @Builder | 331 | @Builder |
| 315 | playOrPauseBtn() { | 332 | playOrPauseBtn() { |
| 316 | - //暂停、播放 | ||
| 317 | - Image(this.isPlayStatus ? $r('app.media.icon_live_player_pause') : $r('app.media.player_play_ic')) | ||
| 318 | - .width(24) | ||
| 319 | - .height(24) | ||
| 320 | - .onClick(() => { | ||
| 321 | - if (this.isPlayStatus) { | ||
| 322 | - this.isPlayStatus = false | ||
| 323 | - this.playerController?.pause() | ||
| 324 | - } else { | 333 | + |
| 334 | + if (this.playSourceState === PlayerConstants.STATUS_COMPLETION) { | ||
| 335 | + //资源播放完成 | ||
| 336 | + Image($r('app.media.player_play_ic')) | ||
| 337 | + .width(24) | ||
| 338 | + .height(24) | ||
| 339 | + .onClick(() => { | ||
| 325 | this.isPlayStatus = true | 340 | this.isPlayStatus = true |
| 341 | + this.initPlayerSet() | ||
| 342 | + this.playerController?.firstPlay(this.liveUrl) | ||
| 326 | this.playerController?.play() | 343 | this.playerController?.play() |
| 327 | - } | ||
| 328 | - }) | 344 | + }) |
| 345 | + } else { | ||
| 346 | + //暂停、播放 | ||
| 347 | + Image(this.isPlayStatus ? $r('app.media.icon_live_player_pause') : $r('app.media.player_play_ic')) | ||
| 348 | + .width(24) | ||
| 349 | + .height(24) | ||
| 350 | + .onClick(() => { | ||
| 351 | + if (this.isPlayStatus) { | ||
| 352 | + this.isPlayStatus = false | ||
| 353 | + this.playerController?.pause() | ||
| 354 | + } else { | ||
| 355 | + this.isPlayStatus = true | ||
| 356 | + this.playerController?.play() | ||
| 357 | + } | ||
| 358 | + }) | ||
| 359 | + } | ||
| 360 | + | ||
| 329 | } | 361 | } |
| 330 | 362 | ||
| 331 | @Builder | 363 | @Builder |
| @@ -13,7 +13,9 @@ const TAG: string = 'TopPlayComponent' | @@ -13,7 +13,9 @@ const TAG: string = 'TopPlayComponent' | ||
| 13 | export struct TopPlayComponent { | 13 | export struct TopPlayComponent { |
| 14 | @Consume @Watch('updateData') contentDetailData: ContentDetailDTO | 14 | @Consume @Watch('updateData') contentDetailData: ContentDetailDTO |
| 15 | playerController?: WDAliPlayerController | 15 | playerController?: WDAliPlayerController |
| 16 | - @State imgUrl: string = '' | 16 | + // 预告片图片/视频url |
| 17 | + @State previewUrl: string = '' | ||
| 18 | + @State isVideoSource: boolean = false | ||
| 17 | //未开始 | 19 | //未开始 |
| 18 | @State isWait: boolean = false | 20 | @State isWait: boolean = false |
| 19 | //已结束直播 | 21 | //已结束直播 |
| @@ -24,14 +26,15 @@ export struct TopPlayComponent { | @@ -24,14 +26,15 @@ export struct TopPlayComponent { | ||
| 24 | @State isLoading: boolean = false | 26 | @State isLoading: boolean = false |
| 25 | // 获取播放资源能播放了 | 27 | // 获取播放资源能播放了 |
| 26 | @State isCanPlay: boolean = false | 28 | @State isCanPlay: boolean = false |
| 27 | - | 29 | + // 当前播放资源的状态 |
| 30 | + @Provide playSourceState: number = 0 | ||
| 28 | private playUrl: string = "" | 31 | private playUrl: string = "" |
| 29 | private xComponentIsLoaded: boolean = false | 32 | private xComponentIsLoaded: boolean = false |
| 30 | 33 | ||
| 31 | aboutToAppear(): void { | 34 | aboutToAppear(): void { |
| 32 | if (this.playerController) { | 35 | if (this.playerController) { |
| 33 | this.playerController.onCanplay = () => { | 36 | this.playerController.onCanplay = () => { |
| 34 | - | 37 | + Logger.debug(TAG, 'onCanplay==>') |
| 35 | this.isCanPlay = true | 38 | this.isCanPlay = true |
| 36 | this.isLoading = true | 39 | this.isLoading = true |
| 37 | this.playerController?.play() | 40 | this.playerController?.play() |
| @@ -40,35 +43,56 @@ export struct TopPlayComponent { | @@ -40,35 +43,56 @@ export struct TopPlayComponent { | ||
| 40 | 43 | ||
| 41 | this.playerController.onStatusChange = (status: number) => { | 44 | this.playerController.onStatusChange = (status: number) => { |
| 42 | 45 | ||
| 46 | + this.playSourceState = status | ||
| 47 | + Logger.debug(TAG, 'status==>' + status) | ||
| 43 | if (status === PlayerConstants.STATUS_ERROR) { | 48 | if (status === PlayerConstants.STATUS_ERROR) { |
| 44 | this.isError = true | 49 | this.isError = true |
| 45 | this.isLoading = true | 50 | this.isLoading = true |
| 46 | - | ||
| 47 | this.isCanPlay = false | 51 | this.isCanPlay = false |
| 52 | + } else if (status === PlayerConstants.STATUS_COMPLETION) { | ||
| 53 | + // 播放完成 | ||
| 54 | + | ||
| 55 | + | ||
| 48 | } else { | 56 | } else { |
| 49 | this.isError = false | 57 | this.isError = false |
| 50 | } | 58 | } |
| 51 | 59 | ||
| 52 | - | ||
| 53 | } | 60 | } |
| 54 | } | 61 | } |
| 55 | this.updateData() | 62 | this.updateData() |
| 56 | } | 63 | } |
| 57 | 64 | ||
| 58 | updateData() { | 65 | updateData() { |
| 66 | + | ||
| 67 | + // 检测等待中的直播预告是否视频资源 | ||
| 68 | + if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 | ||
| 69 | + && this.contentDetailData.liveInfo.previewUrl && | ||
| 70 | + this.contentDetailData.liveInfo.previewUrl.length > 0) { | ||
| 71 | + // 预告资源是视频 | ||
| 72 | + this.isVideoSource = true | ||
| 73 | + this.contentDetailData.showTime = true | ||
| 74 | + } | ||
| 59 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 75 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 60 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && | 76 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && |
| 61 | this.contentDetailData.liveInfo.previewUrl.length > 0) { | 77 | this.contentDetailData.liveInfo.previewUrl.length > 0) { |
| 62 | - this.imgUrl = this.contentDetailData.liveInfo.previewUrl | ||
| 63 | - Logger.debug(TAG, 'ok+' + `${this.imgUrl}`) | 78 | + this.previewUrl = this.contentDetailData.liveInfo.previewUrl |
| 79 | + | ||
| 64 | } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { | 80 | } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { |
| 65 | - this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url | ||
| 66 | - Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) | 81 | + this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url |
| 67 | } | 82 | } |
| 68 | - this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait' | ||
| 69 | - if(this.isWait ){ | ||
| 70 | - this.isLoading = true | 83 | + |
| 84 | + Logger.debug(TAG, 'ok+' + `${this.previewUrl}`) | ||
| 85 | + | ||
| 86 | + if (this.isVideoSource) { | ||
| 87 | + this.isWait = false | ||
| 88 | + this.isLoading = false | ||
| 89 | + } else { | ||
| 90 | + this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait' | ||
| 91 | + if (this.isWait) { | ||
| 92 | + this.isLoading = true | ||
| 93 | + } | ||
| 71 | } | 94 | } |
| 95 | + | ||
| 72 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && | 96 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && |
| 73 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) | 97 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) |
| 74 | if (!this.isWait && this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { | 98 | if (!this.isWait && this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { |
| @@ -78,12 +102,18 @@ export struct TopPlayComponent { | @@ -78,12 +102,18 @@ export struct TopPlayComponent { | ||
| 78 | } else if (this.contentDetailData.liveInfo.liveState == 'end') { | 102 | } else if (this.contentDetailData.liveInfo.liveState == 'end') { |
| 79 | playUrl = this.contentDetailData.liveInfo.vlive[0].replayUri | 103 | playUrl = this.contentDetailData.liveInfo.vlive[0].replayUri |
| 80 | } | 104 | } |
| 81 | - // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); | ||
| 82 | - if (StringUtils.isNotEmpty(playUrl)) { | ||
| 83 | - Logger.debug(TAG, `${playUrl}`) | ||
| 84 | - this.playUrl = playUrl | 105 | + |
| 106 | + if (this.isVideoSource) { | ||
| 107 | + this.playUrl = this.previewUrl | ||
| 85 | this.tryToPlay() | 108 | this.tryToPlay() |
| 109 | + } else { | ||
| 110 | + if (StringUtils.isNotEmpty(playUrl)) { | ||
| 111 | + Logger.debug(TAG, `${playUrl}`) | ||
| 112 | + this.playUrl = playUrl | ||
| 113 | + this.tryToPlay() | ||
| 114 | + } | ||
| 86 | } | 115 | } |
| 116 | + | ||
| 87 | } | 117 | } |
| 88 | } | 118 | } |
| 89 | 119 | ||
| @@ -115,18 +145,22 @@ export struct TopPlayComponent { | @@ -115,18 +145,22 @@ export struct TopPlayComponent { | ||
| 115 | .width('100%') | 145 | .width('100%') |
| 116 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) | 146 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) |
| 117 | 147 | ||
| 118 | - // 直播房间图 | ||
| 119 | - Image(this.imgUrl) | ||
| 120 | - .objectFit(ImageFit.Cover) | ||
| 121 | - .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | ||
| 122 | - .contrast(this.isEnd ? 0.2 : 1) | ||
| 123 | - .width('100%') | 148 | + if (this.isVideoSource) { |
| 149 | + | ||
| 150 | + } else { | ||
| 151 | + // 直播房间图 | ||
| 152 | + Image(this.previewUrl) | ||
| 153 | + .objectFit(ImageFit.Cover) | ||
| 154 | + .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | ||
| 155 | + .contrast(this.isEnd ? 0.2 : 1) | ||
| 156 | + .width('100%') | ||
| 157 | + } | ||
| 124 | 158 | ||
| 125 | // loading | 159 | // loading |
| 126 | PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) | 160 | PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) |
| 127 | 161 | ||
| 128 | // 视频播放器上的控制面板和信息 | 162 | // 视频播放器上的控制面板和信息 |
| 129 | - PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay }) | 163 | + PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl }) |
| 130 | 164 | ||
| 131 | // 直播结束 | 165 | // 直播结束 |
| 132 | Text('直播已结束') | 166 | Text('直播已结束') |
| @@ -182,7 +182,7 @@ export struct DetailPlayShortVideoPage { | @@ -182,7 +182,7 @@ export struct DetailPlayShortVideoPage { | ||
| 182 | index: $index, | 182 | index: $index, |
| 183 | currentIndex: $currentIndex, | 183 | currentIndex: $currentIndex, |
| 184 | showCommentList: $showCommentList, | 184 | showCommentList: $showCommentList, |
| 185 | - // publishCommentModel: $publishCommentModel | 185 | + publishCommentModel: $publishCommentModel |
| 186 | }) | 186 | }) |
| 187 | this.playerViewBuilder() | 187 | this.playerViewBuilder() |
| 188 | 188 |
| 1 | import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' | 1 | import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' |
| 2 | 2 | ||
| 3 | -import { CommentListDialogView } from 'wdComponent/Index' | 3 | +import { CommentListDialogView, publishCommentModel } from 'wdComponent/Index' |
| 4 | 4 | ||
| 5 | @Component | 5 | @Component |
| 6 | export struct CommentDialogView { | 6 | export struct CommentDialogView { |
| 7 | @Link @Watch('showCommentListChange') showCommentList: boolean | 7 | @Link @Watch('showCommentListChange') showCommentList: boolean |
| 8 | @Link index: number | 8 | @Link index: number |
| 9 | @Link currentIndex: number | 9 | @Link currentIndex: number |
| 10 | + @Link publishCommentModel: publishCommentModel | ||
| 10 | @Consume contentDetailData: ContentDetailDTO | 11 | @Consume contentDetailData: ContentDetailDTO |
| 11 | @State fakePageInfo: PageInfoDTO = {} as PageInfoDTO | 12 | @State fakePageInfo: PageInfoDTO = {} as PageInfoDTO |
| 12 | @State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16) | 13 | @State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16) |
| @@ -29,6 +30,7 @@ export struct CommentDialogView { | @@ -29,6 +30,7 @@ export struct CommentDialogView { | ||
| 29 | CommentListDialogView({ | 30 | CommentListDialogView({ |
| 30 | showCommentList: this.innerShowComment, | 31 | showCommentList: this.innerShowComment, |
| 31 | contentDetailData: this.contentDetailData, | 32 | contentDetailData: this.contentDetailData, |
| 33 | + publishCommentModel: this.publishCommentModel, | ||
| 32 | pageInfo: this.fakePageInfo, | 34 | pageInfo: this.fakePageInfo, |
| 33 | onClose: () => { | 35 | onClose: () => { |
| 34 | this.showCommentList = false | 36 | this.showCommentList = false |
| @@ -50,8 +50,6 @@ export struct WDPlayerRenderLiveView { | @@ -50,8 +50,6 @@ export struct WDPlayerRenderLiveView { | ||
| 50 | 50 | ||
| 51 | aboutToAppear() { | 51 | aboutToAppear() { |
| 52 | MGPlayRenderViewIns.add(); | 52 | MGPlayRenderViewIns.add(); |
| 53 | - | ||
| 54 | - console.log('playerController', this.playerController) | ||
| 55 | insIndex++; | 53 | insIndex++; |
| 56 | if (!this.playerController) { | 54 | if (!this.playerController) { |
| 57 | return | 55 | return |
| @@ -59,7 +57,6 @@ export struct WDPlayerRenderLiveView { | @@ -59,7 +57,6 @@ export struct WDPlayerRenderLiveView { | ||
| 59 | 57 | ||
| 60 | this.playerController.onVideoSizeChange = (width: number, height: number) => { | 58 | this.playerController.onVideoSizeChange = (width: number, height: number) => { |
| 61 | // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) | 59 | // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) |
| 62 | - Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 63 | this.videoWidth = width; | 60 | this.videoWidth = width; |
| 64 | this.videoHeight = height; | 61 | this.videoHeight = height; |
| 65 | this.updateLayout() | 62 | this.updateLayout() |
| @@ -83,8 +80,6 @@ export struct WDPlayerRenderLiveView { | @@ -83,8 +80,6 @@ export struct WDPlayerRenderLiveView { | ||
| 83 | .onLoad(async (event) => { | 80 | .onLoad(async (event) => { |
| 84 | Logger.info(TAG, 'onLoad') | 81 | Logger.info(TAG, 'onLoad') |
| 85 | let surfaceId = this.xComponentController.getXComponentSurfaceId() | 82 | let surfaceId = this.xComponentController.getXComponentSurfaceId() |
| 86 | - console.log('surfaceId===', surfaceId) | ||
| 87 | - console.log('insId===', this.insId) | ||
| 88 | this.xComponentController.setXComponentSurfaceSize({ | 83 | this.xComponentController.setXComponentSurfaceSize({ |
| 89 | surfaceWidth: 1920, | 84 | surfaceWidth: 1920, |
| 90 | surfaceHeight: 720 | 85 | surfaceHeight: 720 |
| @@ -116,7 +116,7 @@ export struct MultiPictureDetailPageComponent { | @@ -116,7 +116,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 116 | index: $index, | 116 | index: $index, |
| 117 | currentIndex: $currentIndex, | 117 | currentIndex: $currentIndex, |
| 118 | showCommentList: $showCommentList, | 118 | showCommentList: $showCommentList, |
| 119 | - // publishCommentModel: $publishCommentModel | 119 | + publishCommentModel: $publishCommentModel |
| 120 | }) | 120 | }) |
| 121 | 121 | ||
| 122 | } | 122 | } |
-
Please register or login to post a comment