yangchenggong1_wd

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

1 import { CommonConstants, ViewType } from 'wdConstant'; 1 import { CommonConstants, ViewType } from 'wdConstant';
2 -import { 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';
5 import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh'; 5 import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh';
@@ -43,6 +43,7 @@ export struct PageComponent { @@ -43,6 +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 47
47 build() { 48 build() {
48 Column() { 49 Column() {
@@ -282,6 +283,16 @@ export struct PageComponent { @@ -282,6 +283,16 @@ export struct PageComponent {
282 this.needload = false; 283 this.needload = false;
283 // console.log(TAG, 'aboutToAppear onAutoRefresh111 ' + this.needload) 284 // console.log(TAG, 'aboutToAppear onAutoRefresh111 ' + this.needload)
284 } 285 }
  286 +
  287 + //人民号推荐 监听登录事件(刷新页面)
  288 + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
  289 + if(this.navIndex === this.currentTopNavSelectedIndex && this.isRMH){
  290 + this.listScroller.scrollEdge(Edge.Top)
  291 + this.pageModel.viewType = ViewType.LOADING;
  292 + this.getData()
  293 + }
  294 + })
  295 +
285 } 296 }
286 297
287 onChange() { 298 onChange() {
@@ -97,10 +97,10 @@ export struct TopNavigationComponentNew { @@ -97,10 +97,10 @@ export struct TopNavigationComponentNew {
97 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { 97 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
98 if (CompUtils.isNews(this.navItem)) { 98 if (CompUtils.isNews(this.navItem)) {
99 this.createPageComponent(navItem, index, 99 this.createPageComponent(navItem, index,
100 - (channelId) => this.GrayManage.get().isNewsMourning(channelId)); 100 + (channelId) => this.GrayManage.get().isNewsMourning(channelId),false);
101 } else if (CompUtils.isRMH(this.navItem)) { 101 } else if (CompUtils.isRMH(this.navItem)) {
102 this.createPageComponent(navItem, index, 102 this.createPageComponent(navItem, index,
103 - (channelId) => this.GrayManage.get().isRmhMourning(channelId)); 103 + (channelId) => this.GrayManage.get().isRmhMourning(channelId),true);
104 } 104 }
105 105
106 } else { 106 } else {
@@ -165,7 +165,7 @@ export struct TopNavigationComponentNew { @@ -165,7 +165,7 @@ export struct TopNavigationComponentNew {
165 165
166 } 166 }
167 @Builder 167 @Builder
168 - createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean) { 168 + createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,isRMH:boolean = false) {
169 PageComponent({ 169 PageComponent({
170 currentTopNavSelectedIndex: this.currentTopNavSelectedIndex, 170 currentTopNavSelectedIndex: this.currentTopNavSelectedIndex,
171 navIndex: index, 171 navIndex: index,
@@ -173,6 +173,7 @@ export struct TopNavigationComponentNew { @@ -173,6 +173,7 @@ export struct TopNavigationComponentNew {
173 channelId: navItem?.channelId + '', 173 channelId: navItem?.channelId + '',
174 autoRefresh: this.autoRefresh2Page, 174 autoRefresh: this.autoRefresh2Page,
175 isMourning: mourningCheckFn(`${navItem.channelId}`), 175 isMourning: mourningCheckFn(`${navItem.channelId}`),
  176 + isRMH:isRMH
176 }) 177 })
177 // .margin({ 178 // .margin({
178 // left: 6, 179 // left: 6,