From 48d1fba699e0dcca943c052e6fde0f29e9d6d44b Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 22 Jan 2024 23:36:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=87=8D=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/api/user.ts | 3 ++ src/locales/en-US.json | 1 + src/locales/zh-CN.json | 1 + src/pages/setting/checkUpdate.tsx | 67 +++++++++++++++++++------------ src/pages/setting/index.tsx | 27 ++++++++----- 5 files changed, 63 insertions(+), 36 deletions(-) diff --git a/back/api/user.ts b/back/api/user.ts index 9da8250a..cdb0eb61 100644 --- a/back/api/user.ts +++ b/back/api/user.ts @@ -74,6 +74,9 @@ export default (app: Router) => { async (req: Request, res: Response, next: NextFunction) => { const logger: Logger = Container.get('logger'); try { + if (process.env.DeployEnv === 'demo') { + return res.send({ code: 450, message: '未知错误' }); + } const userService = Container.get(UserService); await userService.updateUsernameAndPassword(req.body); res.send({ code: 200, message: '更新成功' }); diff --git a/src/locales/en-US.json b/src/locales/en-US.json index ca2d18de..b1bfcfb1 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -237,6 +237,7 @@ "系统将在": "The system will restart in", "秒后自动刷新": "seconds and automatically refresh", "检查更新": "Check for Updates", + "重新启动": "Reboot", "确认删除应用": "Confirm to delete the application", "确认重置": "Confirm to reset", "确认重置应用": "Confirm to reset the application", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 90ecb834..d1eff815 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -237,6 +237,7 @@ "系统将在": "系统将在", "秒后自动刷新": "秒后自动刷新", "检查更新": "检查更新", + "重新启动": "重新启动", "确认删除应用": "确认删除应用", "确认重置": "确认重置", "确认重置应用": "确认重置应用", diff --git a/src/pages/setting/checkUpdate.tsx b/src/pages/setting/checkUpdate.tsx index bcf835f9..14571e2b 100644 --- a/src/pages/setting/checkUpdate.tsx +++ b/src/pages/setting/checkUpdate.tsx @@ -77,7 +77,11 @@ const CheckUpdate = ({ systemInfo }: any) => { ), - content:
{lastLog}
, + content: ( +
+          {lastLog}
+        
+ ), okText: intl.get('下载更新'), cancelText: intl.get('以后再说'), onOk() { @@ -102,10 +106,41 @@ const CheckUpdate = ({ systemInfo }: any) => { okButtonProps: { disabled: true }, title: intl.get('下载更新中...'), centered: true, - content:
{value}
, + content: ( +
+          {value}
+        
+ ), }); }; + const reloadSystem = () => { + request + .put(`${config.apiPrefix}system/reload`, { type: 'system' }) + .then((_data: any) => { + message.success({ + content: ( + + {intl.get('系统将在')} + + {intl.get('秒后自动刷新')} + + ), + duration: 30, + }); + setTimeout(() => { + window.location.reload(); + }, 30000); + }) + .catch((error: any) => { + console.log(error); + }); + }; + const showReloadModal = () => { Modal.confirm({ width: 600, @@ -115,30 +150,7 @@ const CheckUpdate = ({ systemInfo }: any) => { content: intl.get('系统安装包下载成功,确认重启'), okText: intl.get('重启'), onOk() { - request - .put(`${config.apiPrefix}system/reload`, { type: 'system' }) - .then((_data: any) => { - message.success({ - content: ( - - {intl.get('系统将在')} - - {intl.get('秒后自动刷新')} - - ), - duration: 30, - }); - setTimeout(() => { - window.location.reload(); - }, 30000); - }) - .catch((error: any) => { - console.log(error); - }); + reloadSystem(); }, onCancel() { modalRef.current.update({ @@ -206,6 +218,9 @@ const CheckUpdate = ({ systemInfo }: any) => { + ); }; diff --git a/src/pages/setting/index.tsx b/src/pages/setting/index.tsx index d5df629b..78d1e0c4 100644 --- a/src/pages/setting/index.tsx +++ b/src/pages/setting/index.tsx @@ -75,11 +75,19 @@ const Setting = () => { title: intl.get('权限'), dataIndex: 'scopes', key: 'scopes', - width: '40%', + width: 500, render: (text: string, record: any) => { - return record.scopes.map((scope: any) => { - return {(config.scopesMap as any)[scope]}; - }); + return ( +
+ {record.scopes.map((scope: any) => { + return ( + + {(config.scopesMap as any)[scope]} + + ); + })} +
+ ); }, }, { @@ -348,7 +356,9 @@ const Setting = () => { { key: 'syslog', label: intl.get('系统日志'), - children: , + children: ( + + ), }, { key: 'login', @@ -358,16 +368,13 @@ const Setting = () => { { key: 'dependence', label: intl.get('依赖设置'), - children: + children: , }, { key: 'other', label: intl.get('其他设置'), children: ( - + ), }, {