| | |
| | | |
| | | const menuAll = getStore({ name: 'menuAll' }) |
| | | |
| | | if (!menuAll) { |
| | | store.dispatch('GetMenu').then(data => { |
| | | if (data.length !== 0) { |
| | | router.$avueRouter.formatRoutes(data, true) |
| | | |
| | | let newMenu = getStore({ name: 'menuAll' }) |
| | | |
| | | let firstMenu = newMenu[0] |
| | | |
| | | let toMenu = findRouteByPath(newMenu, to.path) |
| | | |
| | | store.commit('ADD_TAG', { |
| | | name: firstMenu.name, |
| | | path: firstMenu.path, |
| | | fullPath: firstMenu.path, |
| | | params: firstMenu.params || {}, |
| | | query: firstMenu.query || {}, |
| | | meta: firstMenu.meta || {}, |
| | | }) |
| | | |
| | | store.commit('ADD_TAG', { |
| | | name: toMenu.name, |
| | | path: toMenu.path, |
| | | fullPath: toMenu.path, |
| | | params: toMenu.params || {}, |
| | | query: toMenu.query || {}, |
| | | meta: toMenu.meta || {}, |
| | | }) |
| | | |
| | | next(to.fullPath) |
| | | } |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | | if (getToken()) { |
| | | if (!menuAll) { |
| | | store.dispatch('GetMenu').then(data => { |
| | | if (data.length !== 0) { |
| | | router.$avueRouter.formatRoutes(data, true) |
| | | |
| | | let newMenu = getStore({ name: 'menuAll' }) |
| | | |
| | | let firstMenu = newMenu[0] |
| | | |
| | | let toMenu = findRouteByPath(newMenu, to.path) |
| | | |
| | | store.commit('ADD_TAG', { |
| | | name: firstMenu.name, |
| | | path: firstMenu.path, |
| | | fullPath: firstMenu.path, |
| | | params: firstMenu.params || {}, |
| | | query: firstMenu.query || {}, |
| | | meta: firstMenu.meta || {}, |
| | | }) |
| | | |
| | | store.commit('ADD_TAG', { |
| | | name: toMenu.name, |
| | | path: toMenu.path, |
| | | fullPath: toMenu.path, |
| | | params: toMenu.params || {}, |
| | | query: toMenu.query || {}, |
| | | meta: toMenu.meta || {}, |
| | | }) |
| | | |
| | | next(to.fullPath) |
| | | } |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | | if (store.getters.isLock && to.path !== lockPage) { |
| | | //如果系统激活锁屏,全部跳转到锁屏页 |
| | | next({ path: lockPage }) |