diff --git a/src/permission.js b/src/permission.js index 532653b9..979af392 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth' NProgress.configure({ showSpinner: false }) const whiteList = [ - '/index', + '/index', '/login', '/auth-redirect', '/bind', @@ -60,6 +60,7 @@ const whiteList = [ '/lawEnforcement/schemeDetail', '/lawEnforcement/waitingProcessing', '/lawEnforcement/complaintAdd', + '/homesteadLogin', ] router.beforeEach((to, from, next) => { @@ -74,6 +75,7 @@ router.beforeEach((to, from, next) => { next() // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { + console.log(to.path) // 拉取user_info const roles = res.roles // store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => { @@ -92,9 +94,11 @@ router.beforeEach((to, from, next) => { next({ path: '/homestead/login' }) } else if (to.path.indexOf('/onlineHome') !== -1) { next(`/onlineHomeLogin`) - } else if (to.path.indexOf('/lawEnforcement') !== -1) { + } else if (to.path.indexOf('/homesteadSurvey') !== -1) { + next(`/homesteadLogin`) + }else if (to.path.indexOf('/lawEnforcement') !== -1) { next(`//lawEnforcement/login`) - } else { + }else { next({ path: '/' }) } }) @@ -104,10 +108,10 @@ router.beforeEach((to, from, next) => { } } } else { - console.log(to.path) // 没有token if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 + console.log(to.path) next() } else { if ('/authenticRight/index'.indexOf(to.path) !== -1) { @@ -116,7 +120,9 @@ router.beforeEach((to, from, next) => { next(`/homestead/login?redirect=${to.fullPath}`) } else if (to.path.indexOf('/onlineHome') !== -1) { next(`/onlineHomeLogin`) - } else if (to.path.indexOf('/lawEnforcement') !== -1) { + } else if (to.path.indexOf('/homesteadSurvey') !== -1) { + next(`/homesteadLogin`) + }else if (to.path.indexOf('/lawEnforcement') !== -1) { next(`/lawEnforcement/login?redirect=${to.fullPath}`) } else { next(`/login?redirect=${to.fullPath}`)