|
@@ -1,8 +1,9 @@
|
1
|
|
-import React from 'react';
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
2
|
2
|
import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } from 'antd';
|
3
|
3
|
import { FormattedMessage } from 'umi-plugin-react/locale';
|
4
|
4
|
import channels from './channelList.less';
|
5
|
5
|
import router from 'umi/router';
|
|
6
|
+import request from '../../utils/request'
|
6
|
7
|
|
7
|
8
|
const { Option } = Select;
|
8
|
9
|
function handleChange(value) {
|
|
@@ -26,21 +27,21 @@ const menu = (
|
26
|
27
|
</Menu.Item>
|
27
|
28
|
</Menu>
|
28
|
29
|
);
|
29
|
|
-const dataSource = [
|
30
|
|
- {
|
31
|
|
- key: '1',
|
32
|
|
- img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
|
33
|
|
- name: '123',
|
34
|
|
- age: 32,
|
35
|
|
- address: '西湖区湖底公园1号',
|
36
|
|
- },
|
37
|
|
- {
|
38
|
|
- key: '2',
|
39
|
|
- img: '',
|
40
|
|
- age: 42,
|
41
|
|
- address: '西湖区湖底公园1号',
|
42
|
|
- },
|
43
|
|
-];
|
|
30
|
+// const dataSource = [
|
|
31
|
+// {
|
|
32
|
+// key: '1',
|
|
33
|
+// img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
|
|
34
|
+// name: '123',
|
|
35
|
+// age: 32,
|
|
36
|
+// address: '西湖区湖底公园1号',
|
|
37
|
+// },
|
|
38
|
+// {
|
|
39
|
+// key: '2',
|
|
40
|
+// img: '',
|
|
41
|
+// age: 42,
|
|
42
|
+// address: '西湖区湖底公园1号',
|
|
43
|
+// },
|
|
44
|
+// ];
|
44
|
45
|
|
45
|
46
|
const columns = [
|
46
|
47
|
// {
|
|
@@ -53,52 +54,52 @@ const columns = [
|
53
|
54
|
// },
|
54
|
55
|
{
|
55
|
56
|
title: '渠道代码',
|
56
|
|
- dataIndex: 'name',
|
57
|
|
- key: 'name',
|
|
57
|
+ dataIndex: 'channelCode',
|
|
58
|
+ key: 'channelCode',
|
58
|
59
|
align: 'center',
|
59
|
60
|
render: text => <a>{text}</a>,
|
60
|
61
|
},
|
61
|
62
|
{
|
62
|
63
|
title: '渠道名称',
|
63
|
|
- dataIndex: 'integral',
|
64
|
|
- key: 'integral',
|
|
64
|
+ dataIndex: 'channelName',
|
|
65
|
+ key: 'channelName',
|
65
|
66
|
align: 'center',
|
66
|
67
|
},
|
67
|
68
|
{
|
68
|
69
|
title: '联系人',
|
69
|
|
- dataIndex: 'total',
|
70
|
|
- key: 'total',
|
|
70
|
+ dataIndex: 'channelContact',
|
|
71
|
+ key: 'channelContact',
|
71
|
72
|
align: 'center',
|
72
|
73
|
},
|
73
|
74
|
{
|
74
|
75
|
title: '联系电话',
|
75
|
|
- dataIndex: 'exchanged',
|
76
|
|
- key: 'exchanged',
|
|
76
|
+ dataIndex: 'contactTel',
|
|
77
|
+ key: 'contactTel',
|
77
|
78
|
align: 'center',
|
78
|
79
|
},
|
79
|
80
|
{
|
80
|
|
- title: '经纪人',
|
81
|
|
- dataIndex: 'rest',
|
82
|
|
- key: 'rest',
|
|
81
|
+ title: '经纪人数',
|
|
82
|
+ dataIndex: 'agentsNum',
|
|
83
|
+ key: 'agentsNum',
|
83
|
84
|
align: 'center',
|
84
|
85
|
},
|
85
|
86
|
{
|
86
|
87
|
title: '推荐客户有效',
|
87
|
|
- dataIndex: 'state',
|
88
|
|
- key: 'state',
|
|
88
|
+ dataIndex: 'recommendEffective',
|
|
89
|
+ key: 'recommendEffective',
|
89
|
90
|
align: 'center',
|
90
|
91
|
},
|
91
|
92
|
{
|
92
|
93
|
title: '邀请经济人',
|
93
|
|
- dataIndex: 'handle',
|
94
|
|
- key: 'handle',
|
|
94
|
+ dataIndex: 'agentsInvite',
|
|
95
|
+ key: 'agentsInvite',
|
95
|
96
|
align: 'center',
|
96
|
|
- render: () => <a>Delete</a>,
|
|
97
|
+ // render: () => <a>Delete</a>,
|
97
|
98
|
},
|
98
|
99
|
{
|
99
|
100
|
title: '操作',
|
100
|
|
- dataIndex: 'handle',
|
101
|
|
- key: 'handle',
|
|
101
|
+ dataIndex: '',
|
|
102
|
+ key: '',
|
102
|
103
|
align: 'center',
|
103
|
104
|
render: () => <a style={ { color: '#66B3FF' } }>编辑</a>,
|
104
|
105
|
},
|
|
@@ -113,28 +114,48 @@ function toEditGoods() {
|
113
|
114
|
},
|
114
|
115
|
});
|
115
|
116
|
}
|
116
|
|
-export default () => (
|
117
|
|
- <>
|
118
|
|
- <div className={channels.searchBox}>
|
119
|
|
- <dvi>
|
120
|
|
- <span className={channels.selectName}>渠道名称</span>
|
121
|
|
- <Select defaultValue="lucy" style={{ width: 180 }} onChange={handleChange}>
|
122
|
|
- <Option value="jack">Jack</Option>
|
123
|
|
- <Option value="lucy">Lucy</Option>
|
124
|
|
- <Option value="disabled" disabled>
|
125
|
|
- Disabled
|
126
|
|
- </Option>
|
127
|
|
- <Option value="Yiminghe">yiminghe</Option>
|
128
|
|
- </Select>
|
129
|
|
- </dvi>
|
130
|
|
- <Button className={channels.about}>查询</Button>
|
131
|
|
- </div>
|
132
|
|
- <Button className={channels.addBtn} onClick={toEditGoods}>新增</Button>
|
133
|
|
- <Table dataSource={dataSource} columns={columns} />
|
|
117
|
+
|
|
118
|
+const header = props => {
|
|
119
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
120
|
+ const [data, setData] = useState({ records: [] })
|
|
121
|
+// const [page, changePage] = useState({})
|
|
122
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
123
|
+ useEffect(() => {
|
|
124
|
+ request({
|
|
125
|
+ url: '/api/admin/channel',
|
|
126
|
+ method: 'GET',
|
|
127
|
+ params: { pageNum: 1, pageSize: 10 },
|
|
128
|
+ // eslint-disable-next-line no-shadow
|
|
129
|
+ }).then(data => {
|
|
130
|
+ console.log(data)
|
|
131
|
+ setData(data)
|
|
132
|
+ })
|
|
133
|
+ }, [])
|
|
134
|
+
|
|
135
|
+ return (
|
|
136
|
+ <>
|
|
137
|
+ <div className={channels.searchBox}>
|
|
138
|
+ <dvi>
|
|
139
|
+ <span className={channels.selectName}>渠道名称</span>
|
|
140
|
+ <Select defaultValue="请选择" style={{ width: 180 }} onChange={handleChange}>
|
|
141
|
+ {data.records.map(Item =>
|
|
142
|
+ <Option value={ Item.channelId }> { Item.channelName } </Option>,
|
|
143
|
+ )}
|
|
144
|
+ {/* {listItems} */}
|
|
145
|
+ </Select>
|
|
146
|
+
|
|
147
|
+ </dvi>
|
|
148
|
+ <Button className={channels.about} onClick={ header }>查询</Button>
|
|
149
|
+ </div>
|
|
150
|
+ <Button className={channels.addBtn} onClick={toEditGoods}>新增</Button>
|
|
151
|
+ <Table dataSource={data.records} columns={columns} />
|
134
|
152
|
</>
|
135
|
|
-);
|
|
153
|
+ )
|
|
154
|
+}
|
136
|
155
|
|
137
|
156
|
function handleMenuClick(e) {
|
138
|
157
|
message.info('Click on menu item.');
|
139
|
158
|
console.log('click', e);
|
140
|
159
|
}
|
|
160
|
+
|
|
161
|
+export default header
|