mirror of https://gitee.com/xiaonuobase/snowy
【升级】退出后路由回到登陆前使用的页面,感谢码云 冬天 建议
parent
3e28c838ee
commit
aa8cbb847d
|
@ -85,6 +85,9 @@ router.beforeEach(async (to, from, next) => {
|
|||
isGetRouter.value = false
|
||||
next()
|
||||
return false
|
||||
} else {
|
||||
// 这里需要使用 localStorage 保存登录之前要访问的页面
|
||||
tool.data.set('LAST_VIEWS_PATH', to.fullPath)
|
||||
}
|
||||
if (!token) {
|
||||
next({
|
||||
|
|
|
@ -36,7 +36,6 @@ a, button, input, textarea {
|
|||
.aminui {
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
min-height: 640px;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
}
|
||||
|
|
|
@ -16,12 +16,16 @@ export const afterLogin = async (loginToken) => {
|
|||
|
||||
// 获取用户的菜单
|
||||
const menu = await userCenterApi.userLoginMenu()
|
||||
const indexMenu = menu[0].children[0].path
|
||||
let indexMenu = menu[0].children[0].path
|
||||
tool.data.set('MENU', menu)
|
||||
// 重置系统默认应用
|
||||
tool.data.set('SNOWY_MENU_MODULE_ID', menu[0].id)
|
||||
message.success('登录成功')
|
||||
router.replace({
|
||||
if (!!tool.data.get('LAST_VIEWS_PATH')) {
|
||||
// 如果有缓存,将其登录跳转到最后访问的路由
|
||||
indexMenu = tool.data.get('LAST_VIEWS_PATH')
|
||||
}
|
||||
await router.replace({
|
||||
path: indexMenu
|
||||
})
|
||||
dictApi.dictTree().then((data) => {
|
||||
|
|
Loading…
Reference in New Issue