修复登录失效,再次登录丢失参数
This commit is contained in:
parent
9b00aaff93
commit
0c620ef5b4
@ -52,7 +52,8 @@ router.beforeEach(async (to, from, next) => {
|
||||
// 在免登录白名单,直接进入
|
||||
next();
|
||||
} else {
|
||||
next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
|
||||
const redirect = encodeURIComponent(to.fullPath || '/');
|
||||
next(`/login?redirect=${redirect}`) // 否则全部重定向到登录页
|
||||
NProgress.done();
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,8 @@ const handleLogin = () => {
|
||||
// 调用action的登录方法
|
||||
const [err] = await to(userStore.login(loginForm.value));
|
||||
if (!err) {
|
||||
await router.push({ path: redirect.value || '/' });
|
||||
const redirectUrl = redirect.value || '/';
|
||||
await router.push(redirectUrl);
|
||||
loading.value = false;
|
||||
} else {
|
||||
loading.value = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user