瀏覽代碼

宅基地调查

wulanhaote
yujk 3 年之前
父節點
當前提交
af8d586d9f
共有 1 個文件被更改,包括 11 次插入5 次删除
  1. +11
    -5
      src/permission.js

+ 11
- 5
src/permission.js 查看文件

@@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth'
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false })


const whiteList = [ const whiteList = [
'/index',
'/index',
'/login', '/login',
'/auth-redirect', '/auth-redirect',
'/bind', '/bind',
@@ -60,6 +60,7 @@ const whiteList = [
'/lawEnforcement/schemeDetail', '/lawEnforcement/schemeDetail',
'/lawEnforcement/waitingProcessing', '/lawEnforcement/waitingProcessing',
'/lawEnforcement/complaintAdd', '/lawEnforcement/complaintAdd',
'/homesteadLogin',
] ]


router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
@@ -74,6 +75,7 @@ router.beforeEach((to, from, next) => {
next() next()
// 判断当前用户是否已拉取完user_info信息 // 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(res => { store.dispatch('GetInfo').then(res => {
console.log(to.path)
// 拉取user_info // 拉取user_info
const roles = res.roles const roles = res.roles
// store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => { // store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
@@ -92,9 +94,11 @@ router.beforeEach((to, from, next) => {
next({ path: '/homestead/login' }) next({ path: '/homestead/login' })
} else if (to.path.indexOf('/onlineHome') !== -1) { } else if (to.path.indexOf('/onlineHome') !== -1) {
next(`/onlineHomeLogin`) 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`) next(`//lawEnforcement/login`)
} else {
}else {
next({ path: '/' }) next({ path: '/' })
} }
}) })
@@ -104,10 +108,10 @@ router.beforeEach((to, from, next) => {
} }
} }
} else { } else {
console.log(to.path)
// 没有token // 没有token
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
console.log(to.path)
next() next()
} else { } else {
if ('/authenticRight/index'.indexOf(to.path) !== -1) { if ('/authenticRight/index'.indexOf(to.path) !== -1) {
@@ -116,7 +120,9 @@ router.beforeEach((to, from, next) => {
next(`/homestead/login?redirect=${to.fullPath}`) next(`/homestead/login?redirect=${to.fullPath}`)
} else if (to.path.indexOf('/onlineHome') !== -1) { } else if (to.path.indexOf('/onlineHome') !== -1) {
next(`/onlineHomeLogin`) 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}`) next(`/lawEnforcement/login?redirect=${to.fullPath}`)
} else { } else {
next(`/login?redirect=${to.fullPath}`) next(`/login?redirect=${to.fullPath}`)


Loading…
取消
儲存