소스 검색

fix: 我的页面isLoggedIn改为data+onShow赋值,修复登录后仍显示登录前视图

liaoxg 1 개월 전
부모
커밋
17baef104d
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      cfc-frontend/pages/profile-main/profile.vue

+ 2 - 3
cfc-frontend/pages/profile-main/profile.vue

@@ -270,6 +270,7 @@ export default {
   components: { AIFloatingAvatar },
   data() {
     return {
+      isLoggedIn: false,
       nickname: '',
       role: 'parent',
       isSwitchedChild: false,
@@ -295,9 +296,6 @@ export default {
     }
   },
   computed: {
-    isLoggedIn() {
-      return !!uni.getStorageSync('token')
-    },
     roleLabel() {
       var map = { parent: '家长', child: '孩子', teacher: '规划师' }
       return map[this.role] || '用户'
@@ -321,6 +319,7 @@ export default {
     }
   },
   onShow() {
+    this.isLoggedIn = !!uni.getStorageSync('token')
     if (!this.isLoggedIn) {
       // 未登录:不调用任何需登录接口,仅显示登录引导
       return