批量更新

This commit is contained in:
2026-09-20 00:19:08 +08:00
parent fa281363fb
commit c5ed596008
47 changed files with 5385 additions and 1199 deletions
+12 -1
View File
@@ -1,6 +1,6 @@
import { createRouter, createWebHashHistory } from "vue-router";
import { convertMenusToRoutes } from "./dynamicRoutes";
import { isSSOEnabled, redirectToAuthorize } from "@/utils/authClient";
import { isSSOEnabled, redirectToAuthorize, ensureUserInfo } from "@/utils/authClient";
// 静态子路由:需要在 Main 框架内显示的页面
const staticMainChildren = [
@@ -335,6 +335,17 @@ router.beforeEach(async (to, from, next) => {
next({ path: "/login", query: { redirect: to.path } });
return;
}
// 统一认证模式:补全用户信息(旧会话可能只有 token 没有 userInfo,
// 或迁移后 userInfo 缺失 id,会导致菜单等接口报「用户ID不存在」)。
// 令牌失效时 ensureUserInfo 会清空登录态并返回 null,此时重新登录。
if (isSSOEnabled()) {
const info = await ensureUserInfo();
if (!info) {
await redirectToAuthorize();
return;
}
}
if (!dynamicRoutesAdded) {
await loadAndAddDynamicRoutes();