Showing
3 changed files
with
28 additions
and
3 deletions
| @@ -41,7 +41,7 @@ export struct PageComponent { | @@ -41,7 +41,7 @@ export struct PageComponent { | ||
| 41 | private pageTrackBean: PageTrackBean = new PageTrackBean() | 41 | private pageTrackBean: PageTrackBean = new PageTrackBean() |
| 42 | // 国殇灰度管理 | 42 | // 国殇灰度管理 |
| 43 | GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | 43 | GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') |
| 44 | - @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | 44 | + @State netStatus: number | undefined = undefined // 存储网络状态 |
| 45 | 45 | ||
| 46 | build() { | 46 | build() { |
| 47 | Column() { | 47 | Column() { |
| @@ -8,7 +8,7 @@ import { | @@ -8,7 +8,7 @@ import { | ||
| 8 | postInteractBrowsOperateParams | 8 | postInteractBrowsOperateParams |
| 9 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 9 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 10 | import { HttpUtils } from 'wdNetwork/Index'; | 10 | import { HttpUtils } from 'wdNetwork/Index'; |
| 11 | -import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger, WindowModel } from 'wdKit/Index'; | 11 | +import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger, NetworkType, WindowModel } from 'wdKit/Index'; |
| 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; | 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; |
| 13 | import { PlayerRightView } from '../view/PlayerRightView'; | 13 | import { PlayerRightView } from '../view/PlayerRightView'; |
| 14 | import { DisplayDirection } from 'wdConstant/Index'; | 14 | import { DisplayDirection } from 'wdConstant/Index'; |
| @@ -61,6 +61,7 @@ export struct DetailPlayShortVideoPage { | @@ -61,6 +61,7 @@ export struct DetailPlayShortVideoPage { | ||
| 61 | @Consume toastTextVisible: boolean | 61 | @Consume toastTextVisible: boolean |
| 62 | @StorageProp('currentBreakpoint') @Watch("currentChanged") currentBreakpoint: string = 'sm'; | 62 | @StorageProp('currentBreakpoint') @Watch("currentChanged") currentBreakpoint: string = 'sm'; |
| 63 | @State isPad: boolean = this.currentBreakpoint == "md" || this.currentBreakpoint == "lg" ? true : false | 63 | @State isPad: boolean = this.currentBreakpoint == "md" || this.currentBreakpoint == "lg" ? true : false |
| 64 | + @State timer: number = -1 | ||
| 64 | 65 | ||
| 65 | currentChanged() { | 66 | currentChanged() { |
| 66 | if (this.currentBreakpoint == "md" || this.currentBreakpoint == "lg") { | 67 | if (this.currentBreakpoint == "md" || this.currentBreakpoint == "lg") { |
| @@ -230,6 +231,24 @@ export struct DetailPlayShortVideoPage { | @@ -230,6 +231,24 @@ export struct DetailPlayShortVideoPage { | ||
| 230 | 231 | ||
| 231 | ///解决初始化竖屏视频时 this.ratio未更新导致显示错误 | 232 | ///解决初始化竖屏视频时 this.ratio未更新导致显示错误 |
| 232 | this.calculatePlayerRect() | 233 | this.calculatePlayerRect() |
| 234 | + | ||
| 235 | + // 注册监听网络连接 | ||
| 236 | + EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, (async (str?: string) => { | ||
| 237 | + if (this.timer) { | ||
| 238 | + clearTimeout(this.timer) | ||
| 239 | + } | ||
| 240 | + this.timer = setTimeout(() => { | ||
| 241 | + let type: NetworkType | null = null | ||
| 242 | + if (str) { | ||
| 243 | + type = JSON.parse(str) as NetworkType | ||
| 244 | + } | ||
| 245 | + // 注册监听网络连接 | ||
| 246 | + if (this.currentIndex === this.index && type != NetworkType.TYPE_UNKNOWN) { | ||
| 247 | + console.log(TAG, '网络连接状态变化', type, 'this.currentIndex', this.currentIndex, 'this.index', this.index) | ||
| 248 | + this.currentIndexChange() | ||
| 249 | + } | ||
| 250 | + }, 1000) | ||
| 251 | + })) | ||
| 233 | } | 252 | } |
| 234 | 253 | ||
| 235 | contentTrackingDict() { | 254 | contentTrackingDict() { |
| 1 | import { ContentDetailDTO } from 'wdBean/Index'; | 1 | import { ContentDetailDTO } from 'wdBean/Index'; |
| 2 | -import { DateTimeUtils, ToastUtils } from 'wdKit/Index'; | 2 | +import { DateTimeUtils, EmitterEventId, EmitterUtils, ToastUtils } from 'wdKit/Index'; |
| 3 | import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'; | 3 | import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'; |
| 4 | 4 | ||
| 5 | @Reusable | 5 | @Reusable |
| @@ -49,6 +49,12 @@ export struct PlayerProgressView { | @@ -49,6 +49,12 @@ export struct PlayerProgressView { | ||
| 49 | this.playerController?.play() | 49 | this.playerController?.play() |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | + // 注册监听网络连接 | ||
| 53 | + EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, (async (str?: string) => { | ||
| 54 | + if (this.timer) { | ||
| 55 | + clearTimeout(this.timer) | ||
| 56 | + } | ||
| 57 | + })) | ||
| 52 | } | 58 | } |
| 53 | 59 | ||
| 54 | /** | 60 | /** |
-
Please register or login to post a comment