Przeglądaj źródła

fix(index-home): 切 Tab 返回时同步 currentRole 登录态

登录态在后台变化时(如从登录页 switchTab 返回)重新同步角色,避免 v-if=currentRole 停留在旧视图
liaoxg 1 miesiąc temu
rodzic
commit
f4ce734f9b
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      cfc-frontend/pages/index-home/index.vue

+ 7 - 1
cfc-frontend/pages/index-home/index.vue

@@ -1032,7 +1032,13 @@ membershipDays: 0,
     },
     _refreshOnShow() {
       // 切 Tab 返回:刷新家庭成员 + 沙盘 + 会员状态(loadFamilyData 内含任务/挑战刷新)
-      if (!this.isLoggedIn()) return
+      if (!this.isLoggedIn()) {
+        this.currentRole = ''
+        return
+      }
+      // 登录态可能在后台发生变化(如从登录页 switchTab 返回),
+      // 必须在此重新同步 currentRole,否则 v-if="currentRole" 无法切换到登录视图
+      this.syncRoleAndTabBar()
       this.checkMemberStatus()
       this.loadFamilyData()
     },