Selaa lähdekoodia

学生注册、登录后跳转学生专区

Xiao_123 2 kuukautta sitten
vanhempi
commit
786befb8f7
1 muutettua tiedostoa jossa 12 lisäystä ja 10 poistoa
  1. 12 10
      store/user.js

+ 12 - 10
store/user.js

@@ -105,10 +105,10 @@ export const userStore = defineStore('user', {
     checkPersonBaseInfoFun(data) {
       data = data || {}
       // 待门墩儿测试后开放
-      // if (!data || !Object.keys(data).length || data.type === undefined || data.type === null) {
-      //   showAuthModal('selectUserType')
-      //   return
-      // }
+      if (!data || !Object.keys(data).length || data.type === undefined || data.type === null) {
+        showAuthModal('selectUserType')
+        return
+      }
       const necessaryInfoReady = checkPersonBaseInfo(data)
       data.necessaryInfoReady = necessaryInfoReady
       if (necessaryInfoReady) closeAuthModal()
@@ -127,6 +127,14 @@ export const userStore = defineStore('user', {
       if (!data) return
       const _data = await this.getFieldText(data)
       this.baseInfo = _data
+
+      // 是学生则跳转学生专区
+      if (data && data?.type === '1') {
+        uni.navigateTo({
+          url: '/pagesA/student/index'
+        })
+      }
+
       return Promise.resolve(data);
     },
     // 获取用户信息
@@ -228,12 +236,6 @@ export const userStore = defineStore('user', {
     }
   },
   persist: {
-    // enabled: true,
-    // strategies: [
-    //   {
-    //     key: 'user-store'
-    //   }
-    // ]
     storage: {
       setItem(key, value) {
         uni.setStorageSync(key, value)