From ec38cb71ce221ab752bb08ea74a1a06d3a6ce2a5 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Sun, 19 Apr 2026 20:10:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E6=A0=B7=E5=BC=8F=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/LayoutToolbar.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/components/LayoutToolbar.vue b/src/layouts/components/LayoutToolbar.vue index 711a52ba..a7c61646 100644 --- a/src/layouts/components/LayoutToolbar.vue +++ b/src/layouts/components/LayoutToolbar.vue @@ -191,8 +191,8 @@ function handleSettingsClick() { cursor: pointer; transition: all 0.3s; - // 确保子元素居中 - > * { + // 只对需要居中的子元素生效,不使用通配符避免影响选择器组件 + > [class^="i-svg:"] { display: flex; align-items: center; justify-content: center; From b5e4e4cd15cc0dc55226a99b9686c017c2517e3a Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Tue, 5 May 2026 10:46:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(router):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=A1=B5=E9=9D=A2=E8=B7=AF=E7=94=B1=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/LayoutToolbar.vue | 4 +++- src/router/guards/permission.ts | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/layouts/components/LayoutToolbar.vue b/src/layouts/components/LayoutToolbar.vue index c829c3fa..23bb5f81 100644 --- a/src/layouts/components/LayoutToolbar.vue +++ b/src/layouts/components/LayoutToolbar.vue @@ -160,7 +160,9 @@ function logout() { lockScroll: false, }).then(() => { userStore.logout().then(() => { - router.push(`/login?redirect=${route.fullPath}`); + // 若当前已在 404/401 等错误页,退出后不再跳回错误页 + const redirect = ["/404", "/401"].includes(route.path) ? "/" : route.fullPath; + router.push(`/login?redirect=${encodeURIComponent(redirect)}`); }); }); } diff --git a/src/router/guards/permission.ts b/src/router/guards/permission.ts index 5de45807..4685be0b 100644 --- a/src/router/guards/permission.ts +++ b/src/router/guards/permission.ts @@ -56,6 +56,10 @@ export function setupPermissionGuard() { // 路由 404 检查 if (to.matched.length === 0) { + // 从登录页跳转且目标路径无效,回退首页(避免不同用户权限不同导致的 404) + if (_from.path === "/login") { + return { path: "/", replace: true }; + } return "/404"; }