guarantee-lsq 2 years ago
parent
commit
0b4661c658
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/permission.js

+ 6 - 0
src/permission.js

@@ -35,6 +35,8 @@ router.beforeEach((to, from, next) => {
       next({ path: GlobalConstant.PC_INDEX_PATH })
       NProgress.done()
     } else {
+      console.log('to.path=================' + to.path)
+      console.log('to.path=================2' + store.getters.roles.length)
       if (store.getters.roles.length === 0) {
         store
           .dispatch('GetInfo')
@@ -48,6 +50,7 @@ router.beforeEach((to, from, next) => {
               let newPath = null
               if (to.path === '/toWorkplaceBacklog') {
                 const role = res.data.roles.join()
+                console.log('to.path=================3' + role)
                 switch (true) {
                   case role.includes('repair'):
                     newPath = '/NewWorkplaceBacklog'
@@ -55,6 +58,9 @@ router.beforeEach((to, from, next) => {
                   case role.includes('store'):
                     newPath = '/StoreWorkplaceBacklog'
                     break
+                  default :
+                    newPath = '/WorkplaceBacklog'
+                    break
                 }
               } else {
                 newPath = to.path