fix(login): 修复登录页面重定向逻辑

- 修改了路由监听中的重定向值处理逻辑,过滤掉 'noRedirect' 和 'noredirect' 值
- 统一了登录成功和签到成功的路由跳转默认路径为 '/index'
- 优化了重定向参数的验证和赋值流程
This commit is contained in:
2026-06-04 13:34:05 +08:00
parent 454029edb0
commit 6a6ed53e87

View File

@@ -254,7 +254,8 @@ function handleForgotPassword() {
watch(
route,
(newRoute) => {
redirect.value = newRoute.query && newRoute.query.redirect;
const raw = newRoute.query && newRoute.query.redirect
redirect.value = raw && raw !== 'noRedirect' && raw !== 'noredirect' ? raw : '/index'
},
{ immediate: true }
);
@@ -343,7 +344,7 @@ function handleLogin() {
return acc;
}, {});
if (env === 'development' || !loginForm.value.invokeYb) {
router.push({ path: redirect.value || '/', query: otherQueryParams });
router.push({ path: redirect.value || '/index', query: otherQueryParams });
} else {
signIng.value = true;
userStore.getInfo();
@@ -491,7 +492,7 @@ async function signIn(mac, ip) {
return acc;
}, {});
userStore.removeRoles();
router.push({ path: redirect.value || '/', query: otherQueryParams });
router.push({ path: redirect.value || '/index', query: otherQueryParams });
console.log('签到成功:', response);
} catch (error) {
userStore.logOut();