rkljw 5 days ago
parent
commit
32114e894d
2 changed files with 9 additions and 4 deletions
  1. BIN
      dist.zip
  2. 9 4
      src/permission.js

BIN
dist.zip


+ 9 - 4
src/permission.js

@@ -26,16 +26,21 @@ router.beforeEach(async(to, from, next) => {
   if (hasToken) {
     if (to.path === '/login') {
       const userInfo = await getInfo();
-      // console.log("User Info:", userInfo);
-      if (userInfo.status === 200) {
+      console.log("User Info:", userInfo);
+      if (userInfo.code === 200) {
+        console.log("####")
         setUseType(userInfo.data.userType, 86400)
         setWebSiteId(userInfo.data.siteId, 86400)
         setUserUrl(URL.webUrl, 86400)  
+        next({ path: '/' })
+        NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
+      }else{
+        next({ path: '/' })
+        NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
       }
       // if is logged in, redirect to the home page
 
-      next({ path: '/' })
-      NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
+    
     } else {
       // determine whether the user has obtained his permission roles through getInfo
       const hasRoles = store.getters.roles && store.getters.roles.length > 0