!117 修复登录失效,重新登录丢失参数问题

Merge pull request !117 from 爱宇阳/dev
This commit is contained in:
疯狂的狮子Li 2024-05-17 03:50:38 +00:00 committed by Gitee
commit 4ee46819c1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 2 deletions

View File

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

View File

@ -130,7 +130,8 @@ const handleLogin = () => {
// action // action
const [err] = await to(userStore.login(loginForm.value)); const [err] = await to(userStore.login(loginForm.value));
if (!err) { if (!err) {
await router.push({ path: redirect.value || '/' }); const redirectUrl = redirect.value || '/';
await router.push(redirectUrl);
loading.value = false; loading.value = false;
} else { } else {
loading.value = false; loading.value = false;