Parcourir la source

暂时回复两次调用currentUser

guo00guo il y a 5 ans
Parent
commit
33932de798
2 fichiers modifiés avec 23 ajouts et 19 suppressions
  1. 21 19
      src/components/commons/Header2.0.vue
  2. 2 0
      src/components/commons/HomeSlice.vue

+ 21 - 19
src/components/commons/Header2.0.vue

@@ -141,24 +141,26 @@
                     'isSystemAdministrator': false
                 });
                 // console.log('本地没有用户信息,开始加载用户信息')
-              this.user = storageGet('user')
-              this.rolesPermissions = getRolesPermissions(storageGet('user')&&storageGet('user').roleList)
-              storageSave('rolesPermissions', getRolesPermissions(torageGet('user')&&storageGet('user').roleList))
-              this.isLogin = true
-              this.fullScreenLoading = false
-                // getCurrentUser().then((res) => {
-                //     // console.log(res)
-                //     storageSave('user', res)
-                //     this.user = res
-                //     this.rolesPermissions = getRolesPermissions(res.roleList)
-                //     storageSave('rolesPermissions', getRolesPermissions(res.roleList))
-                //     console.log('用户信息加载成功')
-                //     this.isLogin = true
-                //     this.fullScreenLoading = false
-                // }).catch((error) => {
-                //     console.log('用户信息加载失败')
-                //     this.fullScreenLoading = false
-                // })
+              //暂时注释
+              // this.user = storageGet('user')
+              // this.rolesPermissions = getRolesPermissions(storageGet('user')&&storageGet('user').roleList)
+              // storageSave('rolesPermissions', getRolesPermissions(torageGet('user')&&storageGet('user').roleList))
+              // this.isLogin = true
+              // this.fullScreenLoading = false
+
+                getCurrentUser().then((res) => {
+                    // console.log(res)
+                    storageSave('user', res)
+                    this.user = res
+                    this.rolesPermissions = getRolesPermissions(res.roleList)
+                    storageSave('rolesPermissions', getRolesPermissions(res.roleList))
+                    console.log('用户信息加载成功')
+                    this.isLogin = true
+                    this.fullScreenLoading = false
+                }).catch((error) => {
+                    console.log('用户信息加载失败')
+                    this.fullScreenLoading = false
+                })
             } else {
                 this.user = storageGet('user')
                 this.fullScreenLoading = false
@@ -182,7 +184,7 @@
         userLogout () {
             this.isLogin = false
             logout().then((res) => {
-                // location.reload();
+                location.reload();
                 this.$router.push('/home')
             })
 

+ 2 - 0
src/components/commons/HomeSlice.vue

@@ -58,6 +58,7 @@
                       this.hideLoading()
                         this.$router.push('/project/create');
                     }).catch((error) => {
+                      this.hideLoading()
                         notify('error', error.data)
                     })
                 }
@@ -74,6 +75,7 @@
                       this.hideLoading()
                         this.$router.push('/square');
                     }).catch((error) => {
+                      this.hideLoading()
                         notify('error', error.data)
                     })