From 8fffa91200e7b177ad63c1a62fd2ebf90e672f3c Mon Sep 17 00:00:00 2001 From: Iamasoldier <1272745473@qq.com> Date: Thu, 10 Jul 2025 11:11:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E6=97=B6=E9=97=B4=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=8C=E7=99=BB=E5=BD=95=E8=8F=9C=E5=8D=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/frontend/config/proxy.ts | 32 ++++++++--------- .../react-web/src/main/frontend/src/app.tsx | 2 ++ .../orders/Refund/components/UpdateForm.tsx | 34 ++++++++++++++++--- .../frontend/src/pages/user/Login/index.tsx | 6 ++-- 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/zlt-web/react-web/src/main/frontend/config/proxy.ts b/zlt-web/react-web/src/main/frontend/config/proxy.ts index 2b8d0a36..61b5280f 100644 --- a/zlt-web/react-web/src/main/frontend/config/proxy.ts +++ b/zlt-web/react-web/src/main/frontend/config/proxy.ts @@ -9,43 +9,43 @@ export default { dev: { '/api-uaa/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-user/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-log/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-search/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-generator/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-file/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-order/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-device/': { - // target: 'http://119.45.169.13:9900', - target: 'http://127.0.0.1:9900', + target: 'http://119.45.169.13:9900', + // target: 'http://127.0.0.1:9900', changeOrigin: true, }, }, diff --git a/zlt-web/react-web/src/main/frontend/src/app.tsx b/zlt-web/react-web/src/main/frontend/src/app.tsx index 5a114862..04d86989 100644 --- a/zlt-web/react-web/src/main/frontend/src/app.tsx +++ b/zlt-web/react-web/src/main/frontend/src/app.tsx @@ -93,6 +93,8 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) = // 每当 initialState?.currentUser?.userid 发生修改时重新执行 request params: { userId: initialState?.currentUser?.userId, + // 添加一个时间戳来强制重新加载菜单 + timestamp: initialState?.currentUser ? Date.now() : 0, }, request: async () => { try { diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/Refund/components/UpdateForm.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/Refund/components/UpdateForm.tsx index f80c8b5f..20cb7ed3 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/orders/Refund/components/UpdateForm.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/Refund/components/UpdateForm.tsx @@ -24,6 +24,30 @@ const formatAmount = (amount?: string | number | null) => { return `¥ ${(Number(amount) / 100).toFixed(2)}`; }; +// 时间格式化:处理时区问题 +const formatDateTime = (dateTime?: string | null) => { + if (!dateTime) return '-'; + try { + // 如果时间已经是ISO格式,直接解析 + const date = new Date(dateTime); + if (isNaN(date.getTime())) { + return dateTime; // 如果解析失败,返回原始值 + } + // 格式化为本地时间 + return date.toLocaleString('zh-CN', { + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + }); + } catch (error) { + return dateTime; // 如果出错,返回原始值 + } +}; + const UpdateForm: React.FC = (props) => { const { values } = props; @@ -54,13 +78,13 @@ const UpdateForm: React.FC = (props) => { {formatAmount(values?.refundAmount)} - - {ORDER_STATUS[values?.status]?.text || '未知状态'} + + {(ORDER_STATUS as any)[Number(values?.status)]?.text || '未知状态'} - - {REFUND_STATUS[values?.state]?.text || '未知状态'} + + {(REFUND_STATUS as any)[Number(values?.state)]?.text || '未知状态'} @@ -87,7 +111,7 @@ const UpdateForm: React.FC = (props) => { )} - {values?.createTime} + {formatDateTime(values?.createTime)} diff --git a/zlt-web/react-web/src/main/frontend/src/pages/user/Login/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/user/Login/index.tsx index 6792fa20..80692a48 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/user/Login/index.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/user/Login/index.tsx @@ -68,12 +68,14 @@ const Login: React.FC = () => { sessionStorage.setItem('access_token', msg.data.access_token); if (mountedRef.current) { message.success('登录成功!'); + // 先获取用户信息 await fetchUserInfo(); + // 强制重新获取用户信息以触发菜单重新加载 await initialState?.fetchUserInfo?.(); - + // 直接刷新页面,确保菜单栏正常显示 const { query } = history.location; const { redirect } = query as { redirect: string }; - history.push(redirect || '/'); + window.location.href = redirect || '/'; return; } }