用户登陆超时,重新登陆后原路径参数丢失解决,问题地址:

https://gitee.com/y_project/RuoYi-Vue/issues/I4XHZR
This commit is contained in:
fury_128 2022-03-18 10:58:42 +08:00
parent 857054179c
commit 131719ef04
2 changed files with 228 additions and 220 deletions

View File

@ -45,7 +45,7 @@ router.beforeEach((to, from, next) => {
// 在免登录白名单,直接进入
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
next({ path: '/login' ,query:{re_path:to.path,...to.query}}) // 否则全部重定向到登录页
NProgress.done()
}
}

View File

@ -65,6 +65,7 @@
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import {tansParams} from "@/utils/ruoyi";
export default {
name: "Login",
@ -98,7 +99,14 @@ export default {
watch: {
$route: {
handler: function(route) {
this.redirect = route.query && route.query.redirect;
let re_path= route.query && route.query.re_path;
if (re_path) {
let param = JSON.parse(JSON.stringify(route.query));
console.log(route.query);
delete param.re_path;
re_path = `${re_path}?${tansParams(param)}`;
}
this.redirect = re_path;
},
immediate: true
}