增加插件安装功能并提升其他功能稳定性 (#1155)
* 增加安装插件demo * 前端上传demo * 插件安装初版 * 调整菜单结构 * fix: 修改密码校验 jwt 中的用户 id * router.go:fix logger的中间件是默认的,这边日志可以删除;cors的日志打印应当在上面两行启用的时候再进行注释 * 登陆==>登录 * 抽离插件安装方法 * 调整插件功能 提升灵活度 Co-authored-by: zeromake <a390720046@gmail.com> Co-authored-by: Lu JJ <275955589@qq.com> Co-authored-by: pnck <hio131@gmail.com> Co-authored-by: feixuanyu <994085848@qq.com>
This commit is contained in:
@@ -49,12 +49,25 @@ router.beforeEach(async(to, from, next) => {
|
||||
asyncRouterFlag++
|
||||
await getRouter(userStore)
|
||||
}
|
||||
next({ name: userStore.userInfo.authority.defaultRouter })
|
||||
// token 可以解析但是却是不存在的用户 id 或角色 id 会导致无限调用
|
||||
if (userStore.userInfo?.authority?.defaultRouter != null) {
|
||||
next({ name: userStore.userInfo.authority.defaultRouter })
|
||||
} else {
|
||||
// 强制退出账号
|
||||
userStore.ClearStorage()
|
||||
next({
|
||||
name: 'Login',
|
||||
query: {
|
||||
redirect: document.location.hash
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
} else {
|
||||
// 不在白名单中并且已经登陆的时候
|
||||
// 不在白名单中并且已经登录的时候
|
||||
if (token) {
|
||||
// 添加flag防止多次获取动态路由和栈溢出
|
||||
if (!asyncRouterFlag && whiteList.indexOf(from.name) < 0) {
|
||||
@@ -76,7 +89,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 不在白名单中并且未登陆的时候
|
||||
// 不在白名单中并且未登录的时候
|
||||
if (!token) {
|
||||
next({
|
||||
name: 'Login',
|
||||
|
Reference in New Issue
Block a user