fix: 样本管理
This commit is contained in:
21
src/app.tsx
21
src/app.tsx
@@ -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 />;
|
||||
|
||||
Reference in New Issue
Block a user