yangchenggong1_wd

fix |> 20631 人民号>推荐频道,点击信息流页面的关注按钮,触发登录,登录后推荐列表未根据用户状态刷新。

import { CommonConstants, ViewType } from 'wdConstant';
import { Logger, NetworkUtil } from 'wdKit';
import { EmitterEventId, EmitterUtils, Logger, NetworkUtil } from 'wdKit';
import { EmptyComponent } from '../view/EmptyComponent';
import PageModel from '../../viewmodel/PageModel';
import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh';
... ... @@ -43,6 +43,7 @@ export struct PageComponent {
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
@State netStatus: number | undefined = undefined // 存储网络状态
isRMH:boolean = false
build() {
Column() {
... ... @@ -282,6 +283,16 @@ export struct PageComponent {
this.needload = false;
// console.log(TAG, 'aboutToAppear onAutoRefresh111 ' + this.needload)
}
//人民号推荐 监听登录事件(刷新页面)
EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
if(this.navIndex === this.currentTopNavSelectedIndex && this.isRMH){
this.listScroller.scrollEdge(Edge.Top)
this.pageModel.viewType = ViewType.LOADING;
this.getData()
}
})
}
onChange() {
... ...
... ... @@ -97,10 +97,10 @@ export struct TopNavigationComponentNew {
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
if (CompUtils.isNews(this.navItem)) {
this.createPageComponent(navItem, index,
(channelId) => this.GrayManage.get().isNewsMourning(channelId));
(channelId) => this.GrayManage.get().isNewsMourning(channelId),false);
} else if (CompUtils.isRMH(this.navItem)) {
this.createPageComponent(navItem, index,
(channelId) => this.GrayManage.get().isRmhMourning(channelId));
(channelId) => this.GrayManage.get().isRmhMourning(channelId),true);
}
} else {
... ... @@ -165,7 +165,7 @@ export struct TopNavigationComponentNew {
}
@Builder
createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean) {
createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,isRMH:boolean = false) {
PageComponent({
currentTopNavSelectedIndex: this.currentTopNavSelectedIndex,
navIndex: index,
... ... @@ -173,6 +173,7 @@ export struct TopNavigationComponentNew {
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page,
isMourning: mourningCheckFn(`${navItem.channelId}`),
isRMH:isRMH
})
// .margin({
// left: 6,
... ...