ソースを参照

Merge branch 'deploy_0804' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into deploy_0804

chenrui 3 年 前
コミット
38e7fe0f3b
1 ファイル変更11 行追加9 行削除
  1. 11 9
      src/permission.js

+ 11 - 9
src/permission.js

@@ -32,7 +32,8 @@ router.beforeEach((to, from, next) => {
         store.dispatch('SetInfo', userInfo)
       } else {
         store.dispatch('Logout').then(() => {
-          next({ path: '/user/login', query: { redirect: to.fullPath } })
+          // next({ path: '/user/login', query: { redirect: to.fullPath } })
+          next({ path: '/user/login' })
         })
       }
       // console.log(store.getters.roles)
@@ -52,16 +53,17 @@ router.beforeEach((to, from, next) => {
             } else {
               store.dispatch('GenerateRoutes', { roles }).then(() => {
                 // 根据roles权限生成可访问的路由表
+                next({ ...to, replace: true })
                 // 动态添加可访问路由表
                 // router.addRoutes(store.getters.addRouters)
-                const redirect = decodeURIComponent(from.query.redirect || to.path)
-                if (to.path === redirect) {
-                  // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
-                  next({ ...to, replace: true })
-                } else {
-                  // 跳转到目的路由
-                  next({ path: redirect })
-                }
+                // const redirect = decodeURIComponent(from.query.redirect || to.path)
+                // if (to.path === redirect) {
+                //   // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
+                //   next({ ...to, replace: true })
+                // } else {
+                //   // 跳转到目的路由
+                //   next({ path: redirect })
+                // }
               })
             }
           })