From a7dd3e49a95af86117104cf1994890e79d3c392f Mon Sep 17 00:00:00 2001 From: ZHENG XIAOYI Date: Fri, 6 Feb 2026 15:40:26 +0800 Subject: [PATCH] feat: improve user interface layout for better accessibility --- src/App.tsx | 2 - src/components/AdminLayout.tsx | 8 -- src/pages/AdminQuery.tsx | 100 --------------- src/pages/Generate.tsx | 217 ++++++++++++++++++--------------- src/pages/styles/Generate.css | 3 + 5 files changed, 119 insertions(+), 211 deletions(-) delete mode 100644 src/pages/AdminQuery.tsx create mode 100644 src/pages/styles/Generate.css diff --git a/src/App.tsx b/src/App.tsx index d4a6190..a6d7383 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,7 +6,6 @@ import PublicQueryPage from './pages/PublicQuery'; import DashboardPage from './pages/Dashboard'; import GeneratePage from './pages/Generate'; import ManagePage from './pages/Manage'; -import AdminQueryPage from './pages/AdminQuery'; import ProfilePage from './pages/Profile'; const PrivateRoute = () => { @@ -39,7 +38,6 @@ function App() { } /> } /> } /> - } /> } /> diff --git a/src/components/AdminLayout.tsx b/src/components/AdminLayout.tsx index 00d9f3c..a87e1ce 100644 --- a/src/components/AdminLayout.tsx +++ b/src/components/AdminLayout.tsx @@ -4,7 +4,6 @@ import { DashboardOutlined, QrcodeOutlined, TeamOutlined, - SearchOutlined, UserOutlined, LogoutOutlined, LockOutlined, @@ -40,12 +39,6 @@ function AdminLayout() { label: '企业管理', onClick: () => navigate('/admin/manage'), }, - { - key: 'query', - icon: , - label: '序列号查询', - onClick: () => navigate('/admin/query'), - }, ]; const handleLogout = () => { @@ -99,7 +92,6 @@ function AdminLayout() { if (path.includes('/dashboard')) return 'dashboard'; if (path.includes('/generate')) return 'generate'; if (path.includes('/manage')) return 'manage'; - if (path.includes('/query')) return 'query'; if (path.includes('/profile')) return 'profile'; return 'dashboard'; }; diff --git a/src/pages/AdminQuery.tsx b/src/pages/AdminQuery.tsx deleted file mode 100644 index e211e6c..0000000 --- a/src/pages/AdminQuery.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { useState } from 'react'; -import { Form, Input, Button, Card, message, Result, Alert } from 'antd'; -import { SearchOutlined } from '@ant-design/icons'; -import { serialApi } from '@/services/api'; -import type { Serial } from '@/types'; - -function AdminQueryPage() { - const [form] = Form.useForm(); - const [loading, setLoading] = useState(false); - const [result, setResult] = useState(null); - const [error, setError] = useState(null); - - const handleQuery = async (values: { serialNumber: string }) => { - setLoading(true); - setError(null); - setResult(null); - - try { - const data = await serialApi.query(values.serialNumber.trim()); - setResult(data); - message.success('查询成功!'); - } catch (err: any) { - setError(err.message || '查询失败'); - } finally { - setLoading(false); - } - }; - - return ( -
- -
- - - - - - - -
-
- - {result && ( - - - - -

序列号: {result.serialNumber}

-

企业名称: {result.companyName}

-

授权状态: 有效

-

有效期至: {new Date(result.validUntil).toLocaleString('zh-CN')}

-

创建时间: {new Date(result.createdAt).toLocaleString('zh-CN')}

-
- } - type="success" - showIcon - /> - - )} - - {error && ( - - - - )} - - ); -} - -export default AdminQueryPage; \ No newline at end of file diff --git a/src/pages/Generate.tsx b/src/pages/Generate.tsx index 5e7bd17..46d3191 100644 --- a/src/pages/Generate.tsx +++ b/src/pages/Generate.tsx @@ -1,9 +1,10 @@ import { useState } from 'react'; -import { Form, Input, Button, Card, Radio, InputNumber, DatePicker, message, Modal, Space, ColorPicker, Divider } from 'antd'; +import { Form, Input, Button, Card, Radio, InputNumber, DatePicker, message, Modal, Space, ColorPicker, Divider, Row, Col } from 'antd'; import { QrcodeOutlined } from '@ant-design/icons'; import QRCode from 'qrcode'; import type { Color } from 'antd/es/color-picker'; import { useNavigate } from 'react-router-dom'; +import './styles/Generate.css'; function GeneratePage() { const [form] = Form.useForm(); @@ -93,8 +94,16 @@ function GeneratePage() { }; return ( -
- +
+ + + 生成二维码 + + } + bordered={false} + >
- - - + + + + + - - - 自动生成 - 自定义前缀 - - + + + 自动生成 + 自定义前缀 + + - prevValues.serialOption !== currentValues.serialOption} - > - {({ getFieldValue }) => - getFieldValue('serialOption') === 'custom' ? ( - - - - ) : null - } - + prevValues.serialOption !== currentValues.serialOption} + > + {({ getFieldValue }) => + getFieldValue('serialOption') === 'custom' ? ( + + + + ) : null + } + - - - + + + + - - - 按天数 - 按日期 - - + + + + 按天数 + 按日期 + + - prevValues.validOption !== currentValues.validOption} - > - {({ getFieldValue }) => - getFieldValue('validOption') === 'days' ? ( - - - - ) : ( - - - - ) - } - + prevValues.validOption !== currentValues.validOption} + > + {({ getFieldValue }) => + getFieldValue('validOption') === 'days' ? ( + + + + ) : ( + + + + ) + } + - -
-
- {colorPresets.map((color) => ( -
setQrColor(color)} - style={{ - width: '32px', - height: '32px', - backgroundColor: color, - border: qrColor === color ? '2px solid #165DFF' : '2px solid #d9d9d9', - borderRadius: '4px', - cursor: 'pointer', - transition: 'all 0.2s', + +
+
+ {colorPresets.map((color) => ( +
setQrColor(color)} + style={{ + width: '32px', + height: '32px', + backgroundColor: color, + border: qrColor === color ? '2px solid #165DFF' : '2px solid #d9d9d9', + borderRadius: '4px', + cursor: 'pointer', + transition: 'all 0.2s', + }} + /> + ))} +
+ + { + const hexColor = color.toHexString(); + setQrColor(hexColor); }} + showText /> - ))} -
- - { - const hexColor = color.toHexString(); - setQrColor(hexColor); - }} - showText - /> -
-
+
+ + +