Showing
3 changed files
with
21 additions
and
22 deletions
| @@ -33,7 +33,6 @@ export struct WdWebLocalComponent { | @@ -33,7 +33,6 @@ export struct WdWebLocalComponent { | ||
| 33 | @State progressOpacity: number = 1 | 33 | @State progressOpacity: number = 1 |
| 34 | @State durationStringTime: string = ''; | 34 | @State durationStringTime: string = ''; |
| 35 | private progressTimerNumber: number = 0 | 35 | private progressTimerNumber: number = 0 |
| 36 | - private webIsLoaded:boolean = false | ||
| 37 | @State isPause: boolean = true; | 36 | @State isPause: boolean = true; |
| 38 | controller: VideoController = new VideoController() | 37 | controller: VideoController = new VideoController() |
| 39 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | 38 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; |
| @@ -41,6 +40,10 @@ export struct WdWebLocalComponent { | @@ -41,6 +40,10 @@ export struct WdWebLocalComponent { | ||
| 41 | @State isFullScreen: boolean = false; | 40 | @State isFullScreen: boolean = false; |
| 42 | @State isEndPlay: boolean = false; | 41 | @State isEndPlay: boolean = false; |
| 43 | @State mode: CacheMode = CacheMode.None; | 42 | @State mode: CacheMode = CacheMode.None; |
| 43 | + | ||
| 44 | + @Consume @Watch('pageShowForUpdateData') pageShow :number | ||
| 45 | + @Consume @Watch('pageHideForUpdateData') pageHide :number | ||
| 46 | + | ||
| 44 | currentChanged(){ | 47 | currentChanged(){ |
| 45 | ///折叠屏转换 暂停播放器 | 48 | ///折叠屏转换 暂停播放器 |
| 46 | this.controller.pause() | 49 | this.controller.pause() |
| @@ -51,6 +54,22 @@ export struct WdWebLocalComponent { | @@ -51,6 +54,22 @@ export struct WdWebLocalComponent { | ||
| 51 | this.webviewControl.refresh() | 54 | this.webviewControl.refresh() |
| 52 | } | 55 | } |
| 53 | 56 | ||
| 57 | + pageShowForUpdateData(){ | ||
| 58 | + | ||
| 59 | + Logger.debug(TAG, 'APP_PAGE_SHOW'+this.isPageEnd); | ||
| 60 | + let params = {'event':NativeCallH5Event.NativeCallH5EventPageWillAppear} as eventParams; | ||
| 61 | + let jsonString = JSON.stringify(params); | ||
| 62 | + if (this.isPageEnd) { | ||
| 63 | + this.webviewControl.callHandle(NativeCallH5Type.jsCall_appNotifyEvent, jsonString, (data: string) => { | ||
| 64 | + Logger.debug(TAG, "from js data = " + data); | ||
| 65 | + }) | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + pageHideForUpdateData(){ | ||
| 70 | + | ||
| 71 | + } | ||
| 72 | + | ||
| 54 | build() { | 73 | build() { |
| 55 | Column() { | 74 | Column() { |
| 56 | Row() { | 75 | Row() { |
| @@ -198,8 +217,8 @@ export struct WdWebLocalComponent { | @@ -198,8 +217,8 @@ export struct WdWebLocalComponent { | ||
| 198 | Logger.debug(TAG, 'onPageEnd'); | 217 | Logger.debug(TAG, 'onPageEnd'); |
| 199 | this.onWebPrepared() | 218 | this.onWebPrepared() |
| 200 | this.isPageEnd = true | 219 | this.isPageEnd = true |
| 201 | - this.webIsLoaded = true | ||
| 202 | } | 220 | } |
| 221 | + | ||
| 203 | onLoadIntercept: (url?: string) => boolean = () => { | 222 | onLoadIntercept: (url?: string) => boolean = () => { |
| 204 | Logger.debug(TAG, 'onLoadIntercept return false'); | 223 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 205 | return false | 224 | return false |
| @@ -232,20 +251,6 @@ export struct WdWebLocalComponent { | @@ -232,20 +251,6 @@ export struct WdWebLocalComponent { | ||
| 232 | } | 251 | } |
| 233 | } | 252 | } |
| 234 | 253 | ||
| 235 | - aboutToAppear(): void { | ||
| 236 | - this.webIsLoaded = false | ||
| 237 | - EmitterUtils.receiveEvent(EmitterEventId.APP_PAGE_SHOW, () => { | ||
| 238 | - let params = {'event':NativeCallH5Event.NativeCallH5EventPageWillAppear} as eventParams; | ||
| 239 | - let jsonString = JSON.stringify(params); | ||
| 240 | - Logger.debug(TAG, 'APP_PAGE_SHOW'+this.webIsLoaded); | ||
| 241 | - // if (this.webIsLoaded) { | ||
| 242 | - // this.webviewControl.callHandle(NativeCallH5Type.jsCall_appNotifyEvent, jsonString, (data: string) => { | ||
| 243 | - // Logger.debug(TAG, "from js data = " + data); | ||
| 244 | - // }) | ||
| 245 | - // } | ||
| 246 | - }) | ||
| 247 | - } | ||
| 248 | - | ||
| 249 | @Builder | 254 | @Builder |
| 250 | videoComp(){ | 255 | videoComp(){ |
| 251 | Video({ | 256 | Video({ |
| @@ -47,7 +47,6 @@ struct ImageAndTextDetailPage { | @@ -47,7 +47,6 @@ struct ImageAndTextDetailPage { | ||
| 47 | 47 | ||
| 48 | onPageShow() { | 48 | onPageShow() { |
| 49 | this.pageShow = Math.random() | 49 | this.pageShow = Math.random() |
| 50 | - EmitterUtils.sendEmptyEvent(EmitterEventId.APP_PAGE_SHOW) | ||
| 51 | Logger.info(TAG, 'onPageShow'); | 50 | Logger.info(TAG, 'onPageShow'); |
| 52 | } | 51 | } |
| 53 | 52 |
-
Please register or login to post a comment