|
@@ -0,0 +1,91 @@
|
|
|
+import PageHeader from '../../components/PageHeader';
|
|
|
+import { Input, Button, Form, Upload } from 'antd';
|
|
|
+import { PlusOutlined } from '@ant-design/icons';
|
|
|
+import './TodoAdd.scss';
|
|
|
+//! 引入组件 并通过 as 重命名
|
|
|
+import { Form as RouterForm } from 'react-router-dom';
|
|
|
+
|
|
|
+const { TextArea } = Input;
|
|
|
+
|
|
|
+function TodoAdd() {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <PageHeader>新增代办</PageHeader>
|
|
|
+ <div className="todo-add">
|
|
|
+ <Form
|
|
|
+ labelCol={{
|
|
|
+ span: 4,
|
|
|
+ }}
|
|
|
+ wrapperCol={{
|
|
|
+ span: 14,
|
|
|
+ }}
|
|
|
+ layout="horizontal"
|
|
|
+ style={{
|
|
|
+ maxWidth: 600,
|
|
|
+ margin: '0 auto',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <RouterForm method="post">
|
|
|
+ <Form.Item
|
|
|
+ label="代办标题"
|
|
|
+ rules={[{ required: true, message: '必须填写代办标题!' }]}
|
|
|
+ >
|
|
|
+ <Input placeholder="输入代办标题..." name="title" required />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="详细描述"
|
|
|
+ rules={[
|
|
|
+ { min: 0, max: 125, message: '代办详情字数在0-125之间!' },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <TextArea
|
|
|
+ showCount
|
|
|
+ maxLength={125}
|
|
|
+ style={{ height: 120, marginBottom: 24 }}
|
|
|
+ name="description"
|
|
|
+ placeholder="输入代办详细信息..."
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item label="代办封面">
|
|
|
+ <Upload listType="picture-card" accept="image/*">
|
|
|
+ <div>
|
|
|
+ <PlusOutlined />
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ marginTop: 8,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 上传
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Upload>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ wrapperCol={{
|
|
|
+ offset: 4,
|
|
|
+ span: 13,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Button htmlType="submit" block type="primary">
|
|
|
+ 提交
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </RouterForm>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+export default TodoAdd;
|
|
|
+
|
|
|
+export async function todoAddAction({ request }) {
|
|
|
+ //! 在添加代办时 会发起当前路由的一个post请求,下面是获取请求体数据
|
|
|
+ let formData = await request.formData();
|
|
|
+
|
|
|
+ let data = Object.fromEntries(formData);
|
|
|
+
|
|
|
+ console.log(data);
|
|
|
+ return null;
|
|
|
+}
|