diff --git a/config/defaultSettings.ts b/config/defaultSettings.ts index d627ccd..3dd59b9 100644 --- a/config/defaultSettings.ts +++ b/config/defaultSettings.ts @@ -7,7 +7,7 @@ const Settings: ProLayoutProps & { pwa?: boolean; logo?: string; } = { - navTheme: 'realDark', + navTheme: 'light', // 拂晓蓝 colorPrimary: '#2F54EB', layout: 'side', diff --git a/config/routes.ts b/config/routes.ts index 171c4cb..9673f3f 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -51,6 +51,12 @@ export default [ path: '/list', component: './table-list', }, + { + name: 'history', + icon: 'history', + path: '/history', + component: './history', + }, { path: '/', redirect: '/welcome', diff --git a/package.json b/package.json index bec8bd3..87a05a0 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,9 @@ "test:update": "npm run jest -- -u", "tsc": "tsc --noEmit" }, - "browserslist": ["defaults"], + "browserslist": [ + "defaults" + ], "dependencies": { "@ant-design/icons": "^5.6.1", "@ant-design/pro-components": "^2.7.19", @@ -40,6 +42,7 @@ "antd-style": "^3.7.0", "classnames": "^2.5.1", "dayjs": "^1.11.13", + "rc-tween-one": "^3.0.6", "react": "^19.1.0", "react-dom": "^19.1.0" }, @@ -71,5 +74,7 @@ "umi-presets-pro": "^2.0.3", "umi-serve": "^1.9.11" }, - "engines": { "node": ">=20.0.0" } + "engines": { + "node": ">=20.0.0" + } } diff --git a/src/locales/zh-CN/menu.ts b/src/locales/zh-CN/menu.ts index fecb70a..4e04eb0 100644 --- a/src/locales/zh-CN/menu.ts +++ b/src/locales/zh-CN/menu.ts @@ -49,4 +49,5 @@ export default { 'menu.editor.flow': '流程编辑器', 'menu.editor.mind': '脑图编辑器', 'menu.editor.koni': '拓扑编辑器', + 'menu.history': "对话历史", }; diff --git a/src/pages/Welcome.less b/src/pages/Welcome.less new file mode 100644 index 0000000..877bd87 --- /dev/null +++ b/src/pages/Welcome.less @@ -0,0 +1,20 @@ +.WelcomePage { + .PageHeader { + height: 30vh; + } + + .CenterCard { + width: 50vw; + padding: 18px 18px 0 18px; + background-color: white; + border-radius: 8px; + padding-bottom: 24px, + } + + .Flex { + flex: 1; + .ant-form-item { + --ant-form-item-margin-bottom: 0; + } + } +} \ No newline at end of file diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx index 1252686..4684f79 100644 --- a/src/pages/Welcome.tsx +++ b/src/pages/Welcome.tsx @@ -1,15 +1,126 @@ -import { PageContainer, ProCard } from '@ant-design/pro-components'; +import { PageContainer, ProForm, ProFormTextArea } from '@ant-design/pro-components'; import { useModel } from '@umijs/max'; -import { Card, theme } from 'antd'; -import React from 'react'; +import { Button, Divider, Dropdown, Flex, MenuProps, message, Space, Tag, theme } from 'antd'; +import React, { useRef, useState } from 'react'; +import './Welcome.less' +import { FileSearchOutlined, GlobalOutlined, PlusOutlined } from '@ant-design/icons'; +import { TweenOneGroup } from 'rc-tween-one'; +const tagGroupStyle: React.CSSProperties = { + display: 'flex', + alignItems: 'center', + flexWrap: 'wrap', + gap: 8, + marginBottom: 8, + marginTop: 16, +}; const Welcome: React.FC = () => { const { token } = theme.useToken(); const { initialState } = useModel('@@initialState'); + const textAreaRef = useRef(null); + const [tools, setTools] = useState([]); + + const textAreaFieldProps:any = { + ref: textAreaRef, + autoSize: { + minRows: 1, + maxRows: 5, + }, + variant: 'borderless', + onPressEnter: (e:any) => { + const { nativeEvent: { shiftKey, key } } = e; + if (shiftKey && key === "Enter") { + const { current: { resizableTextArea: { textArea } } } = textAreaRef; + e.preventDefault(); + const text = textArea?.value; + console.log(text); + textArea.value = ""; + } + } + } + + const items = [{ + key: 'searchWeb', + label: '搜索网站', + color: '#55acee', + icon: , + }, { + key: 'searchKB', + label: '知识库', + color: '#55acee', + icon: , + children: [ + { key: 'searchKB_kb1', label: '知识库1' }, + { key: 'searchKB_kb2', label: '知识库2' }, + { type: 'divider' }, + { key: 'searchKB_add', label: '新增知识库' }, + ], + }] + + const itemOnClick = ({ key }: any) => { + if (key === 'searchKB_add') { + message.info("创建知识库") + return; + } + const toolsKeys:string[] = tools?.map((e: any) => e.key); + if (toolsKeys?.includes(key)) { + setTools(tools.filter((e: any) => e.key !== key)); + return; + } + if (key.includes('kb')) { + const kbObj = items?.find(i => i.key === 'searchKB') + const obj = kbObj?.children?.find(i => i.key === key); + setTools([{...obj, icon: kbObj?.icon}, ...tools]); + } else { + const obj = items?.find(i => i.key === key); + setTools([obj, ...tools]); + } + } + + const Tags = () => { + if (tools?.length) { + return (<> + + { + if (e.type === 'appear' || e.type === 'enter') { + (e.target as any).style = 'display: inline-block'; + } + }} + > + {tools?.map((e: any) => itemOnClick({ key: e.key })}> + {e.label} + )} + + + ) + } + return <> + } + return ( - - + + +
+
+ + + + + +
+ +
+
+
+ +
+
); }; diff --git a/src/pages/history/index.tsx b/src/pages/history/index.tsx new file mode 100644 index 0000000..95f19a0 --- /dev/null +++ b/src/pages/history/index.tsx @@ -0,0 +1,8 @@ +import { PageContainer } from "@ant-design/pro-components" +const HistoryPage = () => { + return + + +} + +export default HistoryPage; \ No newline at end of file