王士厅

fix: 沉浸式播放时关闭网络,恢复网络后,切换到直播tab,tab列表内容未自动重新加载

1 import { CommonConstants, ViewType } from 'wdConstant'; 1 import { CommonConstants, ViewType } from 'wdConstant';
2 -import { Logger } from 'wdKit'; 2 +import { Logger, NetworkUtil } from 'wdKit';
3 import { EmptyComponent } from '../view/EmptyComponent'; 3 import { EmptyComponent } from '../view/EmptyComponent';
4 import PageModel from '../../viewmodel/PageModel'; 4 import PageModel from '../../viewmodel/PageModel';
5 import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh'; 5 import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh';
@@ -41,6 +41,7 @@ export struct PageComponent { @@ -41,6 +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 45
45 build() { 46 build() {
46 Column() { 47 Column() {
@@ -278,19 +279,26 @@ export struct PageComponent { @@ -278,19 +279,26 @@ export struct PageComponent {
278 if (this.navIndex === this.currentTopNavSelectedIndex) { 279 if (this.navIndex === this.currentTopNavSelectedIndex) {
279 this.getData(); 280 this.getData();
280 this.needload = false; 281 this.needload = false;
  282 + // console.log(TAG, 'aboutToAppear onAutoRefresh111 ' + this.needload)
281 } 283 }
282 } 284 }
283 285
284 onChange() { 286 onChange() {
285 - Logger.info(TAG,  
286 - `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); 287 + // console.log(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
  288 + // 注册监听网络连接
  289 + this.netStatus = undefined
  290 + let netStatus = NetworkUtil.isNetConnected()
  291 + if (netStatus) {
287 if (this.navIndex === this.currentTopNavSelectedIndex) { 292 if (this.navIndex === this.currentTopNavSelectedIndex) {
288 - Logger.debug(TAG, 'page onAutoRefresh111 ' + this.needload) 293 + // console.log(TAG, 'page onAutoRefresh111 ' + this.needload)
289 if (this.needload) { 294 if (this.needload) {
290 this.getData(); 295 this.getData();
291 } 296 }
292 this.needload = false; 297 this.needload = false;
293 } 298 }
  299 + } else {
  300 + this.pageModel.viewType = ViewType.EMPTY;
  301 + }
294 } 302 }
295 303
296 onAutoRefresh() { 304 onAutoRefresh() {