|
|
@ -66,13 +66,21 @@ const authorityGuard = (to, from, next, options) => { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const redirectGuard = (to, from, next, options) => { |
|
|
|
const redirectGuard = (to, from, next, options) => { |
|
|
|
const {store} = options |
|
|
|
const {store} = options |
|
|
|
|
|
|
|
const getFirstChild = (routes) => { |
|
|
|
|
|
|
|
const route = routes[0] |
|
|
|
|
|
|
|
if (!route.children || route.children.length === 0) { |
|
|
|
|
|
|
|
return route |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return getFirstChild(route.children) |
|
|
|
|
|
|
|
} |
|
|
|
if (store.state.setting.layout === 'mix') { |
|
|
|
if (store.state.setting.layout === 'mix') { |
|
|
|
const firstMenu = store.getters['setting/firstMenu'] |
|
|
|
const firstMenu = store.getters['setting/firstMenu'] |
|
|
|
if (firstMenu.find(item => item.fullPath === to.fullPath)) { |
|
|
|
if (firstMenu.find(item => item.fullPath === to.fullPath)) { |
|
|
|
store.commit('setting/setActivatedFirst', to.fullPath) |
|
|
|
store.commit('setting/setActivatedFirst', to.fullPath) |
|
|
|
const subMenu = store.getters['setting/subMenu'] |
|
|
|
const subMenu = store.getters['setting/subMenu'] |
|
|
|
if (subMenu.length > 0) { |
|
|
|
if (subMenu.length > 0) { |
|
|
|
return next({path: subMenu[0].fullPath}) |
|
|
|
const redirect = getFirstChild(subMenu) |
|
|
|
|
|
|
|
return next({path: redirect.fullPath}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|