|
|
|
@ -23,8 +23,12 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
//next({ path: defaultRoutePath })
|
|
|
|
|
NProgress.done()
|
|
|
|
|
} else {
|
|
|
|
|
console.log('=== 非跳转登录页面 ===', store.getters.roles.length)
|
|
|
|
|
if (store.getters.roles.length === 0) {
|
|
|
|
|
store.dispatch('GetInfo').then(res => {
|
|
|
|
|
console.log('=== 测试跳转页面,获取个人信息 ===', res)
|
|
|
|
|
// console.log(JSON.stringify(res))
|
|
|
|
|
// console.log('=== 测试跳转页面,获取个人信息 -- end ===')
|
|
|
|
|
if (res.menus.length < 1) {
|
|
|
|
|
Modal.error({
|
|
|
|
|
title: '提示:',
|
|
|
|
@ -40,6 +44,7 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
}
|
|
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
|
const all_app_menu = Vue.ls.get(ALL_APPS_MENU)
|
|
|
|
|
console.log('=== 测试跳转页面,获取all_app_menu ===', all_app_menu)
|
|
|
|
|
let antDesignmenus
|
|
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
|
if (all_app_menu == null) {
|
|
|
|
@ -60,6 +65,7 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
}
|
|
|
|
|
applocation.push(apps)
|
|
|
|
|
})
|
|
|
|
|
console.log('applocation == ', applocation)
|
|
|
|
|
Vue.ls.set(ALL_APPS_MENU, applocation, 7 * 24 * 60 * 60 * 1000)
|
|
|
|
|
// 延迟 1 秒显示欢迎信息
|
|
|
|
|
setTimeout(() => {
|
|
|
|
@ -71,8 +77,11 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
} else {
|
|
|
|
|
antDesignmenus = Vue.ls.get(ALL_APPS_MENU)[0].menu
|
|
|
|
|
}
|
|
|
|
|
console.log('后端返回的路由', antDesignmenus)
|
|
|
|
|
console.log('后端返回的路由', antDesignmenus);
|
|
|
|
|
// console.log(JSON.stringify(antDesignmenus));
|
|
|
|
|
|
|
|
|
|
store.dispatch('GenerateRoutes', { antDesignmenus }).then(() => {
|
|
|
|
|
debugger
|
|
|
|
|
// 动态添加可访问路由表
|
|
|
|
|
router.addRoutes(store.getters.addRouters)
|
|
|
|
|
// 请求带有 redirect 重定向时,登录自动重定向到该地址
|
|
|
|
@ -88,12 +97,14 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
console.log('=== 测试跳转页面,获取个人信息失败 ===')
|
|
|
|
|
store.dispatch('Logout').then(() => {
|
|
|
|
|
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
store.dispatch("getNoticReceiveList").then((res)=>{});
|
|
|
|
|
} else {
|
|
|
|
|
console.log('=== 测试跳转页面 3 ===')
|
|
|
|
|
next()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|