Merge branch 'master' of https://gitee.com/youlaiorg/vue3-element-admin
This commit is contained in:
@@ -160,7 +160,9 @@ function logout() {
|
|||||||
lockScroll: false,
|
lockScroll: false,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
userStore.logout().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)}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -191,8 +193,8 @@ function handleSettingsClick() {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
// 确保子元素居中
|
// 只对需要居中的子元素生效,不使用通配符避免影响选择器组件
|
||||||
> * {
|
> [class^="i-svg:"] {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ export function setupPermissionGuard() {
|
|||||||
|
|
||||||
// 路由 404 检查
|
// 路由 404 检查
|
||||||
if (to.matched.length === 0) {
|
if (to.matched.length === 0) {
|
||||||
|
// 从登录页跳转且目标路径无效,回退首页(避免不同用户权限不同导致的 404)
|
||||||
|
if (_from.path === "/login") {
|
||||||
|
return { path: "/", replace: true };
|
||||||
|
}
|
||||||
return "/404";
|
return "/404";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user