From ddb04ff15e58cb12f802021889b7add9b1eab47e Mon Sep 17 00:00:00 2001 From: mamamiyear Date: Tue, 21 Oct 2025 11:47:28 +0800 Subject: [PATCH] feat: basic layout and pages - add basic layout with sidebar and main container - add three menus in sidebar - add people form page for post people - add text and image input for recognize people info - add people table page for show peoples --- package.json | 6 +- src/App.tsx | 35 +- src/components/HintText.css | 2 + src/components/HintText.tsx | 12 + src/components/InputPanel.css | 19 + src/components/InputPanel.tsx | 64 ++++ src/components/KeyValueList.css | 17 + src/components/KeyValueList.tsx | 113 ++++++ src/components/LayoutWrapper.tsx | 58 +++ src/components/MainContent.css | 2 + src/components/MainContent.tsx | 32 ++ src/components/PeopleForm.css | 26 ++ src/components/PeopleForm.tsx | 87 +++++ src/components/ResourceList.tsx | 612 +++++++++++++++++++++++++++++++ src/components/SiderMenu.css | 19 + src/components/SiderMenu.tsx | 112 ++++++ src/index.css | 71 +--- src/main.tsx | 9 +- src/styles/base.css | 36 ++ src/styles/layout.css | 54 +++ 20 files changed, 1284 insertions(+), 102 deletions(-) create mode 100644 src/components/HintText.css create mode 100644 src/components/HintText.tsx create mode 100644 src/components/InputPanel.css create mode 100644 src/components/InputPanel.tsx create mode 100644 src/components/KeyValueList.css create mode 100644 src/components/KeyValueList.tsx create mode 100644 src/components/LayoutWrapper.tsx create mode 100644 src/components/MainContent.css create mode 100644 src/components/MainContent.tsx create mode 100644 src/components/PeopleForm.css create mode 100644 src/components/PeopleForm.tsx create mode 100644 src/components/ResourceList.tsx create mode 100644 src/components/SiderMenu.css create mode 100644 src/components/SiderMenu.tsx create mode 100644 src/styles/base.css create mode 100644 src/styles/layout.css diff --git a/package.json b/package.json index 002ab2b..2e73cd3 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,12 @@ "preview": "vite preview" }, "dependencies": { + "@ant-design/icons": "^6.1.0", + "@ant-design/v5-patch-for-react-19": "^1.0.3", + "antd": "^5.27.0", "react": "^19.1.1", - "react-dom": "^19.1.1" + "react-dom": "^19.1.1", + "react-router-dom": "^6.30.1" }, "devDependencies": { "@eslint/js": "^9.36.0", diff --git a/src/App.tsx b/src/App.tsx index 3d7ded3..081172b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,35 +1,8 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -import './App.css' +import React from 'react'; +import LayoutWrapper from './components/LayoutWrapper'; function App() { - const [count, setCount] = useState(0) - - return ( - <> -
- - Vite logo - - - React logo - -
-

Vite + React

-
- -

- Edit src/App.tsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

- - ) + return ; } -export default App +export default App; diff --git a/src/components/HintText.css b/src/components/HintText.css new file mode 100644 index 0000000..cf451de --- /dev/null +++ b/src/components/HintText.css @@ -0,0 +1,2 @@ +/* 提示信息组件样式 */ +/* 文字样式在 layout.css 的 .hint-text 中定义,此处预留扩展 */ \ No newline at end of file diff --git a/src/components/HintText.tsx b/src/components/HintText.tsx new file mode 100644 index 0000000..34fabd3 --- /dev/null +++ b/src/components/HintText.tsx @@ -0,0 +1,12 @@ +import React from 'react'; +import './HintText.css'; + +const HintText: React.FC = () => { + return ( +
+ 提示:支持输入多行文本与上传图片。按 Enter 发送,Shift+Enter 换行。 +
+ ); +}; + +export default HintText; \ No newline at end of file diff --git a/src/components/InputPanel.css b/src/components/InputPanel.css new file mode 100644 index 0000000..d7f9799 --- /dev/null +++ b/src/components/InputPanel.css @@ -0,0 +1,19 @@ +/* 输入面板组件样式 */ +.input-panel { + display: flex; + flex-direction: column; + gap: 8px; +} + +.input-panel .ant-input-outlined, +.input-panel .ant-input { + background: rgba(255,255,255,0.04); + color: #e5e7eb; +} + +.input-actions { + display: flex; + align-items: center; + justify-content: flex-end; + gap: 8px; +} \ No newline at end of file diff --git a/src/components/InputPanel.tsx b/src/components/InputPanel.tsx new file mode 100644 index 0000000..136e8b7 --- /dev/null +++ b/src/components/InputPanel.tsx @@ -0,0 +1,64 @@ +import React from 'react'; +import { Input, Upload, message, Button } from 'antd'; +import { PictureOutlined, SendOutlined } from '@ant-design/icons'; +import './InputPanel.css'; + +const { TextArea } = Input; + +const InputPanel: React.FC = () => { + const [value, setValue] = React.useState(''); + const [fileList, setFileList] = React.useState([]); + + const send = () => { + const hasText = value.trim().length > 0; + const hasImage = fileList.length > 0; + if (!hasText && !hasImage) { + message.info('请输入内容或上传图片'); + return; + } + // 此处替换为真实发送逻辑 + console.log('发送内容:', { text: value, files: fileList }); + setValue(''); + setFileList([]); + message.success('已发送'); + }; + + const onKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + if (e.shiftKey) { + // Shift+Enter 换行(保持默认行为) + return; + } + // Enter 发送 + e.preventDefault(); + send(); + } + }; + + return ( +
+