From 828641ce9d4178bbff9030ad19ce93d0267f185c Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 17 九月 2025 08:36:42 +0800
Subject: [PATCH] no message
---
zy-asrs-flow/src/pages/account/setting/index.jsx | 202 +++++++++++++++++++++++++-------------------------
1 files changed, 102 insertions(+), 100 deletions(-)
diff --git a/zy-asrs-flow/src/pages/account/setting/index.jsx b/zy-asrs-flow/src/pages/account/setting/index.jsx
index 85141e9..e728f36 100644
--- a/zy-asrs-flow/src/pages/account/setting/index.jsx
+++ b/zy-asrs-flow/src/pages/account/setting/index.jsx
@@ -1,100 +1,102 @@
-import { GridContent } from '@ant-design/pro-components';
-import { Menu } from 'antd';
-import React, { useLayoutEffect, useRef, useState } from 'react';
-import BaseView from './components/base';
-import SecurityView from './components/security';
-import useStyles from './style.style';
-
-const menuMap = {
- base: '鍩烘湰璁剧疆',
- security: '瀹夊叏璁剧疆',
-};
-
-const getMenu = () => {
- return Object.keys(menuMap).map((item) => ({ key: item, label: menuMap[item] }));
-};
-
-const Settings = () => {
- const { styles } = useStyles();
- const [initConfig, setInitConfig] = useState({
- mode: 'inline',
- selectKey: 'base',
- });
-
- const dom = useRef();
-
- const resize = () => {
- requestAnimationFrame(() => {
- if (!dom.current) {
- return;
- }
- let mode = 'inline';
- const { offsetWidth } = dom.current;
- if (dom.current.offsetWidth < 641 && offsetWidth > 400) {
- mode = 'horizontal';
- }
- if (window.innerWidth < 768 && offsetWidth > 400) {
- mode = 'horizontal';
- }
- setInitConfig({
- ...initConfig,
- mode: mode,
- });
- });
- };
-
- useLayoutEffect(() => {
- if (dom.current) {
- window.addEventListener('resize', resize);
- resize();
- }
- return () => {
- window.removeEventListener('resize', resize);
- };
- }, [dom.current]);
-
- const renderChildren = () => {
- const { selectKey } = initConfig;
- switch (selectKey) {
- case 'base':
- return <BaseView />;
- case 'security':
- return <SecurityView />;
- default:
- return null;
- }
- };
-
- return (
- <GridContent>
- <div
- className={styles.main}
- ref={(ref) => {
- if (ref) {
- dom.current = ref;
- }
- }}
- >
- <div className={styles.leftMenu}>
- <Menu
- mode={initConfig.mode}
- selectedKeys={[initConfig.selectKey]}
- onClick={({ key }) => {
- setInitConfig({
- ...initConfig,
- selectKey: key,
- });
- }}
- items={getMenu()}
- />
- </div>
- <div className={styles.right}>
- <div className={styles.title}>{menuMap[initConfig.selectKey]}</div>
- {renderChildren()}
- </div>
- </div>
- </GridContent>
- );
-};
-
-export default Settings;
+import { GridContent } from '@ant-design/pro-components';
+import { Menu } from 'antd';
+import React, { useLayoutEffect, useRef, useState } from 'react';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import BaseView from './components/base';
+import SecurityView from './components/security';
+import useStyles from './style.style';
+
+const Settings = () => {
+ const intl = useIntl();
+ const { styles } = useStyles();
+ const [initConfig, setInitConfig] = useState({
+ mode: 'inline',
+ selectKey: 'base',
+ });
+
+ const menuMap = {
+ base: intl.formatMessage({ id: 'personal.base.setting', defaultMessage: '鍩烘湰璁剧疆' }),
+ security: intl.formatMessage({ id: 'personal.security.setting', defaultMessage: '瀹夊叏璁剧疆' }),
+ };
+
+ const getMenu = () => {
+ return Object.keys(menuMap).map((item) => ({ key: item, label: menuMap[item] }));
+ };
+
+ const dom = useRef();
+
+ const resize = () => {
+ requestAnimationFrame(() => {
+ if (!dom.current) {
+ return;
+ }
+ let mode = 'inline';
+ const { offsetWidth } = dom.current;
+ if (dom.current.offsetWidth < 641 && offsetWidth > 400) {
+ mode = 'horizontal';
+ }
+ if (window.innerWidth < 768 && offsetWidth > 400) {
+ mode = 'horizontal';
+ }
+ setInitConfig({
+ ...initConfig,
+ mode: mode,
+ });
+ });
+ };
+
+ useLayoutEffect(() => {
+ if (dom.current) {
+ window.addEventListener('resize', resize);
+ resize();
+ }
+ return () => {
+ window.removeEventListener('resize', resize);
+ };
+ }, [dom.current]);
+
+ const renderChildren = () => {
+ const { selectKey } = initConfig;
+ switch (selectKey) {
+ case 'base':
+ return <BaseView />;
+ case 'security':
+ return <SecurityView />;
+ default:
+ return null;
+ }
+ };
+
+ return (
+ <GridContent>
+ <div
+ className={styles.main}
+ ref={(ref) => {
+ if (ref) {
+ dom.current = ref;
+ }
+ }}
+ >
+ <div className={styles.leftMenu}>
+ <Menu
+ mode={initConfig.mode}
+ selectedKeys={[initConfig.selectKey]}
+ onClick={({ key }) => {
+ setInitConfig({
+ ...initConfig,
+ selectKey: key,
+ });
+ }}
+ items={getMenu()}
+ />
+ </div>
+ <div className={styles.right}>
+ <div className={styles.title}>{menuMap[initConfig.selectKey]}</div>
+ {renderChildren()}
+ </div>
+ </div>
+ </GridContent>
+ );
+};
+
+export default Settings;
--
Gitblit v1.9.1