Showing
3 changed files
with
26 additions
and
13 deletions
| 1 | -import { CommonConstants, ViewType } from 'wdConstant'; | 1 | +import { BottomNavi, CommonConstants, ViewType } from 'wdConstant'; |
| 2 | import { EmitterEventId, EmitterUtils, Logger, NetworkUtil } from 'wdKit'; | 2 | import { EmitterEventId, EmitterUtils, 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'; |
| @@ -43,7 +43,7 @@ export struct PageComponent { | @@ -43,7 +43,7 @@ export struct PageComponent { | ||
| 43 | // 国殇灰度管理 | 43 | // 国殇灰度管理 |
| 44 | GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | 44 | GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') |
| 45 | @State netStatus: number | undefined = undefined // 存储网络状态 | 45 | @State netStatus: number | undefined = undefined // 存储网络状态 |
| 46 | - isRMH:boolean = false | 46 | + bottomNavi:BottomNavi = BottomNavi.NEWS |
| 47 | 47 | ||
| 48 | build() { | 48 | build() { |
| 49 | Column() { | 49 | Column() { |
| @@ -286,7 +286,7 @@ export struct PageComponent { | @@ -286,7 +286,7 @@ export struct PageComponent { | ||
| 286 | 286 | ||
| 287 | //人民号推荐 监听登录事件(刷新页面) | 287 | //人民号推荐 监听登录事件(刷新页面) |
| 288 | EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | 288 | EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { |
| 289 | - if(this.navIndex === this.currentTopNavSelectedIndex && this.isRMH){ | 289 | + if(this.navIndex === this.currentTopNavSelectedIndex && this.bottomNavi == BottomNavi.PEOPLE){ |
| 290 | this.listScroller.scrollEdge(Edge.Top) | 290 | this.listScroller.scrollEdge(Edge.Top) |
| 291 | this.pageModel.viewType = ViewType.LOADING; | 291 | this.pageModel.viewType = ViewType.LOADING; |
| 292 | this.getData() | 292 | this.getData() |
| @@ -298,9 +298,21 @@ export struct PageComponent { | @@ -298,9 +298,21 @@ export struct PageComponent { | ||
| 298 | onChange() { | 298 | onChange() { |
| 299 | // console.log(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); | 299 | // console.log(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); |
| 300 | // 注册监听网络连接 | 300 | // 注册监听网络连接 |
| 301 | - this.netStatus = undefined | ||
| 302 | - let netStatus = NetworkUtil.isNetConnected() | ||
| 303 | - if (netStatus) { | 301 | + if(this.bottomNavi == BottomNavi.VIDEO){ |
| 302 | + this.netStatus = undefined | ||
| 303 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 304 | + if (netStatus) { | ||
| 305 | + if (this.navIndex === this.currentTopNavSelectedIndex) { | ||
| 306 | + // console.log(TAG, 'page onAutoRefresh111 ' + this.needload) | ||
| 307 | + if (this.needload) { | ||
| 308 | + this.getData(); | ||
| 309 | + } | ||
| 310 | + this.needload = false; | ||
| 311 | + } | ||
| 312 | + } else { | ||
| 313 | + this.pageModel.viewType = ViewType.NoNetwork; | ||
| 314 | + } | ||
| 315 | + }else{ | ||
| 304 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 316 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| 305 | // console.log(TAG, 'page onAutoRefresh111 ' + this.needload) | 317 | // console.log(TAG, 'page onAutoRefresh111 ' + this.needload) |
| 306 | if (this.needload) { | 318 | if (this.needload) { |
| @@ -308,9 +320,8 @@ export struct PageComponent { | @@ -308,9 +320,8 @@ export struct PageComponent { | ||
| 308 | } | 320 | } |
| 309 | this.needload = false; | 321 | this.needload = false; |
| 310 | } | 322 | } |
| 311 | - } else { | ||
| 312 | - this.pageModel.viewType = ViewType.NoNetwork; | ||
| 313 | } | 323 | } |
| 324 | + | ||
| 314 | } | 325 | } |
| 315 | 326 | ||
| 316 | async onAutoRefresh() { | 327 | async onAutoRefresh() { |
| @@ -15,6 +15,7 @@ import { GrayManageModel } from '../../viewmodel/GrayManageModel'; | @@ -15,6 +15,7 @@ import { GrayManageModel } from '../../viewmodel/GrayManageModel'; | ||
| 15 | import { ColorUtils } from '../../utils/ColorUtils'; | 15 | import { ColorUtils } from '../../utils/ColorUtils'; |
| 16 | import { ImageKnifeComponent } from '@ohos/imageknife'; | 16 | import { ImageKnifeComponent } from '@ohos/imageknife'; |
| 17 | import { CommonUtils } from '../../utils/CommonUtils'; | 17 | import { CommonUtils } from '../../utils/CommonUtils'; |
| 18 | +import { BottomNavi } from 'wdConstant'; | ||
| 18 | 19 | ||
| 19 | const TAG = 'TopNavigationComponent'; | 20 | const TAG = 'TopNavigationComponent'; |
| 20 | 21 | ||
| @@ -97,10 +98,10 @@ export struct TopNavigationComponentNew { | @@ -97,10 +98,10 @@ export struct TopNavigationComponentNew { | ||
| 97 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 98 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| 98 | if (CompUtils.isNews(this.navItem)) { | 99 | if (CompUtils.isNews(this.navItem)) { |
| 99 | this.createPageComponent(navItem, index, | 100 | this.createPageComponent(navItem, index, |
| 100 | - (channelId) => this.GrayManage.get().isNewsMourning(channelId),false); | 101 | + (channelId) => this.GrayManage.get().isNewsMourning(channelId),BottomNavi.NEWS); |
| 101 | } else if (CompUtils.isRMH(this.navItem)) { | 102 | } else if (CompUtils.isRMH(this.navItem)) { |
| 102 | this.createPageComponent(navItem, index, | 103 | this.createPageComponent(navItem, index, |
| 103 | - (channelId) => this.GrayManage.get().isRmhMourning(channelId),true); | 104 | + (channelId) => this.GrayManage.get().isRmhMourning(channelId),BottomNavi.PEOPLE); |
| 104 | } | 105 | } |
| 105 | 106 | ||
| 106 | } else { | 107 | } else { |
| @@ -165,7 +166,7 @@ export struct TopNavigationComponentNew { | @@ -165,7 +166,7 @@ export struct TopNavigationComponentNew { | ||
| 165 | 166 | ||
| 166 | } | 167 | } |
| 167 | @Builder | 168 | @Builder |
| 168 | - createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,isRMH:boolean = false) { | 169 | + createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,bottomNavi:BottomNavi = BottomNavi.NEWS) { |
| 169 | PageComponent({ | 170 | PageComponent({ |
| 170 | currentTopNavSelectedIndex: this.currentTopNavSelectedIndex, | 171 | currentTopNavSelectedIndex: this.currentTopNavSelectedIndex, |
| 171 | navIndex: index, | 172 | navIndex: index, |
| @@ -173,7 +174,7 @@ export struct TopNavigationComponentNew { | @@ -173,7 +174,7 @@ export struct TopNavigationComponentNew { | ||
| 173 | channelId: navItem?.channelId + '', | 174 | channelId: navItem?.channelId + '', |
| 174 | autoRefresh: this.autoRefresh2Page, | 175 | autoRefresh: this.autoRefresh2Page, |
| 175 | isMourning: mourningCheckFn(`${navItem.channelId}`), | 176 | isMourning: mourningCheckFn(`${navItem.channelId}`), |
| 176 | - isRMH:isRMH | 177 | + bottomNavi:bottomNavi |
| 177 | }) | 178 | }) |
| 178 | // .margin({ | 179 | // .margin({ |
| 179 | // left: 6, | 180 | // left: 6, |
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | import { BottomNavDTO, TopNavDTO } from 'wdBean/Index'; | 5 | import { BottomNavDTO, TopNavDTO } from 'wdBean/Index'; |
| 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 8 | -import { DisplayDirection } from 'wdConstant/Index'; | 8 | +import { DisplayDirection ,BottomNavi} from 'wdConstant/Index'; |
| 9 | import { CompUtils, GrayManageModel, PageComponent } from 'wdComponent/Index'; | 9 | import { CompUtils, GrayManageModel, PageComponent } from 'wdComponent/Index'; |
| 10 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; | 10 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; |
| 11 | import { ParamType, Tracking } from 'wdTracking/Index'; | 11 | import { ParamType, Tracking } from 'wdTracking/Index'; |
| @@ -335,6 +335,7 @@ export struct VideoChannelPage { | @@ -335,6 +335,7 @@ export struct VideoChannelPage { | ||
| 335 | channelId: item.channelId + '', | 335 | channelId: item.channelId + '', |
| 336 | autoRefresh: this.autoRefresh, | 336 | autoRefresh: this.autoRefresh, |
| 337 | isMourning: this.GrayManage.get().isVideoMourning(`${item.channelId}`), | 337 | isMourning: this.GrayManage.get().isVideoMourning(`${item.channelId}`), |
| 338 | + bottomNavi:BottomNavi.VIDEO | ||
| 338 | }).backgroundColor(Color.White) | 339 | }).backgroundColor(Color.White) |
| 339 | } | 340 | } |
| 340 | 341 |
-
Please register or login to post a comment