|
@@ -0,0 +1,75 @@
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
|
|
3
|
+import { FormattedMessage } from 'umi-plugin-react/locale';
|
|
4
|
+import channels from '../../channel/channelList.less';
|
|
5
|
+import router from 'umi/router';
|
|
6
|
+import request from '../../../utils/request'
|
|
7
|
+
|
|
8
|
+const { TextArea } = Input;
|
|
9
|
+const { Option } = Select;
|
|
10
|
+
|
|
11
|
+const header = props => {
|
|
12
|
+
|
|
13
|
+ const [data, setData] = useState({ channelNmae: [], result: [] })
|
|
14
|
+
|
|
15
|
+ function goBack(){
|
|
16
|
+ router.push({
|
|
17
|
+ pathname: '/news/type/NewsType',
|
|
18
|
+ });
|
|
19
|
+ }
|
|
20
|
+
|
|
21
|
+ function addChannel(params) {
|
|
22
|
+ request({
|
|
23
|
+ url: '/api/admin/channel',
|
|
24
|
+ method: 'POST',
|
|
25
|
+ data: { ...params },
|
|
26
|
+ // eslint-disable-next-line no-shadow
|
|
27
|
+ }).then(data => {
|
|
28
|
+ console.log(data)
|
|
29
|
+ setData(data)
|
|
30
|
+ // eslint-disable-next-line no-unused-expressions
|
|
31
|
+ router.go(-1)
|
|
32
|
+ })
|
|
33
|
+ }
|
|
34
|
+
|
|
35
|
+ function handleSubmit(e) {
|
|
36
|
+ e.preventDefault();
|
|
37
|
+ props.form.validateFields((err, values) => {
|
|
38
|
+ if (!err) {
|
|
39
|
+ console.log('Received values of form: ', values);
|
|
40
|
+ // eslint-disable-next-line max-len
|
|
41
|
+ addChannel({ channelName: values.channelName, channelContact: values.channelContact, contactTel: values.contactTel })
|
|
42
|
+ }
|
|
43
|
+ });
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ const { getFieldDecorator } = props.form;
|
|
47
|
+
|
|
48
|
+ return (
|
|
49
|
+ <>
|
|
50
|
+ <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
|
|
51
|
+ <Form.Item label="类型图片">
|
|
52
|
+ {getFieldDecorator('newsName', {
|
|
53
|
+ rules: [{ message: '' }],
|
|
54
|
+ })(<Input className={channels.inpuit} />)}
|
|
55
|
+ </Form.Item>
|
|
56
|
+ <Form.Item label="名称">
|
|
57
|
+ {getFieldDecorator('newsName', {
|
|
58
|
+ rules: [{ message: '请输入资讯名称' }],
|
|
59
|
+ })(<Input className={channels.inpuit} />)}
|
|
60
|
+ </Form.Item>
|
|
61
|
+ <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
|
|
62
|
+ <Button type="primary" htmlType="submit">
|
|
63
|
+ 保存
|
|
64
|
+ </Button>
|
|
65
|
+ <Button className={channels.formButton} onClick={goBack} type="primary" htmlType="submit">
|
|
66
|
+ 取消
|
|
67
|
+ </Button>
|
|
68
|
+ </Form.Item>
|
|
69
|
+ </Form>
|
|
70
|
+ </>
|
|
71
|
+ )
|
|
72
|
+}
|
|
73
|
+
|
|
74
|
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
|
|
75
|
+export default WrappedNormalLoginForm
|