支持不同角色自定义首页
This commit is contained in:
@@ -13,7 +13,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
document.title = getPageTitle(to.meta.title)
|
||||
if (whiteList.indexOf(to.name) > -1) {
|
||||
if (token) {
|
||||
next({ path: '/layout/dashboard' })
|
||||
next({ name: store.getters["user/userInfo"].authority.defaultRouter })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
@@ -21,7 +21,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
// 不在白名单中并且已经登陆的时候
|
||||
if (token) {
|
||||
// 添加flag防止多次获取动态路由和栈溢出
|
||||
if (!asyncRouterFlag) {
|
||||
if (!asyncRouterFlag && store.getters['router/asyncRouters'].length == 0) {
|
||||
asyncRouterFlag++
|
||||
await store.dispatch('router/SetAsyncRouter')
|
||||
const asyncRouters = store.getters['router/asyncRouters']
|
||||
|
Reference in New Issue
Block a user