feat: 高级列表

This commit is contained in:
2025-09-13 17:56:13 +08:00
parent e42e1c01fb
commit 9d5a289929
18 changed files with 1301 additions and 6739 deletions

View File

@@ -47,7 +47,7 @@ export async function getInitialState(): Promise<{
if (!token) {
throw new Error("No token found");
}
const { data } = await getInfo();
const data = await getInfo();
wsCache.set(CACHE_KEY.USER, data);
wsCache.set(CACHE_KEY.ROLE_ROUTERS, data.menus);
@@ -71,13 +71,14 @@ export async function getInitialState(): Promise<{
if (getAccessToken() && !currentUser) {
fetchUserInfo();
}
console.log(111);
return {
fetchUserInfo,
currentUser,
settings: defaultSettings as Partial<LayoutSettings>,
};
}
return {
fetchUserInfo,
settings: defaultSettings as Partial<LayoutSettings>,
@@ -183,7 +184,6 @@ export const request: RequestConfig = {
// 获取存储在本地的 token 和 tenantId
const token = getAccessToken();
const tenantId = getTenantId(); // 默认租户ID为1
console.log(tenantId);
// 设置统一的请求头
const headers: Record<string, string> = {
...options.headers,
@@ -201,6 +201,7 @@ export const request: RequestConfig = {
// umi 4 使用 modifyRoutes
export function patchClientRoutes({ routes }: { routes: any }) {
const { wsCache } = useCache();
console.log(2222);
const globalMenus = wsCache.get(CACHE_KEY.ROLE_ROUTERS);
const routerIndex = routes.findIndex((item: any) => item.path === "/");
const parentId = routes[routerIndex].id;