|
|
@ -4,6 +4,7 @@ import { Message } from 'element-ui'
|
|
|
|
import NProgress from 'nprogress'
|
|
|
|
import NProgress from 'nprogress'
|
|
|
|
import 'nprogress/nprogress.css'
|
|
|
|
import 'nprogress/nprogress.css'
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
|
|
|
import { isRelogin } from '@/utils/request'
|
|
|
|
|
|
|
|
|
|
|
|
NProgress.configure({ showSpinner: false })
|
|
|
|
NProgress.configure({ showSpinner: false })
|
|
|
|
|
|
|
|
|
|
|
@ -19,8 +20,10 @@ router.beforeEach((to, from, next) => {
|
|
|
|
NProgress.done()
|
|
|
|
NProgress.done()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (store.getters.roles.length === 0) {
|
|
|
|
if (store.getters.roles.length === 0) {
|
|
|
|
|
|
|
|
isRelogin.show = true
|
|
|
|
// 判断当前用户是否已拉取完user_info信息
|
|
|
|
// 判断当前用户是否已拉取完user_info信息
|
|
|
|
store.dispatch('GetInfo').then(() => {
|
|
|
|
store.dispatch('GetInfo').then(() => {
|
|
|
|
|
|
|
|
isRelogin.show = false
|
|
|
|
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
|
|
|
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
|
|
|
// 根据roles权限生成可访问的路由表
|
|
|
|
// 根据roles权限生成可访问的路由表
|
|
|
|
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
|
|
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
|
|