Showing
12 changed files
with
85 additions
and
91 deletions
| @@ -328,6 +328,7 @@ export struct DynamicDetailComponent { | @@ -328,6 +328,7 @@ export struct DynamicDetailComponent { | ||
| 328 | .margin({ left: $r('app.float.margin_2')}) | 328 | .margin({ left: $r('app.float.margin_2')}) |
| 329 | } | 329 | } |
| 330 | .margin({top:$r('app.float.margin_16')}) | 330 | .margin({top:$r('app.float.margin_16')}) |
| 331 | + Blank().layoutWeight(1) | ||
| 331 | //fixme 评论组件 | 332 | //fixme 评论组件 |
| 332 | } | 333 | } |
| 333 | } | 334 | } |
| @@ -12,7 +12,7 @@ export struct MultiPictureDetailItemComponent { | @@ -12,7 +12,7 @@ export struct MultiPictureDetailItemComponent { | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | async aboutToAppear() { | 14 | async aboutToAppear() { |
| 15 | - Logger.info(TAG, 'pictures preview') | 15 | + // Logger.info(TAG, 'pictures preview') |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | build() { | 18 | build() { |
| 1 | -import { Logger, SPHelper } from 'wdKit'; | 1 | +import { |
| 2 | + NetworkUtil, | ||
| 3 | + Logger, | ||
| 4 | + NetworkType, | ||
| 5 | + SPHelper, | ||
| 6 | +} from 'wdKit'; | ||
| 2 | import { ResponseDTO } from 'wdNetwork'; | 7 | import { ResponseDTO } from 'wdNetwork'; |
| 3 | import { | 8 | import { |
| 4 | ContentDetailDTO, | 9 | ContentDetailDTO, |
| @@ -61,7 +66,15 @@ export struct MultiPictureDetailPageComponent { | @@ -61,7 +66,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 61 | familyName: 'BebasNeue_Regular', | 66 | familyName: 'BebasNeue_Regular', |
| 62 | familySrc: $rawfile('font/BebasNeue_Regular.otf') | 67 | familySrc: $rawfile('font/BebasNeue_Regular.otf') |
| 63 | }) | 68 | }) |
| 69 | + // 注册监听网络连接 | ||
| 70 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 71 | + if(netStatus) { | ||
| 72 | + // 有网络 | ||
| 64 | this.getContentDetailData() | 73 | this.getContentDetailData() |
| 74 | + } else { | ||
| 75 | + // 无网络 | ||
| 76 | + this.netStatus = 1 | ||
| 77 | + } | ||
| 65 | } | 78 | } |
| 66 | 79 | ||
| 67 | aboutToDisappear() { | 80 | aboutToDisappear() { |
| @@ -73,7 +86,7 @@ export struct MultiPictureDetailPageComponent { | @@ -73,7 +86,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 73 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { | 86 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { |
| 74 | Swiper(this.swiperController) { | 87 | Swiper(this.swiperController) { |
| 75 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { | 88 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { |
| 76 | - Swiper(this.swiperController) { | 89 | + Swiper(this.swiperControllerItem) { |
| 77 | MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 90 | MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) |
| 78 | } | 91 | } |
| 79 | .width('100%') | 92 | .width('100%') |
| @@ -256,16 +269,15 @@ export struct MultiPictureDetailPageComponent { | @@ -256,16 +269,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 256 | }) | 269 | }) |
| 257 | .height(px2vp(this.titleHeight) + 64) | 270 | .height(px2vp(this.titleHeight) + 64) |
| 258 | 271 | ||
| 259 | - } else { | 272 | + } |
| 260 | if(this.netStatus !== undefined) { | 273 | if(this.netStatus !== undefined) { |
| 261 | - EmptyComponent({ emptyType: this.netStatus}) | 274 | + EmptyComponent({ emptyType: $netStatus, emptyButton:true, retry: () => {this.getContentDetailData()}}) |
| 262 | .id('e_empty_content') | 275 | .id('e_empty_content') |
| 263 | .alignRules({ | 276 | .alignRules({ |
| 264 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 277 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 265 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 278 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 266 | }) | 279 | }) |
| 267 | } | 280 | } |
| 268 | - } | ||
| 269 | OperRowListView({ | 281 | OperRowListView({ |
| 270 | contentDetailData: this.contentDetailData, | 282 | contentDetailData: this.contentDetailData, |
| 271 | }) | 283 | }) |
| @@ -293,12 +305,9 @@ export struct MultiPictureDetailPageComponent { | @@ -293,12 +305,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 293 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 305 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 294 | } | 306 | } |
| 295 | 307 | ||
| 296 | - private getContentDetailData() { | 308 | + getContentDetailData() { |
| 297 | try { | 309 | try { |
| 298 | - PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 299 | - // Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`); | ||
| 300 | - // Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`); | ||
| 301 | - // Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`); | 310 | + PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { |
| 302 | if (!resDTO || !resDTO.data) { | 311 | if (!resDTO || !resDTO.data) { |
| 303 | Logger.error(TAG, 'fetchDetailData is empty'); | 312 | Logger.error(TAG, 'fetchDetailData is empty'); |
| 304 | return | 313 | return |
| @@ -307,29 +316,25 @@ export struct MultiPictureDetailPageComponent { | @@ -307,29 +316,25 @@ export struct MultiPictureDetailPageComponent { | ||
| 307 | Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | 316 | Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); |
| 308 | return | 317 | return |
| 309 | } | 318 | } |
| 319 | + this.netStatus = undefined | ||
| 310 | this.contentDetailData = resDTO.data?.[0]; | 320 | this.contentDetailData = resDTO.data?.[0]; |
| 321 | + // this.contentDetailData.photoList = [] | ||
| 311 | if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 322 | if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| 323 | + // 暂无内容 | ||
| 312 | this.netStatus = 0 | 324 | this.netStatus = 0 |
| 325 | + Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) | ||
| 313 | } | 326 | } |
| 314 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | 327 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) |
| 315 | - if (HttpUrlUtils.getUserId()) { | 328 | + // 未登录,跳转登录 |
| 329 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 330 | + if (user_id) { | ||
| 316 | this.getInteractBrowsOperate() | 331 | this.getInteractBrowsOperate() |
| 317 | this.getBatchAttentionStatus() | 332 | this.getBatchAttentionStatus() |
| 318 | } | 333 | } |
| 319 | }).catch((err: Error) => { | 334 | }).catch((err: Error) => { |
| 320 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | 335 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); |
| 321 | - /*// 请求失败处理 | ||
| 322 | - if (err.response) { | ||
| 323 | - // 请求已发出,但服务器响应的状态码不在2xx范围内 | ||
| 324 | - console.error('请求失败,状态码:', err.response.status); | ||
| 325 | - console.error('响应数据:', err.response.data); | ||
| 326 | - } else if (err.request) { | ||
| 327 | - // 请求已发出,但无响应(例如:网络故障) | ||
| 328 | - console.error('请求已发出,但无响应:', err.request); | ||
| 329 | - } else { | ||
| 330 | - // 发生了其他类型的错误(如配置错误或拒绝权限等) | ||
| 331 | - console.error('请求发生错误:', err.message); | ||
| 332 | - }*/ | 336 | + // 内容获取失败 |
| 337 | + this.netStatus = 9 | ||
| 333 | }) | 338 | }) |
| 334 | } catch (exception) { | 339 | } catch (exception) { |
| 335 | 340 |
| @@ -52,7 +52,7 @@ export struct EmptyComponent { | @@ -52,7 +52,7 @@ export struct EmptyComponent { | ||
| 52 | // private emptySize: SizeOptions = {}; | 52 | // private emptySize: SizeOptions = {}; |
| 53 | @State emptyWidth: string | number = CommonConstants.FULL_PARENT; | 53 | @State emptyWidth: string | number = CommonConstants.FULL_PARENT; |
| 54 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; | 54 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; |
| 55 | - @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; | 55 | + @Link emptyType: number |
| 56 | @State emptyButton: boolean = false | 56 | @State emptyButton: boolean = false |
| 57 | @State timeNum: number = 10 | 57 | @State timeNum: number = 10 |
| 58 | /** | 58 | /** |
| @@ -121,35 +121,6 @@ export struct LiveHorizontalCardComponent { | @@ -121,35 +121,6 @@ export struct LiveHorizontalCardComponent { | ||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | async gotoLive(content: ContentDTO) { | 123 | async gotoLive(content: ContentDTO) { |
| 124 | - const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 125 | - if (content && content.objectType) { | ||
| 126 | - if (content.objectType === ContentConstants.TYPE_LIVE) { | ||
| 127 | - if (liveDetail && liveDetail[0] && liveDetail[0].liveInfo) { | ||
| 128 | - const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 129 | - const liveState = liveDetail[0].liveInfo.liveState | ||
| 130 | - | ||
| 131 | - console.error('liveDetail===', liveDetail) | ||
| 132 | - | ||
| 133 | - let taskAction: Action = { | ||
| 134 | - type: 'JUMP_DETAIL_PAGE', | ||
| 135 | - params: { | ||
| 136 | - detailPageType: 2, | ||
| 137 | - contentID: content?.objectId, | ||
| 138 | - liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 139 | - extra: { | ||
| 140 | - relType: content?.relType, | ||
| 141 | - relId: content?.relId, | ||
| 142 | - } as ExtraDTO | ||
| 143 | - } as Params, | ||
| 144 | - }; | ||
| 145 | - WDRouterRule.jumpWithAction(taskAction) | ||
| 146 | - // Logger.debug(TAG, `gotoLive, ${content.objectId}`); | ||
| 147 | - } | ||
| 148 | - } else if (content.objectType === ContentConstants.TYPE_TELETEXT) { | ||
| 149 | ProcessUtils.processPage(content) | 124 | ProcessUtils.processPage(content) |
| 150 | } | 125 | } |
| 151 | - } | ||
| 152 | - | ||
| 153 | - | ||
| 154 | - } | ||
| 155 | } | 126 | } |
| @@ -113,6 +113,7 @@ export struct AudioDialog { | @@ -113,6 +113,7 @@ export struct AudioDialog { | ||
| 113 | if (this.playerController) { | 113 | if (this.playerController) { |
| 114 | // this.onConfirm() | 114 | // this.onConfirm() |
| 115 | this.playerController.switchPlayOrPause() | 115 | this.playerController.switchPlayOrPause() |
| 116 | + this.AudioSuspension.playerController.get().switchPlayOrPause() | ||
| 116 | this.currentStatus = this.playerController.getStatus() | 117 | this.currentStatus = this.playerController.getStatus() |
| 117 | } | 118 | } |
| 118 | }) | 119 | }) |
| @@ -5,6 +5,8 @@ import router from '@ohos.router'; | @@ -5,6 +5,8 @@ import router from '@ohos.router'; | ||
| 5 | import { DetailPlayLivePage } from './DetailPlayLivePage' | 5 | import { DetailPlayLivePage } from './DetailPlayLivePage' |
| 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage' | 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage' |
| 7 | 7 | ||
| 8 | +const TAG = 'DetailPlayLiveCommon' | ||
| 9 | + | ||
| 8 | @Entry() | 10 | @Entry() |
| 9 | @Component | 11 | @Component |
| 10 | export struct DetailPlayLiveCommon { | 12 | export struct DetailPlayLiveCommon { |
| @@ -47,7 +49,7 @@ export struct DetailPlayLiveCommon { | @@ -47,7 +49,7 @@ export struct DetailPlayLiveCommon { | ||
| 47 | this.liveDetailsBean = data[0] | 49 | this.liveDetailsBean = data[0] |
| 48 | this.liveState = this.liveDetailsBean.liveInfo?.liveState | 50 | this.liveState = this.liveDetailsBean.liveInfo?.liveState |
| 49 | this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle | 51 | this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle |
| 50 | - console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) | 52 | + console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean))) |
| 51 | } | 53 | } |
| 52 | }, | 54 | }, |
| 53 | () => { | 55 | () => { |
| @@ -8,11 +8,11 @@ import { WDPlayerController } from 'wdPlayer/Index'; | @@ -8,11 +8,11 @@ import { WDPlayerController } from 'wdPlayer/Index'; | ||
| 8 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 9 | 9 | ||
| 10 | const storage = LocalStorage.getShared(); | 10 | const storage = LocalStorage.getShared(); |
| 11 | +const TAG = 'DetailPlayVLivePage' | ||
| 11 | 12 | ||
| 12 | @Entry(storage) | 13 | @Entry(storage) |
| 13 | @Component | 14 | @Component |
| 14 | export struct DetailPlayVLivePage { | 15 | export struct DetailPlayVLivePage { |
| 15 | - TAG: string = 'DetailPlayVLivePage'; | ||
| 16 | private liveViewModel: LiveViewModel = new LiveViewModel() | 16 | private liveViewModel: LiveViewModel = new LiveViewModel() |
| 17 | private playerController: WDPlayerController = new WDPlayerController(); | 17 | private playerController: WDPlayerController = new WDPlayerController(); |
| 18 | private swiperController: SwiperController = new SwiperController() | 18 | private swiperController: SwiperController = new SwiperController() |
| @@ -29,6 +29,7 @@ export struct DetailPlayVLivePage { | @@ -29,6 +29,7 @@ export struct DetailPlayVLivePage { | ||
| 29 | @State swiperIndex: number = 1 | 29 | @State swiperIndex: number = 1 |
| 30 | 30 | ||
| 31 | aboutToAppear(): void { | 31 | aboutToAppear(): void { |
| 32 | + console.log(TAG, 'aboutToAppear') | ||
| 32 | WindowModel.shared.setWindowLayoutFullScreen(true) | 33 | WindowModel.shared.setWindowLayoutFullScreen(true) |
| 33 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | 34 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) |
| 34 | 35 | ||
| @@ -86,11 +87,11 @@ export struct DetailPlayVLivePage { | @@ -86,11 +87,11 @@ export struct DetailPlayVLivePage { | ||
| 86 | if (data.length > 0) { | 87 | if (data.length > 0) { |
| 87 | this.liveDetailsBean = data[0] | 88 | this.liveDetailsBean = data[0] |
| 88 | this.liveState = this.liveDetailsBean.liveInfo?.liveState | 89 | this.liveState = this.liveDetailsBean.liveInfo?.liveState |
| 89 | - console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) | 90 | + console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean))) |
| 90 | } | 91 | } |
| 91 | }, | 92 | }, |
| 92 | - () => { | ||
| 93 | - | 93 | + (message: string) => { |
| 94 | + console.error(TAG, 'getLiveDetails catch', message) | ||
| 94 | }) | 95 | }) |
| 95 | } | 96 | } |
| 96 | 97 | ||
| @@ -99,9 +100,10 @@ export struct DetailPlayVLivePage { | @@ -99,9 +100,10 @@ export struct DetailPlayVLivePage { | ||
| 99 | .then( | 100 | .then( |
| 100 | (data) => { | 101 | (data) => { |
| 101 | this.liveRoomDataBean = data | 102 | this.liveRoomDataBean = data |
| 103 | + console.log(TAG, 'getLiveRoomData', JSON.stringify((this.liveRoomDataBean))) | ||
| 102 | }, | 104 | }, |
| 103 | - () => { | ||
| 104 | - | 105 | + (message: string) => { |
| 106 | + console.error(TAG, 'getLiveDetails catch', message) | ||
| 105 | }) | 107 | }) |
| 106 | } | 108 | } |
| 107 | } | 109 | } |
| @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index'; | @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index'; | ||
| 2 | import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; | 2 | import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; |
| 3 | import componentUtils from '@ohos.arkui.componentUtils'; | 3 | import componentUtils from '@ohos.arkui.componentUtils'; |
| 4 | 4 | ||
| 5 | +const TAG = 'PlayerComponent' | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export struct PlayerComponent { | 8 | export struct PlayerComponent { |
| @@ -16,6 +17,7 @@ export struct PlayerComponent { | @@ -16,6 +17,7 @@ export struct PlayerComponent { | ||
| 16 | @State playUrl: string = '' | 17 | @State playUrl: string = '' |
| 17 | 18 | ||
| 18 | aboutToAppear(): void { | 19 | aboutToAppear(): void { |
| 20 | + console.log(TAG, 'aboutToAppear') | ||
| 19 | if (this.playerController) { | 21 | if (this.playerController) { |
| 20 | this.playerController.onCanplay = () => { | 22 | this.playerController.onCanplay = () => { |
| 21 | console.log('可以播放了') | 23 | console.log('可以播放了') |
| @@ -33,7 +35,6 @@ export struct PlayerComponent { | @@ -33,7 +35,6 @@ export struct PlayerComponent { | ||
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | updateData() { | 37 | updateData() { |
| 36 | - console.error('updateData=============') | ||
| 37 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 38 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 38 | if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { | 39 | if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { |
| 39 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url | 40 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url |
| @@ -32,21 +32,34 @@ export struct DetailPlayShortVideoPage { | @@ -32,21 +32,34 @@ export struct DetailPlayShortVideoPage { | ||
| 32 | @Provide followStatus: string = '0' // 关注状态 | 32 | @Provide followStatus: string = '0' // 关注状态 |
| 33 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 | 33 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 |
| 34 | @Provide isDragging: boolean = false // 拖动时间进度条 | 34 | @Provide isDragging: boolean = false // 拖动时间进度条 |
| 35 | + @Consume @Watch('videoStatusChange') switchVideoStatus: boolean | ||
| 35 | @Consume @Watch('pageShowChange') pageShow: number | 36 | @Consume @Watch('pageShowChange') pageShow: number |
| 36 | - @Consume @Watch('pageHideChange') pageHide: number | ||
| 37 | 37 | ||
| 38 | + /** | ||
| 39 | + * 页面显示重查用户关注、点赞等信息 | ||
| 40 | + */ | ||
| 38 | pageShowChange() { | 41 | pageShowChange() { |
| 39 | - if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_PAUSE) { | ||
| 40 | - this.playerController.play() | 42 | + if (this.currentIndex === this.index) { |
| 41 | this.queryNewsInfoOfUser() | 43 | this.queryNewsInfoOfUser() |
| 44 | + if (this.switchVideoStatus) { | ||
| 45 | + this.playerController.play() | ||
| 46 | + } | ||
| 42 | } | 47 | } |
| 43 | } | 48 | } |
| 44 | 49 | ||
| 45 | - pageHideChange() { | ||
| 46 | - if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_START) { | 50 | + /** |
| 51 | + * 频道切换视频暂停、播放 | ||
| 52 | + * 页面显隐视频暂停、播放 | ||
| 53 | + */ | ||
| 54 | + videoStatusChange() { | ||
| 55 | + if (this.currentIndex === this.index) { | ||
| 56 | + if (this.switchVideoStatus) { | ||
| 57 | + this.playerController.play() | ||
| 58 | + } else { | ||
| 47 | this.playerController.pause() | 59 | this.playerController.pause() |
| 48 | } | 60 | } |
| 49 | } | 61 | } |
| 62 | + } | ||
| 50 | 63 | ||
| 51 | /** | 64 | /** |
| 52 | * 监听下标变化手动创建或销毁视频 | 65 | * 监听下标变化手动创建或销毁视频 |
| @@ -22,12 +22,12 @@ export struct DetailVideoListPage { | @@ -22,12 +22,12 @@ export struct DetailVideoListPage { | ||
| 22 | @Provide showComment: boolean = true | 22 | @Provide showComment: boolean = true |
| 23 | @Provide pageShow: number = -1 | 23 | @Provide pageShow: number = -1 |
| 24 | @Provide pageHide: number = -1 | 24 | @Provide pageHide: number = -1 |
| 25 | + @Provide switchVideoStatus: boolean = false | ||
| 25 | @State data: ContentDetailDTO[] = [] | 26 | @State data: ContentDetailDTO[] = [] |
| 26 | @State testData: string[] = ['111', '222', '333'] | 27 | @State testData: string[] = ['111', '222', '333'] |
| 27 | @State currentIndex: number = 0 | 28 | @State currentIndex: number = 0 |
| 28 | @State interactDataList: InteractDataDTO[] = [] | 29 | @State interactDataList: InteractDataDTO[] = [] |
| 29 | @State isFullScreen: boolean = false | 30 | @State isFullScreen: boolean = false |
| 30 | - @State switchVideoStatus: boolean = false | ||
| 31 | 31 | ||
| 32 | async aboutToAppear(): Promise<void> { | 32 | async aboutToAppear(): Promise<void> { |
| 33 | this.openFullScreen() | 33 | this.openFullScreen() |
| @@ -57,13 +57,14 @@ export struct DetailVideoListPage { | @@ -57,13 +57,14 @@ export struct DetailVideoListPage { | ||
| 57 | onPageShow(): void { | 57 | onPageShow(): void { |
| 58 | console.log(TAG, 'onPageShow') | 58 | console.log(TAG, 'onPageShow') |
| 59 | this.pageShow = Math.random() | 59 | this.pageShow = Math.random() |
| 60 | + this.switchVideoStatus = true | ||
| 60 | this.openFullScreen() | 61 | this.openFullScreen() |
| 61 | 62 | ||
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | onPageHide(): void { | 65 | onPageHide(): void { |
| 65 | console.log(TAG, 'onPageHide') | 66 | console.log(TAG, 'onPageHide') |
| 66 | - this.pageHide = Math.random() | 67 | + this.switchVideoStatus = false |
| 67 | this.closeFullScreen() | 68 | this.closeFullScreen() |
| 68 | } | 69 | } |
| 69 | 70 |
| @@ -46,36 +46,43 @@ export struct VideoChannelDetail { | @@ -46,36 +46,43 @@ export struct VideoChannelDetail { | ||
| 46 | private swiperController: SwiperController = new SwiperController() | 46 | private swiperController: SwiperController = new SwiperController() |
| 47 | @Provide showComment: boolean = false | 47 | @Provide showComment: boolean = false |
| 48 | @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0 | 48 | @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0 |
| 49 | + @Consume @Watch('pageShowChange') pageShow: number | ||
| 50 | + @Consume @Watch('pageHideChange') pageHide: number | ||
| 51 | + @Provide switchVideoStatus: boolean = false | ||
| 49 | @State data: ContentDetailDTO[] = [] | 52 | @State data: ContentDetailDTO[] = [] |
| 50 | @State currentIndex: number = 0 | 53 | @State currentIndex: number = 0 |
| 51 | @State interactDataList: InteractDataDTO[] = [] | 54 | @State interactDataList: InteractDataDTO[] = [] |
| 52 | @State totalCount: number = 0 | 55 | @State totalCount: number = 0 |
| 53 | - @State switchVideoStatus: boolean = false | ||
| 54 | @State isMouted: boolean = false | 56 | @State isMouted: boolean = false |
| 55 | 57 | ||
| 58 | + pageShowChange() { | ||
| 59 | + if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { | ||
| 60 | + this.barBackgroundColor = Color.Black | ||
| 61 | + this.switchVideoStatus = true | ||
| 62 | + this.openFullScreen() | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + pageHideChange() { | ||
| 67 | + this.barBackgroundColor = Color.Transparent | ||
| 68 | + this.switchVideoStatus = false | ||
| 69 | + this.closeFullScreen() | ||
| 70 | + } | ||
| 71 | + | ||
| 56 | /** | 72 | /** |
| 57 | * 监听视频频道激活或失活 | 73 | * 监听视频频道激活或失活 |
| 58 | */ | 74 | */ |
| 59 | navIndexChange() { | 75 | navIndexChange() { |
| 60 | - // if (timer) clearTimeout(timer) | ||
| 61 | console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex) | 76 | console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex) |
| 62 | - // timer = setTimeout(() => { | ||
| 63 | - | ||
| 64 | if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { | 77 | if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { |
| 65 | - // 如果视频在暂停则播放视频 | ||
| 66 | - this.switchVideoStatus = true | ||
| 67 | this.barBackgroundColor = Color.Black | 78 | this.barBackgroundColor = Color.Black |
| 79 | + this.switchVideoStatus = true | ||
| 68 | this.openFullScreen() | 80 | this.openFullScreen() |
| 69 | } else { | 81 | } else { |
| 70 | - // 如果视频在播放则暂停视频 | ||
| 71 | - this.switchVideoStatus = false | ||
| 72 | this.barBackgroundColor = Color.Transparent | 82 | this.barBackgroundColor = Color.Transparent |
| 83 | + this.switchVideoStatus = false | ||
| 73 | this.closeFullScreen() | 84 | this.closeFullScreen() |
| 74 | } | 85 | } |
| 75 | - // timer = -1 | ||
| 76 | - // }, 100) | ||
| 77 | - | ||
| 78 | - | ||
| 79 | } | 86 | } |
| 80 | 87 | ||
| 81 | aboutToAppear() { | 88 | aboutToAppear() { |
| @@ -90,16 +97,6 @@ export struct VideoChannelDetail { | @@ -90,16 +97,6 @@ export struct VideoChannelDetail { | ||
| 90 | Logger.info(TAG, 'aboutToDisappear'); | 97 | Logger.info(TAG, 'aboutToDisappear'); |
| 91 | } | 98 | } |
| 92 | 99 | ||
| 93 | - onPageShow(): void { | ||
| 94 | - this.openFullScreen() | ||
| 95 | - Logger.info(TAG, 'onPageShow'); | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - onPageHide(): void { | ||
| 99 | - this.closeFullScreen() | ||
| 100 | - Logger.info(TAG, 'onPageHide'); | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | /** | 100 | /** |
| 104 | * 开启沉浸式 | 101 | * 开启沉浸式 |
| 105 | * TODO:颜色待根据业务接口修改 | 102 | * TODO:颜色待根据业务接口修改 |
-
Please register or login to post a comment