refactor: remove_permission-control

This commit is contained in:
Pan
2017-10-18 15:05:30 +08:00
parent 05ed30b5e9
commit 9abd44f562
7 changed files with 37 additions and 107 deletions

View File

@@ -4,7 +4,7 @@ import NProgress from 'nprogress' // Progress 进度条
import 'nprogress/nprogress.css'// Progress 进度条样式
import { getToken } from '@/utils/auth' // 验权
const whiteList = ['/login']
const whiteList = ['/login'] // 不重定向白名单
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
@@ -12,12 +12,8 @@ router.beforeEach((to, from, next) => {
next({ path: '/' })
} else {
if (store.getters.roles.length === 0) {
store.dispatch('GetInfo').then(res => {
const roles = res.data.role
store.dispatch('GenerateRoutes', { roles }).then(() => {
router.addRoutes(store.getters.addRouters)
next({ ...to })
})
store.dispatch('GetInfo').then(res => { // 拉取用户信息
next()
})
} else {
next()