From fee38f39e36bcda9924f5b26dca609dda6b331e0 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期日, 22 六月 2025 16:53:27 +0800
Subject: [PATCH] no message
---
 zy-asrs-flow/src/App.jsx |  524 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 262 insertions(+), 262 deletions(-)
diff --git a/zy-asrs-flow/src/App.jsx b/zy-asrs-flow/src/App.jsx
index 3d73344..7e8d0e2 100644
--- a/zy-asrs-flow/src/App.jsx
+++ b/zy-asrs-flow/src/App.jsx
@@ -1,262 +1,262 @@
-import React from 'react';
-import { Footer, Question, SelectLang, AvatarDropdown, AvatarName, Brightness, LayoutSwitch, FullScreen } from '@/components';
-import { LinkOutlined } from '@ant-design/icons';
-import { SettingDrawer } from '@ant-design/pro-components';
-import { history, Link } from '@umijs/max';
-import defaultSettings from '../config/defaultSettings';
-import { errorConfig } from './requestErrorConfig';
-import { getRemoteMenu, getRoutersInfo, getUserInfo, setRemoteMenu, patchRouteWithRemoteMenus } from './services/route';
-import { getToken, setToken } from '@/utils/token-util'
-import { TOKEN_HEADER_NAME, TOKEN_STORE_NAME } from '@/config/setting';
-import { API_BASE_URL } from '@/config/setting'
-import { message } from 'antd';
-
-import logo from '../public/img/logo.png'
-import logoDark from '../public/img/logo-dark.png'
-
-const isDev = process.env.NODE_ENV === 'development';
-const loginPath = '/user/login';
-const defaultAvatar = 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
-
-// https://xflow.antv.vision/zh-CN/docs/tutorial/solutions/dag DAG 娴佺▼鍥�
-export function render(oldRender) {
-  const token = getToken();
-  if (!token || token?.length === 0) {
-    oldRender();
-    return;
-  }
-  getRoutersInfo().then(res => {
-    setRemoteMenu(res);
-    oldRender();
-  });
-}
-
-export async function patchClientRoutes({ routes }) {
-  patchRouteWithRemoteMenus(routes);
-}
-
-export async function onRouteChange({ clientRoutes, location }) {
-  const menus = getRemoteMenu();
-  if (menus === null && location.pathname !== loginPath) {
-    history.go(0);
-  }
-}
-
-/**
- * @see  https://umijs.org/zh-CN/plugins/plugin-initial-state
- * */
-export async function getInitialState() {
-  const fetchUserInfo = async () => {
-    try {
-      const { data: userInfo } = await getUserInfo({
-        skipErrorHandler: true,
-      });
-      if (userInfo?.avatar === '') {
-        userInfo.avatar = defaultAvatar;
-      }
-      userInfo.name = userInfo.nickname;
-      return {
-        ...userInfo
-      };
-    } catch (error) {
-      console.log(error);
-      history.push(loginPath);
-    }
-    return undefined;
-  };
-  // 濡傛灉涓嶆槸鐧诲綍椤甸潰锛屾墽琛�
-  const { location } = history;
-  if (location.pathname !== loginPath) {
-    const currentUser = await fetchUserInfo();
-    return {
-      fetchUserInfo,
-      currentUser,
-      settings: defaultSettings,
-    };
-  }
-  return {
-    memo: 'create by vincent',
-    fetchUserInfo,
-    settings: defaultSettings,
-  };
-}
-
-// ProLayout 鏀寔鐨刟pi https://procomponents.ant.design/components/layout
-// 浼樺厛绾� layout > config > defaultSetting
-export const layout = ({ initialState, setInitialState }) => {
-  const [darkMode, setDarkMode] = React.useState(() => {
-    const storedValue = localStorage.getItem('darkMode');
-    return storedValue !== null ? JSON.parse(storedValue) : true;
-  });
-
-  const [layoutMode, setLayoutMode] = React.useState(() => {
-    const storedValue = localStorage.getItem('layoutMode');
-    return storedValue !== null ? JSON.parse(storedValue) : true;
-  });
-
-  const [fullScreen, setFullScreen] = React.useState(false);
-
-  React.useEffect(() => {
-    localStorage.setItem('darkMode', JSON.stringify(darkMode));
-    localStorage.setItem('layoutMode', JSON.stringify(layoutMode));
-  }, [darkMode, layoutMode]);
-
-  return {
-    actionsRender: () => [
-      <FullScreen fullScreen={fullScreen} setFullScreen={setFullScreen} />,
-      <LayoutSwitch layoutMode={layoutMode} setLayoutMode={setLayoutMode} />,
-      <Brightness darkMode={darkMode} setDarkMode={setDarkMode} />,
-      // <Question key="doc" />,
-      // <SelectLang key="SelectLang" />
-    ],
-    avatarProps: {
-      src: initialState?.currentUser?.avatar,
-      title: <AvatarName />,
-      render: (_, avatarChildren) => {
-        return <AvatarDropdown>{avatarChildren}</AvatarDropdown>;
-      },
-    },
-    menu: {
-      locale: false,
-      // 姣忓綋 initialState?.currentUser?.userid 鍙戠敓淇敼鏃堕噸鏂版墽琛� request
-      params: {
-        userId: initialState?.currentUser?.id,
-      },
-      request: async () => {
-        if (!initialState?.currentUser?.id) {
-          return [];
-        }
-        return getRemoteMenu();
-      },
-    },
-    footerRender: () => <Footer />,
-    onPageChange: () => {
-      const { location } = history;
-      // 濡傛灉娌℃湁鐧诲綍锛岄噸瀹氬悜鍒� login
-      if (!initialState?.currentUser && location.pathname !== loginPath) {
-        history.push(loginPath);
-      }
-    },
-    // token: {
-    //   bgLayout: '#fff',
-    //   header: {
-    //     colorBgHeader: '#fff',
-    //   },
-    //   sider: {
-    //     colorMenuBackground: '#fff',
-    //   },
-    //   pageContainer: {
-    //     colorBgPageContainer: '#fff',
-    //   },
-    // },
-    bgLayoutImgList: [
-      // {
-      //   src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/D2LWSqNny4sAAAAAAAAAAAAAFl94AQBr',
-      //   left: 85,
-      //   bottom: 100,
-      //   height: '303px',
-      // },
-      // {
-      //   src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/C2TWRpJpiC0AAAAAAAAAAAAAFl94AQBr',
-      //   bottom: -68,
-      //   right: -45,
-      //   height: '303px',
-      // },
-      // {
-      //   src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/F6vSTbj8KpYAAAAAAAAAAAAAFl94AQBr',
-      //   bottom: 0,
-      //   left: 0,
-      //   width: '331px',
-      // },
-    ],
-    // 鏄剧ず鍦ㄨ彍鍗曞彸涓嬭鐨勫揩鎹锋搷浣�
-    links: [],
-    menuHeaderRender: undefined,
-    // 鑷畾涔� 403 椤甸潰
-    // unAccessible: <div>unAccessible</div>,
-    // 澧炲姞涓�涓� loading 鐨勭姸鎬�
-    childrenRender: (children) => {
-      // if (initialState?.loading) return <PageLoading />;
-      return (
-        <>
-          {children}
-          {/* {isDev && (
-            <SettingDrawer
-              disableUrlParams
-              enableDarkTheme
-              settings={initialState?.settings}
-              onSettingChange={(settings) => {
-                console.log(settings);
-                setInitialState((preInitialState) => ({
-                  ...preInitialState,
-                  settings,
-                }));
-              }}
-            />
-          )} */}
-        </>
-      );
-    },
-    ...initialState?.settings,
-    layout: layoutMode ? 'top' : 'mix',  // layout 鐨勮彍鍗曟ā寮忥紝side锛氬彸渚у鑸紝top锛氶《閮ㄥ鑸�
-    // contentStyle: () => {  // 	layout 鐨勫唴瀹瑰尯 style
-    //   return 
-    // },
-    contentWidth: 'Fluid', // layout 鐨勫唴瀹规ā寮忥紝Fluid锛氳嚜閫傚簲锛堝叏灞忥級锛孎ixed锛氬畾瀹� 锛堝皬锛� 1200px
-    fixedHeader: true,  // 鍥哄畾 header
-    fixSiderbar: true,  // 鍥哄畾瀵艰埅
-    // settings: defaultSettings, // layout 鐨勮缃�
-    // waterMarkProps: { content: initialState?.currentUser?.nickname }, //姘村嵃
-    // navTheme: 'realDark', // 榛樿涓婚棰滆壊  "realDark" | "light" | undef...
-    navTheme: darkMode ? 'realDark' : 'light',
-    footerRender: false,  // 椤佃剼 鍚敤璇锋敞閲婏紝涓嶆槸璁剧疆涓簍rue
-    logo: darkMode
-      ? <img src={logo} className='header-logo' />
-      : <img src={logoDark} className='header-logo' />
-    ,
-    title: (
-      <div className='header-title'>
-      </div>
-    ),
-    colorWeak: true,
-  };
-};
-
-
-/**
- * @name request 閰嶇疆锛屽彲浠ラ厤缃敊璇鐞�
- * 瀹冨熀浜� axios 鍜� ahooks 鐨� useRequest 鎻愪緵浜嗕竴濂楃粺涓�鐨勭綉缁滆姹傚拰閿欒澶勭悊鏂规銆�
- * @doc https://umijs.org/docs/max/request#閰嶇疆
- */
-export const request = {
-  baseURL: API_BASE_URL,
-  ...errorConfig,
-  timeout: 60000,
-  // 鍓嶇疆瀹堝崼
-  requestInterceptors: [
-    (url, options) => {
-      const token = getToken();
-      if (token && options.headers) {
-        options.headers[TOKEN_HEADER_NAME] = token;
-      }
-      return { url, options };
-    }
-  ],
-  // 鍚庣疆瀹堝崼
-  responseInterceptors: [
-    (response) => {
-      if (response?.data?.code === 401) {
-        // message.error(intl.formatMessage({
-        //   id: 'pages.login.failure',
-        //   defaultMessage: '鐧诲綍澶辫触锛岃閲嶈瘯锛�',
-        // }));
-        history.push(loginPath)
-      }
-      const token = response.headers[TOKEN_HEADER_NAME];
-      if (token) {
-        setToken(token);
-      }
-      return response;
-    }
-  ]
-};
+import React from 'react';
+import { Footer, Question, SelectLang, AvatarDropdown, AvatarName, Brightness, LayoutSwitch, FullScreen } from '@/components';
+import { LinkOutlined } from '@ant-design/icons';
+import { SettingDrawer } from '@ant-design/pro-components';
+import { history, Link } from '@umijs/max';
+import defaultSettings from '../config/defaultSettings';
+import { errorConfig } from './requestErrorConfig';
+import { getRemoteMenu, getRoutersInfo, getUserInfo, setRemoteMenu, patchRouteWithRemoteMenus } from './services/route';
+import { getToken, setToken } from '@/utils/token-util'
+import { TOKEN_HEADER_NAME, TOKEN_STORE_NAME } from '@/config/setting';
+import { API_BASE_URL } from '@/config/setting'
+import { message } from 'antd';
+
+import logo from '../public/img/logo.png'
+import logoDark from '../public/img/logo-dark.png'
+
+const isDev = process.env.NODE_ENV === 'development';
+const loginPath = '/user/login';
+const defaultAvatar = 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
+
+// https://xflow.antv.vision/zh-CN/docs/tutorial/solutions/dag DAG 娴佺▼鍥�
+export function render(oldRender) {
+  const token = getToken();
+  if (!token || token?.length === 0) {
+    oldRender();
+    return;
+  }
+  getRoutersInfo().then(res => {
+    setRemoteMenu(res);
+    oldRender();
+  });
+}
+
+export async function patchClientRoutes({ routes }) {
+  patchRouteWithRemoteMenus(routes);
+}
+
+export async function onRouteChange({ clientRoutes, location }) {
+  const menus = getRemoteMenu();
+  if (menus === null && location.pathname !== loginPath) {
+    history.go(0);
+  }
+}
+
+/**
+ * @see  https://umijs.org/zh-CN/plugins/plugin-initial-state
+ * */
+export async function getInitialState() {
+  const fetchUserInfo = async () => {
+    try {
+      const { data: userInfo } = await getUserInfo({
+        skipErrorHandler: true,
+      });
+      if (userInfo?.avatar === '') {
+        userInfo.avatar = defaultAvatar;
+      }
+      userInfo.name = userInfo.nickname;
+      return {
+        ...userInfo
+      };
+    } catch (error) {
+      console.log(error);
+      history.push(loginPath);
+    }
+    return undefined;
+  };
+  // 濡傛灉涓嶆槸鐧诲綍椤甸潰锛屾墽琛�
+  const { location } = history;
+  if (location.pathname !== loginPath) {
+    const currentUser = await fetchUserInfo();
+    return {
+      fetchUserInfo,
+      currentUser,
+      settings: defaultSettings,
+    };
+  }
+  return {
+    memo: 'create by vincent',
+    fetchUserInfo,
+    settings: defaultSettings,
+  };
+}
+
+// ProLayout 鏀寔鐨刟pi https://procomponents.ant.design/components/layout
+// 浼樺厛绾� layout > config > defaultSetting
+export const layout = ({ initialState, setInitialState }) => {
+  const [darkMode, setDarkMode] = React.useState(() => {
+    const storedValue = localStorage.getItem('darkMode');
+    return storedValue !== null ? JSON.parse(storedValue) : true;
+  });
+
+  const [layoutMode, setLayoutMode] = React.useState(() => {
+    const storedValue = localStorage.getItem('layoutMode');
+    return storedValue !== null ? JSON.parse(storedValue) : true;
+  });
+
+  const [fullScreen, setFullScreen] = React.useState(false);
+
+  React.useEffect(() => {
+    localStorage.setItem('darkMode', JSON.stringify(darkMode));
+    localStorage.setItem('layoutMode', JSON.stringify(layoutMode));
+  }, [darkMode, layoutMode]);
+
+  return {
+    actionsRender: () => [
+      // <Question key="doc" />,
+      <SelectLang key="SelectLang" />,
+      <FullScreen fullScreen={fullScreen} setFullScreen={setFullScreen} />,
+      <LayoutSwitch layoutMode={layoutMode} setLayoutMode={setLayoutMode} />,
+      <Brightness darkMode={darkMode} setDarkMode={setDarkMode} />,
+    ],
+    avatarProps: {
+      src: initialState?.currentUser?.avatar,
+      title: <AvatarName />,
+      render: (_, avatarChildren) => {
+        return <AvatarDropdown>{avatarChildren}</AvatarDropdown>;
+      },
+    },
+    menu: {
+      locale: false,
+      // 姣忓綋 initialState?.currentUser?.userid 鍙戠敓淇敼鏃堕噸鏂版墽琛� request
+      params: {
+        userId: initialState?.currentUser?.id,
+      },
+      request: async () => {
+        if (!initialState?.currentUser?.id) {
+          return [];
+        }
+        return getRemoteMenu();
+      },
+    },
+    footerRender: () => <Footer />,
+    onPageChange: () => {
+      const { location } = history;
+      // 濡傛灉娌℃湁鐧诲綍锛岄噸瀹氬悜鍒� login
+      if (!initialState?.currentUser && location.pathname !== loginPath) {
+        history.push(loginPath);
+      }
+    },
+    // token: {
+    //   bgLayout: '#fff',
+    //   header: {
+    //     colorBgHeader: '#fff',
+    //   },
+    //   sider: {
+    //     colorMenuBackground: '#fff',
+    //   },
+    //   pageContainer: {
+    //     colorBgPageContainer: '#fff',
+    //   },
+    // },
+    bgLayoutImgList: [
+      // {
+      //   src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/D2LWSqNny4sAAAAAAAAAAAAAFl94AQBr',
+      //   left: 85,
+      //   bottom: 100,
+      //   height: '303px',
+      // },
+      // {
+      //   src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/C2TWRpJpiC0AAAAAAAAAAAAAFl94AQBr',
+      //   bottom: -68,
+      //   right: -45,
+      //   height: '303px',
+      // },
+      // {
+      //   src: 'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/F6vSTbj8KpYAAAAAAAAAAAAAFl94AQBr',
+      //   bottom: 0,
+      //   left: 0,
+      //   width: '331px',
+      // },
+    ],
+    // 鏄剧ず鍦ㄨ彍鍗曞彸涓嬭鐨勫揩鎹锋搷浣�
+    links: [],
+    menuHeaderRender: undefined,
+    // 鑷畾涔� 403 椤甸潰
+    // unAccessible: <div>unAccessible</div>,
+    // 澧炲姞涓�涓� loading 鐨勭姸鎬�
+    childrenRender: (children) => {
+      // if (initialState?.loading) return <PageLoading />;
+      return (
+        <>
+          {children}
+          {/* {isDev && (
+            <SettingDrawer
+              disableUrlParams
+              enableDarkTheme
+              settings={initialState?.settings}
+              onSettingChange={(settings) => {
+                console.log(settings);
+                setInitialState((preInitialState) => ({
+                  ...preInitialState,
+                  settings,
+                }));
+              }}
+            />
+          )} */}
+        </>
+      );
+    },
+    ...initialState?.settings,
+    layout: layoutMode ? 'top' : 'mix',  // layout 鐨勮彍鍗曟ā寮忥紝side锛氬彸渚у鑸紝top锛氶《閮ㄥ鑸�
+    // contentStyle: () => {  // 	layout 鐨勫唴瀹瑰尯 style
+    //   return 
+    // },
+    contentWidth: 'Fluid', // layout 鐨勫唴瀹规ā寮忥紝Fluid锛氳嚜閫傚簲锛堝叏灞忥級锛孎ixed锛氬畾瀹� 锛堝皬锛� 1200px
+    fixedHeader: true,  // 鍥哄畾 header
+    fixSiderbar: true,  // 鍥哄畾瀵艰埅
+    // settings: defaultSettings, // layout 鐨勮缃�
+    // waterMarkProps: { content: initialState?.currentUser?.nickname }, //姘村嵃
+    // navTheme: 'realDark', // 榛樿涓婚棰滆壊  "realDark" | "light" | undef...
+    navTheme: darkMode ? 'realDark' : 'light',
+    footerRender: false,  // 椤佃剼 鍚敤璇锋敞閲婏紝涓嶆槸璁剧疆涓簍rue
+    logo: darkMode
+      ? <img src={logo} className='header-logo' />
+      : <img src={logoDark} className='header-logo' />
+    ,
+    title: (
+      <div className='header-title'>
+      </div>
+    ),
+    colorWeak: true,
+  };
+};
+
+
+/**
+ * @name request 閰嶇疆锛屽彲浠ラ厤缃敊璇鐞�
+ * 瀹冨熀浜� axios 鍜� ahooks 鐨� useRequest 鎻愪緵浜嗕竴濂楃粺涓�鐨勭綉缁滆姹傚拰閿欒澶勭悊鏂规銆�
+ * @doc https://umijs.org/docs/max/request#閰嶇疆
+ */
+export const request = {
+  baseURL: API_BASE_URL,
+  ...errorConfig,
+  timeout: 60000,
+  // 鍓嶇疆瀹堝崼
+  requestInterceptors: [
+    (url, options) => {
+      const token = getToken();
+      if (token && options.headers) {
+        options.headers[TOKEN_HEADER_NAME] = token;
+      }
+      return { url, options };
+    }
+  ],
+  // 鍚庣疆瀹堝崼
+  responseInterceptors: [
+    (response) => {
+      if (response?.data?.code === 401) {
+        // message.error(intl.formatMessage({
+        //   id: 'pages.login.failure',
+        //   defaultMessage: '鐧诲綍澶辫触锛岃閲嶈瘯锛�',
+        // }));
+        history.push(loginPath)
+      }
+      const token = response.headers[TOKEN_HEADER_NAME];
+      if (token) {
+        setToken(token);
+      }
+      return response;
+    }
+  ]
+};
--
Gitblit v1.9.1