diff --git a/src/App.tsx b/src/App.tsx
index ac2b3a3..8e9dbb6 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -7,6 +7,7 @@ import { App as CodeEditorApp } from './pages/code-editor';
import { App as MapApp } from './pages/map';
import { App as PromptApp } from './pages/prompt';
import { App as AiAgentApp } from './pages/ai-agent';
+import { App as UserApp } from './pages/user';
import '@abearxiong/container/dist/container.css';
export const App = () => {
@@ -26,6 +27,7 @@ export const App = () => {
} />
} />
} />
+ } />
404} />
404} />
diff --git a/src/pages/user/edit/List.tsx b/src/pages/user/edit/List.tsx
new file mode 100644
index 0000000..4862107
--- /dev/null
+++ b/src/pages/user/edit/List.tsx
@@ -0,0 +1,198 @@
+import { Button, Input, message, Modal, Table } from 'antd';
+import { Fragment, useEffect, useMemo, useState } from 'react';
+import { useUserStore } from '../store';
+import { useShallow } from 'zustand/react/shallow';
+import { Form } from 'antd';
+import { useNavigate } from 'react-router';
+import { EditOutlined, SettingOutlined, LinkOutlined, SaveOutlined, DeleteOutlined, LeftOutlined } from '@ant-design/icons';
+import clsx from 'clsx';
+import { isObjectNull } from '@/utils/is-null';
+import { CardBlank } from '@/components/card/CardBlank';
+
+const FormModal = () => {
+ const [form] = Form.useForm();
+ const userStore = useUserStore(
+ useShallow((state) => {
+ return {
+ showEdit: state.showEdit,
+ setShowEdit: state.setShowEdit,
+ formData: state.formData,
+ updateData: state.updateData,
+ setFormData: state.setFormData,
+ };
+ }),
+ );
+ useEffect(() => {
+ const open = userStore.showEdit;
+ if (open) {
+ const isNull = isObjectNull(userStore.formData);
+ if (isNull) {
+ form.setFieldsValue({});
+ } else form.setFieldsValue(userStore.formData);
+ }
+ }, [userStore.showEdit]);
+ const onFinish = async (values: any) => {
+ userStore.updateData(values);
+ };
+ const onClose = () => {
+ userStore.setShowEdit(false);
+ form.setFieldsValue({});
+ userStore.setFormData({});
+ };
+ const isEdit = userStore.formData.id;
+ return (
+ userStore.setShowEdit(false)}
+ destroyOnClose
+ footer={false}
+ width={800}
+ onCancel={onClose}>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+export const List = () => {
+ const navicate = useNavigate();
+ const userStore = useUserStore(
+ useShallow((state) => {
+ return {
+ setFormData: state.setFormData,
+ setShowEdit: state.setShowEdit,
+ list: state.list,
+ deleteData: state.deleteData,
+ getList: state.getList,
+ loading: state.loading,
+ updateData: state.updateData,
+ formData: state.formData,
+ };
+ }),
+ );
+ const [codeEdit, setCodeEdit] = useState(false);
+ const [code, setCode] = useState('');
+ useEffect(() => {
+ userStore.getList();
+ }, []);
+
+ const onAdd = () => {
+ userStore.setFormData({});
+ userStore.setShowEdit(true);
+ };
+ return (
+
+
+
+
+ {userStore.list.length > 0 &&
+ userStore.list.map((item) => {
+ return (
+
+ {
+ setCode(item.code);
+ userStore.setFormData(item);
+ setCodeEdit(true);
+ }}>
+
+
{
+ e.stopPropagation();
+ // message.success('copy code success');
+ }}>
+ {item.username || '-'}
+
+
{item.description ? item.description : '-'}
+
+
+
+
+
+
+
+
+
+ );
+ })}
+
+ {userStore.list.length == 0 && (
+
+ No Data
+
+ )}
+
+
+
+
+
+
+
+
+
+
+ {
+ // setCode(value);
+ }}
+ className='h-full max-h-full scrollbar'
+ style={{ overflow: 'auto' }}
+ />
+
+
+
+
+
+ );
+};
diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx
new file mode 100644
index 0000000..d02cc86
--- /dev/null
+++ b/src/pages/user/index.tsx
@@ -0,0 +1,14 @@
+import { Navigate, Route, Routes } from 'react-router-dom';
+import { List } from './edit/List';
+import { Main } from './layouts';
+export const App = () => {
+ return (
+
+ }>
+ }>
+ } />
+
+
+ );
+};
+
diff --git a/src/pages/user/layouts/index.tsx b/src/pages/user/layouts/index.tsx
new file mode 100644
index 0000000..378382a
--- /dev/null
+++ b/src/pages/user/layouts/index.tsx
@@ -0,0 +1,46 @@
+import { PlusOutlined } from '@ant-design/icons';
+import { Button } from 'antd';
+import { Outlet, useLocation } from 'react-router';
+import { useUserStore } from '../store';
+import { useEffect } from 'react';
+import { useShallow } from 'zustand/react/shallow';
+
+export const Main = () => {
+ const containerStore = useUserStore(
+ useShallow((state) => {
+ return {
+ setFormData: state.setFormData,
+ setShowEdit: state.setShowEdit,
+ };
+ }),
+ );
+ const location = useLocation();
+ const isEdit = location.pathname.includes('edit/list');
+ return (
+
+
+ User
+ }
+ onClick={() => {
+ console.log('add');
+ containerStore.setFormData({});
+ containerStore.setShowEdit(true);
+ }}
+ />
+
+
+
+ );
+};
diff --git a/src/pages/user/store/index.ts b/src/pages/user/store/index.ts
new file mode 100644
index 0000000..8fca1cd
--- /dev/null
+++ b/src/pages/user/store/index.ts
@@ -0,0 +1,69 @@
+import { create } from 'zustand';
+import { query } from '@/modules';
+import { message } from 'antd';
+type UserStore = {
+ showEdit: boolean;
+ setShowEdit: (showEdit: boolean) => void;
+ formData: any;
+ setFormData: (formData: any) => void;
+ loading: boolean;
+ setLoading: (loading: boolean) => void;
+ list: any[];
+ getList: () => Promise;
+ updateData: (data: any) => Promise;
+ deleteData: (id: string) => Promise;
+};
+export const useUserStore = create((set, get) => {
+ return {
+ showEdit: false,
+ setShowEdit: (showEdit) => set({ showEdit }),
+ formData: {},
+ setFormData: (formData) => set({ formData }),
+ loading: false,
+ setLoading: (loading) => set({ loading }),
+ list: [],
+ getList: async () => {
+ set({ loading: true });
+
+ const res = await query.post({
+ path: 'user',
+ key: 'list',
+ });
+ set({ loading: false });
+ if (res.code === 200) {
+ set({ list: res.data });
+ } else {
+ message.error(res.msg || 'Request failed');
+ }
+ },
+ updateData: async (data) => {
+ const { getList } = get();
+ const res = await query.post({
+ path: 'user',
+ key: 'update',
+ data,
+ });
+ if (res.code === 200) {
+ message.success('Success');
+ set({ showEdit: false, formData: [] });
+ getList();
+ } else {
+ message.error(res.msg || 'Request failed');
+ }
+ },
+ deleteData: async (id) => {
+ const { getList } = get();
+ const res = await query.post({
+ path: 'user',
+ key: 'delete',
+ id,
+ });
+ if (res.code === 200) {
+ getList();
+ message.success('Success');
+ } else {
+ message.error(res.msg || 'Request failed');
+ }
+ },
+ };
+});
diff --git a/theme b/theme
index 6f6d64b..36f865b 160000
--- a/theme
+++ b/theme
@@ -1 +1 @@
-Subproject commit 6f6d64b06574609f5b468f2011d2c21600261419
+Subproject commit 36f865b026b70cd8f90a44f4d3b5f9dced9709af