|
@@ -1,19 +1,20 @@
|
1
|
|
-import { Input, Card, Select, Button, message, Upload, Modal } from "antd"
|
2
|
|
-import { useEffect, useState } from 'react'
|
3
|
|
-import { Form } from "antd";
|
|
1
|
+import { Input, Card, Select, Button, message, Upload, Modal } from 'antd';
|
|
2
|
+import { useEffect, useState } from 'react';
|
|
3
|
+import { Form } from 'antd';
|
4
|
4
|
import { history } from 'umi';
|
5
|
|
-import ProCard from '@ant-design/pro-card'
|
6
|
|
-import { UploadOutlined } from '@ant-design/icons';
|
|
5
|
+import ProCard from '@ant-design/pro-card';
|
|
6
|
+import { UploadImage } from '@/components/Upload';
|
|
7
|
+import ExtendContent from '@/components/ExtendContent';
|
7
|
8
|
|
8
|
|
-const { Option } = Select
|
|
9
|
+const { Option } = Select;
|
9
|
10
|
const goBack = () => {
|
10
|
|
- history.goBack()
|
11
|
|
-}
|
12
|
|
-const FormItem = Form.Item
|
|
11
|
+ history.goBack();
|
|
12
|
+};
|
|
13
|
+const FormItem = Form.Item;
|
13
|
14
|
export default (props) => {
|
14
|
|
-
|
15
|
|
- const [form] = Form.useForm()
|
16
|
|
- const [loading, setLoading] = useState(false)
|
|
15
|
+ const [form] = Form.useForm();
|
|
16
|
+ const [loading, setLoading] = useState(false);
|
|
17
|
+ const [image, setImage] = useState();
|
17
|
18
|
|
18
|
19
|
const formItemLayout = {
|
19
|
20
|
//布局
|
|
@@ -21,36 +22,51 @@ export default (props) => {
|
21
|
22
|
wrapperCol: { span: 14 },
|
22
|
23
|
};
|
23
|
24
|
|
24
|
|
- const Submit = values => {
|
|
25
|
+ const Submit = (values) => {
|
25
|
26
|
message.success(`成功成功成功`);
|
26
|
|
- console.log("🚀 ~ file: index.jsx ~ line 21 ~ values", values)
|
27
|
|
-
|
|
27
|
+ console.log('🚀 ~ file: index.jsx ~ line 21 ~ values', values);
|
28
|
28
|
};
|
29
|
29
|
|
30
|
30
|
return (
|
31
|
|
- <Card >
|
32
|
|
- <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}
|
33
|
|
- >
|
|
31
|
+ <Card>
|
|
32
|
+ <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}>
|
34
|
33
|
<ProCard.TabPane key={1} tab="资讯管理">
|
35
|
|
- <Form {...formItemLayout} onFinish={Submit} form={form} >
|
36
|
|
- <FormItem label="Banner图集" name="user" rules={[{ required: true, message: '请选择' }]}>
|
37
|
|
- <Upload {...props}>
|
38
|
|
- <Button icon={<UploadOutlined />}>Upload</Button>
|
39
|
|
- </Upload>
|
40
|
|
- </FormItem>
|
41
|
|
- <FormItem label="资讯分类名称" name="shopName" rules={[{ required: true, message: '请输入' }]}>
|
|
34
|
+ <Form {...formItemLayout} onFinish={Submit} form={form}>
|
|
35
|
+ <FormItem label="名称" name="title" rules={[{ required: true, message: '请输入' }]}>
|
42
|
36
|
<Input placeholder="请输入" style={{ width: '350px' }} />
|
43
|
37
|
</FormItem>
|
44
|
|
- <FormItem label="资讯内容" name="s1hopName" rules={[{ required: true, message: '请输入' }]}>
|
45
|
|
- <Input placeholder="请输入" style={{ width: '350px' }} />
|
|
38
|
+ <FormItem label="图片" name="thumb" rules={[{ required: true, message: '请选择' }]}>
|
|
39
|
+ <UploadImage value={image} onChange={setImage} />
|
|
40
|
+ </FormItem>
|
|
41
|
+ <FormItem label="位置" name="position" rules={[{ required: true, message: '请选择' }]}>
|
|
42
|
+ <Select>
|
|
43
|
+ <Option value="index">首屏</Option>
|
|
44
|
+ <Option value="banner">banner页面</Option>
|
|
45
|
+ </Select>
|
|
46
|
+ </FormItem>
|
|
47
|
+ <FormItem label="详细信息" colon={false}>
|
|
48
|
+ <ExtendContent
|
|
49
|
+ targetType="tourist"
|
|
50
|
+ targetId={'66'}
|
|
51
|
+ onCancel={() => history.goBack()}
|
|
52
|
+ />
|
46
|
53
|
</FormItem>
|
47
|
|
- <FormItem label=" " colon={false} >
|
48
|
|
- <Button type='default' onClick={() => goBack()} >返回</Button>
|
49
|
|
- <Button type='primary' loading={loading} htmlType="Submit" style={{ marginLeft: '4em' }}>保存</Button>
|
|
54
|
+ <FormItem label=" " colon={false}>
|
|
55
|
+ <Button type="default" onClick={() => goBack()}>
|
|
56
|
+ 返回
|
|
57
|
+ </Button>
|
|
58
|
+ <Button
|
|
59
|
+ type="primary"
|
|
60
|
+ loading={loading}
|
|
61
|
+ htmlType="Submit"
|
|
62
|
+ style={{ marginLeft: '4em' }}
|
|
63
|
+ >
|
|
64
|
+ 保存
|
|
65
|
+ </Button>
|
50
|
66
|
</FormItem>
|
51
|
67
|
</Form>
|
52
|
68
|
</ProCard.TabPane>
|
53
|
69
|
</ProCard>
|
54
|
70
|
</Card>
|
55
|
|
- )
|
56
|
|
-}
|
|
71
|
+ );
|
|
72
|
+};
|