fix bugs
This commit is contained in:
parent
d4e617a640
commit
71594aa028
|
@ -2,7 +2,7 @@
|
|||
* @Author: 龚祖望 573413756@qq.com
|
||||
* @Date: 2022-05-16 09:16:41
|
||||
* @LastEditors: 龚祖望 573413756@qq.com
|
||||
* @LastEditTime: 2022-11-17 13:51:19
|
||||
* @LastEditTime: 2022-11-17 14:10:25
|
||||
* @FilePath: \dashengda\src\permission.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
|
@ -41,7 +41,8 @@ router.beforeEach(async(to, from, next) => {
|
|||
try {
|
||||
const res = await store.dispatch('user/getInfo')
|
||||
store.dispatch('user/generateRoutes', res).then(() => {
|
||||
next()
|
||||
router.addRoutes(store.getters.asyncRouters)
|
||||
next({ ...to, replace: true })
|
||||
}).catch(async err => {
|
||||
// remove token and go to login page to re-login
|
||||
await store.dispatch('user/resetToken')
|
||||
|
|
|
@ -115,8 +115,7 @@ export const constantRoutes = [
|
|||
component: () => import('@/views/overview/index'),
|
||||
meta: { title: '概览', icon: 'overview' }
|
||||
}]
|
||||
},
|
||||
{ path: '*', redirect: '/404', hidden: true }
|
||||
}
|
||||
]
|
||||
|
||||
export const asyncRouter = [
|
||||
|
@ -290,7 +289,9 @@ export const asyncRouter = [
|
|||
meta: { title: '数据价值', permission: ['dashengda'] }
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
{ path: '*', redirect: '/404', hidden: true }
|
||||
]
|
||||
|
||||
const createRouter = () => new Router({
|
||||
mode: 'history', // require service support
|
||||
|
@ -298,7 +299,6 @@ const createRouter = () => new Router({
|
|||
routes: constantRoutes
|
||||
})
|
||||
const router = createRouter()
|
||||
router.addRoutes(asyncRouter)
|
||||
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
||||
export function resetRouter() {
|
||||
const newRouter = createRouter()
|
||||
|
|
Loading…
Reference in New Issue