Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix |> 20595 后台对拉流直播设置切换垫片后,在直播频道列表进入直播间后,可以正常播放直播 fix: 人民日报在平板上竖屏使用, 播放视频页面, 点击评论, 视频画面会变的非常小,原因是获取的主窗口宽高有问题 fix |> 4g网络环境,进入直播间, “正在使用非Wi-Fi网络,播放将产生流量费用” 蒙层未显示,看图 fix |> 20660 直播详情大家聊中,下拉刷新评论列表后,没有展示最新评论
Showing
7 changed files
with
146 additions
and
42 deletions
| 1 | import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' | 1 | import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' |
| 2 | -import { Logger, PublicDialogManager } from 'wdKit/Index' | 2 | +import { Logger, PublicDialogManager, WindowModel } from 'wdKit/Index' |
| 3 | import { TrackConstants } from 'wdTracking/Index' | 3 | import { TrackConstants } from 'wdTracking/Index' |
| 4 | import { OperRowListView } from '../../view/OperRowListView' | 4 | import { OperRowListView } from '../../view/OperRowListView' |
| 5 | import { publishCommentModel } from '../model/PublishCommentModel' | 5 | import { publishCommentModel } from '../model/PublishCommentModel' |
| @@ -10,8 +10,8 @@ const TAG = "CommentListDialogView" | @@ -10,8 +10,8 @@ const TAG = "CommentListDialogView" | ||
| 10 | /// 评论列表弹框 | 10 | /// 评论列表弹框 |
| 11 | @Component | 11 | @Component |
| 12 | export struct CommentListDialogView { | 12 | export struct CommentListDialogView { |
| 13 | - @State windowWidth: number = AppStorage.get<number>('windowWidth') || 0 | ||
| 14 | - @State windowHeight: number = AppStorage.get<number>('windowHeight') || 0 | 13 | + @State windowWidth: number = WindowModel.shared.getWindowClass().getWindowProperties()?.windowRect.width |
| 14 | + @State windowHeight: number = WindowModel.shared.getWindowClass().getWindowProperties()?.windowRect.height | ||
| 15 | @Link showCommentList: boolean | 15 | @Link showCommentList: boolean |
| 16 | @Link contentDetailData: ContentDetailDTO // 详情页传 | 16 | @Link contentDetailData: ContentDetailDTO // 详情页传 |
| 17 | @Link pageInfo: PageInfoDTO // 专题页传 | 17 | @Link pageInfo: PageInfoDTO // 专题页传 |
| @@ -24,12 +24,13 @@ export struct CommentListDialogView { | @@ -24,12 +24,13 @@ export struct CommentListDialogView { | ||
| 24 | @State isPad:boolean = this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"?true:false | 24 | @State isPad:boolean = this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"?true:false |
| 25 | 25 | ||
| 26 | aboutToAppear(): void { | 26 | aboutToAppear(): void { |
| 27 | - if (this.isPad) { | ||
| 28 | - this.maxHeight = this.windowHeight * 0.6 | ||
| 29 | - }else { | 27 | + // if (this.isPad) { |
| 28 | + // this.maxHeight = this.windowHeight * 0.6 | ||
| 29 | + // }else { | ||
| 30 | + // this.maxHeight = this.windowHeight - this.windowWidth * 9 / 16 | ||
| 31 | + // } | ||
| 30 | this.maxHeight = this.windowHeight - this.windowWidth * 9 / 16 | 32 | this.maxHeight = this.windowHeight - this.windowWidth * 9 / 16 |
| 31 | } | 33 | } |
| 32 | - } | ||
| 33 | 34 | ||
| 34 | build() { | 35 | build() { |
| 35 | Row() { | 36 | Row() { |
| @@ -49,28 +49,8 @@ export struct DetailPlayLivePage { | @@ -49,28 +49,8 @@ export struct DetailPlayLivePage { | ||
| 49 | @Provide banComment: boolean = true | 49 | @Provide banComment: boolean = true |
| 50 | @State isEnd: boolean = false | 50 | @State isEnd: boolean = false |
| 51 | @Consume liveDetailPageLogic: LiveDetailPageLogic | 51 | @Consume liveDetailPageLogic: LiveDetailPageLogic |
| 52 | - @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗" | ||
| 53 | @State topPlayHeight:number = this.getTopPlayHeight() | 52 | @State topPlayHeight:number = this.getTopPlayHeight() |
| 54 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | 53 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; |
| 55 | - dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 56 | - builder: CustomToast({ | ||
| 57 | - bgColor: 0xB3000000, | ||
| 58 | - opacityValue: 1, | ||
| 59 | - fontSizeValue: "25lpx", | ||
| 60 | - lineHeightValue: "36lpx", | ||
| 61 | - msg: this.toastText, | ||
| 62 | - marginTop:211/2+px2vp(this.topSafeHeight)-px2vp(84/2) | ||
| 63 | - }), | ||
| 64 | - autoCancel: false, | ||
| 65 | - alignment: DialogAlignment.Top, | ||
| 66 | - customStyle: true, | ||
| 67 | - maskColor: "#00000000" | ||
| 68 | - }) | ||
| 69 | - | ||
| 70 | - showToastTip(msg: ResourceStr) { | ||
| 71 | - this.toastText = msg | ||
| 72 | - this.dialogToast.open() | ||
| 73 | - } | ||
| 74 | 54 | ||
| 75 | async aboutToAppear(): Promise<void> { | 55 | async aboutToAppear(): Promise<void> { |
| 76 | Logger.info(TAG, `wyj-aboutToAppear`) | 56 | Logger.info(TAG, `wyj-aboutToAppear`) |
| @@ -86,13 +66,6 @@ export struct DetailPlayLivePage { | @@ -86,13 +66,6 @@ export struct DetailPlayLivePage { | ||
| 86 | }) | 66 | }) |
| 87 | this.getLiveDetails() | 67 | this.getLiveDetails() |
| 88 | this.getLiveRoomData() | 68 | this.getLiveRoomData() |
| 89 | - | ||
| 90 | - if (this.liveDetailPageLogic.dealOrShowToast()) { | ||
| 91 | - if(!await onlyWifiLoadVideo()){ | ||
| 92 | - this.showToastTip(this.toastText) | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | this.configChatRoom() | 69 | this.configChatRoom() |
| 97 | } | 70 | } |
| 98 | 71 |
| @@ -80,7 +80,7 @@ export class LiveDetailPageLogic { | @@ -80,7 +80,7 @@ export class LiveDetailPageLogic { | ||
| 80 | 80 | ||
| 81 | // 只有直播中的才会有垫片 | 81 | // 只有直播中的才会有垫片 |
| 82 | if(this.liveState === 'running'){ | 82 | if(this.liveState === 'running'){ |
| 83 | - if (this.contentDetailData.liveInfo.vlive.count > 0) { | 83 | + if (this.contentDetailData.liveInfo.vlive && this.contentDetailData.liveInfo.vlive.length > 0) { |
| 84 | this.showPad = this.contentDetailData.liveInfo.vlive[index].showPad | 84 | this.showPad = this.contentDetailData.liveInfo.vlive[index].showPad |
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| @@ -94,7 +94,16 @@ export class LiveDetailPageLogic { | @@ -94,7 +94,16 @@ export class LiveDetailPageLogic { | ||
| 94 | return '' | 94 | return '' |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | - dealOrShowToast(): boolean { | 97 | + livingNeedShowNoWifiTip(): boolean { |
| 98 | + if (this.liveState == 'running') { | ||
| 99 | + if (this.contentDetailData.liveInfo.liveWay == 0) { ///直播视频 | ||
| 100 | + return true | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + return false | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + noLivingNeedShowNoWifiTip(): boolean { | ||
| 98 | if (this.liveState == 'wait') { | 107 | if (this.liveState == 'wait') { |
| 99 | if (this.contentDetailData.liveInfo | 108 | if (this.contentDetailData.liveInfo |
| 100 | && this.contentDetailData.liveInfo.previewUrl.length > 0 | 109 | && this.contentDetailData.liveInfo.previewUrl.length > 0 |
| @@ -102,7 +111,7 @@ export class LiveDetailPageLogic { | @@ -102,7 +111,7 @@ export class LiveDetailPageLogic { | ||
| 102 | return true | 111 | return true |
| 103 | } | 112 | } |
| 104 | } | 113 | } |
| 105 | - if (this.liveState == 'running') { | 114 | + if (this.liveState == 'end') { |
| 106 | if (this.contentDetailData.liveInfo.liveWay == 0) { ///直播视频 | 115 | if (this.contentDetailData.liveInfo.liveWay == 0) { ///直播视频 |
| 107 | return true | 116 | return true |
| 108 | } | 117 | } |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/common/NoWifiTipComponent.ets
0 → 100644
| 1 | + | ||
| 2 | +@Component | ||
| 3 | +export struct NoWifiTipComponent { | ||
| 4 | + @State toastText: ResourceStr = "正在使用非Wi-Fi网络,播放将产生流量费用" | ||
| 5 | + | ||
| 6 | + onContinue?: () => void | ||
| 7 | + | ||
| 8 | + aboutToAppear(): void { | ||
| 9 | + | ||
| 10 | + } | ||
| 11 | + aboutToDisappear(): void { | ||
| 12 | + | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + Row() { | ||
| 17 | + Column() { | ||
| 18 | + Column() { | ||
| 19 | + Text(this.toastText) | ||
| 20 | + .fontFamily('PingFang SC-Regular') | ||
| 21 | + .fontWeight(FontWeight.Regular) | ||
| 22 | + .fontColor('#FFFFFF') | ||
| 23 | + .fontSize(16) | ||
| 24 | + .lineHeight(24) | ||
| 25 | + .textAlign(TextAlign.Center) | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + Column() { | ||
| 29 | + Text("使用流量播放") | ||
| 30 | + .fontFamily('PingFang SC-Regular') | ||
| 31 | + .fontWeight(FontWeight.Regular) | ||
| 32 | + .fontColor(Color.White) | ||
| 33 | + .fontSize(14) | ||
| 34 | + .lineHeight(20) | ||
| 35 | + .textAlign(TextAlign.Center) | ||
| 36 | + .margin({ | ||
| 37 | + top: 5, | ||
| 38 | + bottom: 5, | ||
| 39 | + left: 8, | ||
| 40 | + right: 8 | ||
| 41 | + }) | ||
| 42 | + } | ||
| 43 | + .border({ width: 1, color: '#4DFFFFFF', radius: 4 }) | ||
| 44 | + .height(30) | ||
| 45 | + .alignItems(HorizontalAlign.Center) | ||
| 46 | + .justifyContent(FlexAlign.Center) | ||
| 47 | + .margin({ | ||
| 48 | + top: 16 | ||
| 49 | + }) | ||
| 50 | + .onClick(() => { | ||
| 51 | + if (this.onContinue) { | ||
| 52 | + this.onContinue() | ||
| 53 | + } | ||
| 54 | + }) | ||
| 55 | + } | ||
| 56 | + .width('100%') | ||
| 57 | + .height(64) | ||
| 58 | + } | ||
| 59 | + .width('100%') | ||
| 60 | + .height('100%') | ||
| 61 | + .alignItems(VerticalAlign.Center) | ||
| 62 | + .justifyContent(FlexAlign.Center) | ||
| 63 | + .backgroundColor('#222222') | ||
| 64 | + .opacity(0.7) | ||
| 65 | + } | ||
| 66 | +} |
| @@ -146,7 +146,7 @@ export struct TabChatComponent { | @@ -146,7 +146,7 @@ export struct TabChatComponent { | ||
| 146 | (data) => { | 146 | (data) => { |
| 147 | this.pageModel.isLoading = false | 147 | this.pageModel.isLoading = false |
| 148 | if (resolve) { | 148 | if (resolve) { |
| 149 | - if (this.pageModel.currentPage == 1) { | 149 | + if (this.pageModel.currentPage != 1) { |
| 150 | resolve('已更新至最新') | 150 | resolve('已更新至最新') |
| 151 | } else { | 151 | } else { |
| 152 | resolve('') | 152 | resolve('') |
| @@ -158,7 +158,11 @@ export struct TabChatComponent { | @@ -158,7 +158,11 @@ export struct TabChatComponent { | ||
| 158 | Logger.debug(TAG, `${JSON.stringify(data)}`) | 158 | Logger.debug(TAG, `${JSON.stringify(data)}`) |
| 159 | if (data.barrageResponses && data.barrageResponses.length > 0) { | 159 | if (data.barrageResponses && data.barrageResponses.length > 0) { |
| 160 | this.pageModel.viewType = ViewType.LOADED; | 160 | this.pageModel.viewType = ViewType.LOADED; |
| 161 | + if (this.pageModel.currentPage === 1) { | ||
| 161 | this.liveChatList.push(...data.barrageResponses) | 162 | this.liveChatList.push(...data.barrageResponses) |
| 163 | + }else { | ||
| 164 | + this.liveChatList.addItems(data.barrageResponses, 0) | ||
| 165 | + } | ||
| 162 | 166 | ||
| 163 | if (this.pageModel.currentPage === 1) { | 167 | if (this.pageModel.currentPage === 1) { |
| 164 | setTimeout(() => { | 168 | setTimeout(() => { |
| 1 | import { ContentDetailDTO, LiveRoomItemBean } from 'wdBean/Index'; | 1 | import { ContentDetailDTO, LiveRoomItemBean } from 'wdBean/Index'; |
| 2 | -import { Logger, StringUtils, WindowModel } from 'wdKit/Index'; | 2 | +import { CustomToast, Logger, StringUtils, WindowModel } from 'wdKit/Index'; |
| 3 | import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | 3 | import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; |
| 4 | import { PlayUIComponent } from './PlayUIComponent'; | 4 | import { PlayUIComponent } from './PlayUIComponent'; |
| 5 | import { PictureLoading } from '../../vertical/PictureLoading'; | 5 | import { PictureLoading } from '../../vertical/PictureLoading'; |
| @@ -8,6 +8,8 @@ import { LiveDetailPageLogic } from '../../../viewModel/LiveDetailPageLogic'; | @@ -8,6 +8,8 @@ import { LiveDetailPageLogic } from '../../../viewModel/LiveDetailPageLogic'; | ||
| 8 | import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; | 8 | import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; |
| 9 | import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'; | 9 | import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'; |
| 10 | import { window } from '@kit.ArkUI'; | 10 | import { window } from '@kit.ArkUI'; |
| 11 | +import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg'; | ||
| 12 | +import { NoWifiTipComponent } from '../../common/NoWifiTipComponent'; | ||
| 11 | 13 | ||
| 12 | const TAG: string = 'TopPlayComponent' | 14 | const TAG: string = 'TopPlayComponent' |
| 13 | 15 | ||
| @@ -39,6 +41,7 @@ export struct TopPlayComponent { | @@ -39,6 +41,7 @@ export struct TopPlayComponent { | ||
| 39 | @Consume liveDetailPageLogic: LiveDetailPageLogic | 41 | @Consume liveDetailPageLogic: LiveDetailPageLogic |
| 40 | @Consume @Watch('pageShowChange') pageShow: number | 42 | @Consume @Watch('pageShowChange') pageShow: number |
| 41 | @Consume @Watch('pageHideChange') pageHide: number | 43 | @Consume @Watch('pageHideChange') pageHide: number |
| 44 | + @Consume topSafeHeight: number | ||
| 42 | init: boolean = false | 45 | init: boolean = false |
| 43 | @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息 | 46 | @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息 |
| 44 | ///是否是手动点击暂停,手动暂停的,页面重新出现时,不自动恢复播放 | 47 | ///是否是手动点击暂停,手动暂停的,页面重新出现时,不自动恢复播放 |
| @@ -48,6 +51,9 @@ export struct TopPlayComponent { | @@ -48,6 +51,9 @@ export struct TopPlayComponent { | ||
| 48 | @State isZDP: boolean = false // 是否折叠屏 默认false | 51 | @State isZDP: boolean = false // 是否折叠屏 默认false |
| 49 | @State windowWidth: number = AppStorage.get<number>('windowWidth') || 0 | 52 | @State windowWidth: number = AppStorage.get<number>('windowWidth') || 0 |
| 50 | 53 | ||
| 54 | + @State showNoWifiTip: boolean = false // 直播预告和直播回放 | ||
| 55 | + livingDialogToast?: CustomDialogController // 直播中 | ||
| 56 | + | ||
| 51 | pageShowChange() { | 57 | pageShowChange() { |
| 52 | if (this.manualClickPauseOrPlay) { | 58 | if (this.manualClickPauseOrPlay) { |
| 53 | return | 59 | return |
| @@ -60,7 +66,7 @@ export struct TopPlayComponent { | @@ -60,7 +66,7 @@ export struct TopPlayComponent { | ||
| 60 | this.playerController?.pause() | 66 | this.playerController?.pause() |
| 61 | } | 67 | } |
| 62 | 68 | ||
| 63 | - aboutToAppear(): void { | 69 | + aboutToAppear() { |
| 64 | if (this.playerController) { | 70 | if (this.playerController) { |
| 65 | 71 | ||
| 66 | this.playerController.onCanplay = () => { | 72 | this.playerController.onCanplay = () => { |
| @@ -85,6 +91,12 @@ export struct TopPlayComponent { | @@ -85,6 +91,12 @@ export struct TopPlayComponent { | ||
| 85 | } | 91 | } |
| 86 | 92 | ||
| 87 | } | 93 | } |
| 94 | + | ||
| 95 | + this.playerController.onFirstFrameDisplay = () => { | ||
| 96 | + if (this.showNoWifiTip) { | ||
| 97 | + this.playerController?.pause() | ||
| 98 | + } | ||
| 99 | + } | ||
| 88 | } | 100 | } |
| 89 | this.updateData() | 101 | this.updateData() |
| 90 | 102 | ||
| @@ -94,6 +106,33 @@ export struct TopPlayComponent { | @@ -94,6 +106,33 @@ export struct TopPlayComponent { | ||
| 94 | // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 | 106 | // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 |
| 95 | this.isZDP = this.screenWidth > 2000 ? true : false | 107 | this.isZDP = this.screenWidth > 2000 ? true : false |
| 96 | this.resizeWindow() | 108 | this.resizeWindow() |
| 109 | + | ||
| 110 | + if (this.liveDetailPageLogic.livingNeedShowNoWifiTip()) { | ||
| 111 | + this.livingDialogToast = new CustomDialogController({ | ||
| 112 | + builder: CustomToast({ | ||
| 113 | + bgColor: 0xB3000000, | ||
| 114 | + opacityValue: 1, | ||
| 115 | + fontSizeValue: "25lpx", | ||
| 116 | + lineHeightValue: "36lpx", | ||
| 117 | + msg: "正在使用非Wi-Fi网络,播放将产生流量费用", | ||
| 118 | + marginTop:211/2+px2vp(this.topSafeHeight)-px2vp(84/2) | ||
| 119 | + }), | ||
| 120 | + autoCancel: false, | ||
| 121 | + alignment: DialogAlignment.Top, | ||
| 122 | + customStyle: true, | ||
| 123 | + maskColor: "#00000000" | ||
| 124 | + }) | ||
| 125 | + this.livingDialogToast.open() | ||
| 126 | + } else if (this.liveDetailPageLogic.noLivingNeedShowNoWifiTip()) { | ||
| 127 | + onlyWifiLoadVideo().then((onlyWifiLoadVideo) => { | ||
| 128 | + if (!onlyWifiLoadVideo) { | ||
| 129 | + this.showNoWifiTip = true | ||
| 130 | + if (this.playerController?.getStatus() == PlayerConstants.STATUS_START) { | ||
| 131 | + this.playerController?.pause() | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + }) | ||
| 135 | + } | ||
| 97 | } | 136 | } |
| 98 | 137 | ||
| 99 | resizeWindow() { | 138 | resizeWindow() { |
| @@ -344,6 +383,16 @@ export struct TopPlayComponent { | @@ -344,6 +383,16 @@ export struct TopPlayComponent { | ||
| 344 | Visibility.None) | 383 | Visibility.None) |
| 345 | .margin({top:40}) | 384 | .margin({top:40}) |
| 346 | 385 | ||
| 386 | + if (this.showNoWifiTip) { | ||
| 387 | + NoWifiTipComponent({ | ||
| 388 | + onContinue: () => { | ||
| 389 | + this.showNoWifiTip = false | ||
| 390 | + if (this.playerController?.getStatus() == PlayerConstants.STATUS_PAUSE) { | ||
| 391 | + this.playerController?.play() | ||
| 392 | + } | ||
| 393 | + } | ||
| 394 | + }) | ||
| 395 | + } | ||
| 347 | } | 396 | } |
| 348 | .width('100%') | 397 | .width('100%') |
| 349 | .alignSelf(ItemAlign.Center) | 398 | .alignSelf(ItemAlign.Center) |
| @@ -46,8 +46,10 @@ export struct DetailPlayShortVideoPage { | @@ -46,8 +46,10 @@ export struct DetailPlayShortVideoPage { | ||
| 46 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean | 46 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean |
| 47 | @State isPlay: boolean = true // 视频手动播放暂停 | 47 | @State isPlay: boolean = true // 视频手动播放暂停 |
| 48 | @Consume @Watch('pageShowChange') pageShow: number | 48 | @Consume @Watch('pageShowChange') pageShow: number |
| 49 | - @Consume windowWidth: number | ||
| 50 | - @Consume windowHeight: number | 49 | + // @Consume windowWidth: number |
| 50 | + @State windowWidth: number = WindowModel.shared.getWindowClass().getWindowProperties()?.windowRect.width | ||
| 51 | + // @Consume windowHeight: number | ||
| 52 | + @State windowHeight: number = WindowModel.shared.getWindowClass().getWindowProperties()?.windowRect.height | ||
| 51 | @Consume topSafeHeight: number | 53 | @Consume topSafeHeight: number |
| 52 | @Consume showComment: boolean // 是否显示底部评论,首页视频频道传false | 54 | @Consume showComment: boolean // 是否显示底部评论,首页视频频道传false |
| 53 | @State imageVisible: boolean = true | 55 | @State imageVisible: boolean = true |
-
Please register or login to post a comment