diff --git a/.eslintrc.js b/.eslintrc.js
index 8ffdff8..c71918d 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,8 +1,11 @@
+
module.exports = {
- extends: [require.resolve('@umijs/lint/dist/config/eslint')],
- globals: {
- page: true,
- REACT_APP_ENV: true,
- SERVER_HOST: true,
- },
+
};
diff --git a/config/routes.ts b/config/routes.ts
index e3ed45e..00dd485 100644
--- a/config/routes.ts
+++ b/config/routes.ts
@@ -44,12 +44,9 @@ export default [
},
],
},
-
{
path: '/system',
-
name: 'system',
-
routes: [
{
name: 'api-list',
diff --git a/jsconfig.json b/jsconfig.json
index 197bee5..5643919 100644
--- a/jsconfig.json
+++ b/jsconfig.json
@@ -8,4 +8,4 @@
"@/*": ["./src/*"]
}
}
-}
+}
\ No newline at end of file
diff --git a/src/app.tsx b/src/app.tsx
index 5141e14..7124919 100644
--- a/src/app.tsx
+++ b/src/app.tsx
@@ -46,6 +46,8 @@ export async function getInitialState(): Promise<{
if (location.pathname !== loginPath && localStorage.getItem('access')) {
const currentUser = await fetchUserInfo();
const menus = await postMenuGetMenu();
+ console.log('app_menus', menus.data.routes);
+
if (getLocale() === 'zh-CN') {
let localData = getAllRouteNameTile(menus.data.routes, '');
let localRes: any = {};
@@ -88,7 +90,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
src: SERVER_HOST + initialState?.currentUser?.avatarUrl,
title: ,
render: (_, avatarChildren) => {
- console.log(avatarChildren,'111111111')
+ console.log(avatarChildren,'avatarProps')
return {avatarChildren};
},
},
@@ -118,14 +120,18 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
userId: initialState?.currentUser?.id,
},
request: async () => {
- // console.log(initialState?.menuData,'initialState_menuData')
+ console.log(initialState?.menuData,'initialState_menuData')
return initialState?.menuData || [];
},
},
+ // headerRender: () => <>导航栏>,
+ // menuRender: () => <>>,
footerRender: () => ,
onPageChange: () => {
const { location } = history;
// 如果没有登录,重定向到 login
+ console.log(location.pathname,'location_pathname')
+
if (!initialState?.currentUser && location.pathname !== loginPath) {
history.push(loginPath);
}
diff --git a/src/components/TableActionCard/index.tsx b/src/components/TableActionCard/index.tsx
index 84b0442..d8e01f8 100644
--- a/src/components/TableActionCard/index.tsx
+++ b/src/components/TableActionCard/index.tsx
@@ -1,8 +1,8 @@
/*
* @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-14 15:49:36
- * @LastEditors: zhoux zhouxia@supervision.ltd
- * @LastEditTime: 2023-12-11 10:30:54
+ * @LastEditors: donghao donghao@supervision.ltd
+ * @LastEditTime: 2024-04-10 11:21:37
* @FilePath: \general-ai-platform-web\src\components\TableActionCard\index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@@ -12,7 +12,7 @@ import { Dropdown } from 'antd';
import React from 'react';
//TODO 表单的操作按钮集合 key的报错未解决
-type actionsProps = {
+export type actionsProps = {
key: string;
renderDom: any;
}
diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx
index b59e5bf..63218a3 100644
--- a/src/layouts/index.tsx
+++ b/src/layouts/index.tsx
@@ -1,21 +1,18 @@
+import { history } from '@umijs/max';
import { Dropdown, Tabs } from 'antd';
import { useCallback, useMemo } from 'react';
-import { history } from '@umijs/max';
-import { KeepAliveTab, useKeepAliveTabs } from './useKeepAliveTabs';
import type { ItemType, MenuInfo } from 'rc-menu/lib/interface';
-import { KeepAliveTabContext } from './context';
+import { KeepAliveTab, useKeepAliveTabs } from './useKeepAliveTabs';
enum OperationType {
REFRESH = 'refresh',
CLOSE = 'close',
CLOSEOTHER = 'close-other',
}
-
-type MenuItemType = ItemType & { key: OperationType } | null;
+type MenuItemType = (ItemType & { key: OperationType }) | null;
const KeepAliveLayout = () => {
-
const {
keepAliveTabs,
activeTabRoutePath,
@@ -26,78 +23,91 @@ const KeepAliveLayout = () => {
onShow,
} = useKeepAliveTabs();
- const menuItems: MenuItemType[] = useMemo(() => [
- {
- label: '刷新',
- key: OperationType.REFRESH,
- },
- keepAliveTabs.length <= 1 ? null : {
- label: '关闭',
- key: OperationType.CLOSE,
- },
- keepAliveTabs.length <= 1 ? null : {
- label: '关闭其他',
- key: OperationType.CLOSEOTHER,
- },
- ].filter(o => o), [keepAliveTabs]);
-
- const menuClick = useCallback(({ key, domEvent }: MenuInfo, tab: KeepAliveTab) => {
- domEvent.stopPropagation();
+ const menuItems: MenuItemType[] = useMemo(
+ () =>
+ [
+ {
+ label: '刷新',
+ key: OperationType.REFRESH,
+ },
+ keepAliveTabs.length <= 1
+ ? null
+ : {
+ label: '关闭',
+ key: OperationType.CLOSE,
+ },
+ keepAliveTabs.length <= 1
+ ? null
+ : {
+ label: '关闭其他',
+ key: OperationType.CLOSEOTHER,
+ },
+ ].filter((o) => o),
+ [keepAliveTabs],
+ );
- if (key === OperationType.REFRESH) {
- refreshTab(tab.routePath);
- } else if (key === OperationType.CLOSE) {
- closeTab(tab.routePath);
- } else if (key === OperationType.CLOSEOTHER) {
- closeOtherTab(tab.routePath);
- }
- }, [closeOtherTab, closeTab, refreshTab]);
+ const menuClick = useCallback(
+ ({ key, domEvent }: MenuInfo, tab: KeepAliveTab) => {
+ domEvent.stopPropagation();
+ if (key === OperationType.REFRESH) {
+ refreshTab(tab.routePath);
+ } else if (key === OperationType.CLOSE) {
+ closeTab(tab.routePath);
+ } else if (key === OperationType.CLOSEOTHER) {
+ closeOtherTab(tab.routePath);
+ }
+ },
+ [closeOtherTab, closeTab, refreshTab],
+ );
- const renderTabTitle = useCallback((tab: KeepAliveTab) => {
- return (
- menuClick(e, tab) }}
- trigger={['contextMenu']}
- >
-
- {/*{tab.icon}*/}
- {tab.title}
-
-
- )
- }, [menuItems]);
+ const renderTabTitle = useCallback(
+ (tab: KeepAliveTab) => {
+ return (
+ menuClick(e, tab) }}
+ trigger={['contextMenu']}
+ >
+
+ {/*{tab.icon}*/}
+ {tab.title}
+
+
+ );
+ },
+ [menuItems],
+ );
const tabItems = useMemo(() => {
- let finalKeepAliveTabs = keepAliveTabs
+ let finalKeepAliveTabs = keepAliveTabs;
// .filter(item => !item?.isHideTab)
- return finalKeepAliveTabs.map(tab => {
- console.log(tab,'tabItems')
+ return finalKeepAliveTabs.map((tab) => {
+ console.log(tab, 'tabItems');
// TODO 未找到合适办法只去除tab标题栏位,保留页面内容
return {
key: tab.routePath,
label: renderTabTitle(tab),
children: (
-
+
{tab.children}
),
// style: {display: 'none'},
closable: keepAliveTabs.length > 1,
- forceRender: true
- }
- })
+ forceRender: true,
+ };
+ });
}, [keepAliveTabs]);
- const onTabsChange = useCallback((tabRoutePath: string) => {
- const curTab = keepAliveTabs.find(o => o.routePath === tabRoutePath);
- if (curTab) {
- history.push(curTab?.pathname);
- }
- }, [keepAliveTabs]);
+ const onTabsChange = useCallback(
+ (tabRoutePath: string) => {
+ const curTab = keepAliveTabs.find((o) => o.routePath === tabRoutePath);
+ if (curTab) {
+ history.push(curTab?.pathname);
+ }
+ },
+ [keepAliveTabs],
+ );
const onTabEdit = (
targetKey: React.MouseEvent | React.KeyboardEvent | string,
@@ -116,23 +126,23 @@ const KeepAliveLayout = () => {
onHidden,
onShow,
}),
- [closeTab, closeOtherTab, refreshTab, onHidden, onShow]
+ [closeTab, closeOtherTab, refreshTab, onHidden, onShow],
);
return (
-
+
-
- )
-}
+
+ );
+};
export default KeepAliveLayout;
diff --git a/src/typings.d.ts b/src/typings.d.ts
index 99f0711..d7b1ebd 100644
--- a/src/typings.d.ts
+++ b/src/typings.d.ts
@@ -1,3 +1,11 @@
+/*
+ * @Author: donghao donghao@supervision.ltd
+ * @Date: 2023-11-01 13:56:33
+ * @LastEditors: donghao donghao@supervision.ltd
+ * @LastEditTime: 2024-03-29 16:51:11
+ * @FilePath: \general-ai-platform-web\src\typings.d.ts
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
declare module 'slash2';
declare module '*.css';
declare module '*.less';
diff --git a/tsconfig.json b/tsconfig.json
index 9fe8cd8..c846cc9 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"forceConsistentCasingInFileNames": false,
-
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
@@ -20,7 +19,6 @@
"@@/*": ["./src/.umi/*"],
"@@test/*": ["./src/.umi-test/*"],
"@umijs/max": ["./src/.umijs/max"],
-
}
},
"include": ["./**/*.d.ts", "./**/*.ts", "./**/*.tsx", "src/utils/storage.js"]