fix: 样本管理

This commit is contained in:
2026-02-27 10:34:49 +08:00
parent a5d3342d93
commit 912ab4c321
10 changed files with 47 additions and 57 deletions

View File

@@ -45,6 +45,7 @@ export async function getInitialState(): Promise<{
throw new Error('No token found');
}
const data = await getInfo();
console.log(data, 'data');
wsCache.set(CACHE_KEY.USER, data);
wsCache.set(CACHE_KEY.ROLE_ROUTERS, data.menus);
@@ -73,7 +74,6 @@ export async function getInitialState(): Promise<{
await fetchUserInfo();
}
const menus = wsCache.get(CACHE_KEY.ROLE_ROUTERS);
console.log(111);
return {
fetchUserInfo,
currentUser,
@@ -93,27 +93,14 @@ export const layout: RunTimeLayoutConfig = ({
initialState,
setInitialState,
}) => {
const { wsCache } = useCache();
return {
actionsRender: () => [
<Question key="doc" />,
<SelectLang key="SelectLang" />,
],
menu: {
locale: false,
// 关闭国际化-
// request: async () => {
// const currentUser = wsCache.get(CACHE_KEY.USER);
// console.log("菜单请求被调用", initialState?.menus, currentUser);
// if (currentUser.menus) {
// const menuData = loopMenuItem(currentUser.menus);
// // console.log('转换后的菜单数据:', menuData);
// // const r = loopMenuItem(currentUser.menus);
// return menuData;
// }
// return [];
// },
},
avatarProps: {
src: initialState?.currentUser?.user.avatar,
@@ -159,8 +146,8 @@ export const layout: RunTimeLayoutConfig = ({
useRoutes: true,
},
menuHeaderRender: undefined,
// 自定义 403 页面
unAccessible: <div>unAccessible</div>,
// // 自定义 403 页面
// unAccessible: <div>unAccessible</div>,
// 增加一个 loading 的状态
childrenRender: (children) => {
// if (initialState?.loading) return <PageLoading />;