|
@@ -4,7 +4,6 @@ import UserSource from './components/UserSource.jsx';
|
4
|
4
|
import UserSourcepie from './components/UserSourcepie.jsx';
|
5
|
5
|
// import XForm, { FieldTypes } from '../../components/XForm';
|
6
|
6
|
import moment from 'moment';
|
7
|
|
-
|
8
|
7
|
import EChart from '../../components/EchartsTest/EChart';
|
9
|
8
|
import request from '../../utils/request';
|
10
|
9
|
import apis from '../../services/apis';
|
|
@@ -21,13 +20,11 @@ const header = props => {
|
21
|
20
|
|
22
|
21
|
const [tableData, setTableData] = useState([])
|
23
|
22
|
const [userType, setuserType] = useState([])
|
24
|
|
-
|
25
|
23
|
const [endDate, setEndDate] = useState({})
|
26
|
24
|
const [startDate, setStartDate] = useState({})
|
27
|
25
|
let daterange = []
|
28
|
26
|
|
29
|
27
|
useEffect(() => {
|
30
|
|
-
|
31
|
28
|
setEndDate(new Date())
|
32
|
29
|
setStartDate(moment().subtract(7, 'day').toDate())
|
33
|
30
|
setuserType('all')
|
|
@@ -35,7 +32,7 @@ const header = props => {
|
35
|
32
|
|
36
|
33
|
const { RangePicker } = DatePicker;
|
37
|
34
|
|
38
|
|
- function onChangetime (dates, dateStrings) {
|
|
35
|
+ function onChangetime(dates, dateStrings) {
|
39
|
36
|
|
40
|
37
|
daterange[1] = dateStrings[1]
|
41
|
38
|
daterange[0] = dateStrings[0]
|
|
@@ -50,19 +47,12 @@ const header = props => {
|
50
|
47
|
|
51
|
48
|
const getDataOf = (days) => () => {
|
52
|
49
|
|
53
|
|
-
|
54
|
50
|
setEndDate(new Date())
|
55
|
51
|
setStartDate(moment().subtract(days, 'day').toDate())
|
56
|
52
|
|
57
|
53
|
}
|
58
|
54
|
|
59
|
|
- function onChange (e) {
|
60
|
|
-
|
61
|
|
- // console.log(`radio checked:${e.target.value}`);
|
62
|
|
-
|
63
|
|
- }
|
64
|
|
-
|
65
|
|
- function datalist () {
|
|
55
|
+ function datalist() {
|
66
|
56
|
|
67
|
57
|
setEndDate(daterange[1])
|
68
|
58
|
setStartDate(daterange[0])
|
|
@@ -70,28 +60,10 @@ const header = props => {
|
70
|
60
|
}
|
71
|
61
|
|
72
|
62
|
|
73
|
|
-
|
74
|
|
- // const userType = 'all'
|
75
|
63
|
let tableTitle = ['日期']
|
76
|
|
- // const dataset = data || {}
|
77
|
|
-
|
78
|
|
- // function tableData () {
|
79
|
|
-
|
80
|
|
- // const data = (dataset.data || []).reduce((acc, item, index) => {
|
81
|
|
- // const { date, fromName, count, registered } = item
|
82
|
|
- // const num = userType === 'registered' ? registered : count
|
83
|
|
-
|
84
|
|
- // tableTitle = tableTitle.indexOf(fromName) > -1 ? tableTitle : tableTitle.concat(fromName) // eslint-disable-line
|
85
|
|
- // acc[date] = { ...acc[date], [`${fromName}`]: !num ? 0 : num }
|
86
|
|
-
|
87
|
|
- // return acc
|
88
|
|
- // }, {})
|
89
|
|
-
|
90
|
|
- // return Object.keys(data).map(x => ({ label: x, ...data[x] }))
|
91
|
64
|
|
92
|
|
- // }
|
93
|
65
|
|
94
|
|
- function onTabledatas (e) {
|
|
66
|
+ function onTabledatas(e) {
|
95
|
67
|
const data = (e.data || []).reduce((acc, item, index) => {
|
96
|
68
|
const { date, fromName, count, registered } = item
|
97
|
69
|
const num = userType === 'registered' ? registered : count
|
|
@@ -111,47 +83,34 @@ const header = props => {
|
111
|
83
|
title: '日期',
|
112
|
84
|
dataIndex: 'label',
|
113
|
85
|
key: 'label',
|
114
|
|
- width: '20%',
|
|
86
|
+ width:'20%'
|
115
|
87
|
},
|
|
88
|
+ {
|
|
89
|
+ title: '名片分享',
|
|
90
|
+ dataIndex: '名片分享',
|
|
91
|
+ key: '名片分享',
|
|
92
|
+ },
|
|
93
|
+ {
|
|
94
|
+ title: '生成海报',
|
|
95
|
+ dataIndex: '生成海报',
|
|
96
|
+ key: '生成海报',
|
|
97
|
+ },
|
|
98
|
+ {
|
|
99
|
+ title: '小程序搜索',
|
|
100
|
+ dataIndex: '小程序搜索',
|
|
101
|
+ key: '小程序搜索',
|
|
102
|
+ },
|
|
103
|
+ {
|
|
104
|
+ title: '好友分享',
|
|
105
|
+ dataIndex: '好友分享',
|
|
106
|
+ key: '好友分享',
|
116
|
107
|
|
117
|
|
- // {
|
118
|
|
- // title: '名片分享',
|
119
|
|
- // dataIndex: '名片分享',
|
120
|
|
- // key: '名片分享',
|
121
|
|
- // width: '16%'
|
122
|
|
-
|
123
|
|
- // },
|
124
|
|
- // {
|
125
|
|
- // title: '好友分享',
|
126
|
|
- // dataIndex: '好友分享',
|
127
|
|
- // key: '好友分享',
|
128
|
|
- // width: '16%'
|
129
|
|
- // },
|
130
|
|
- // {
|
131
|
|
- // title: '小程序搜索',
|
132
|
|
- // dataIndex: '小程序搜索',
|
133
|
|
- // key: '小程序搜索',
|
134
|
|
- // width: '16%'
|
135
|
|
- // },
|
136
|
|
- // {
|
137
|
|
- // title: '线下扫码',
|
138
|
|
- // dataIndex: '线下扫码',
|
139
|
|
- // key: '线下扫码',
|
140
|
|
- // width: '16%'
|
141
|
|
- // },
|
142
|
|
- // {
|
143
|
|
- // title: '群分享',
|
144
|
|
- // dataIndex: '群分享',
|
145
|
|
- // key: '群分享',
|
146
|
|
- // width: '16%'
|
147
|
|
- // },
|
148
|
|
-
|
149
|
|
-
|
|
108
|
+ },
|
150
|
109
|
|
151
|
110
|
|
152
|
111
|
]
|
153
|
112
|
|
154
|
|
- function handleSelectChange (e) {
|
|
113
|
+ function handleSelectChange(e) {
|
155
|
114
|
|
156
|
115
|
console.log(e)
|
157
|
116
|
setuserType(e)
|
|
@@ -159,7 +118,6 @@ const header = props => {
|
159
|
118
|
|
160
|
119
|
|
161
|
120
|
|
162
|
|
-
|
163
|
121
|
return (<>
|
164
|
122
|
<div style={{
|
165
|
123
|
backgroundColor: '#fff',
|
|
@@ -191,16 +149,14 @@ const header = props => {
|
191
|
149
|
<div style={{
|
192
|
150
|
width: '1060px',
|
193
|
151
|
height: '560px',
|
194
|
|
-
|
195
|
152
|
paddingTop: '40px',
|
196
|
153
|
marginRight: ' 40px',
|
197
|
154
|
}}>
|
198
|
|
- <UserSource endDate={endDate} startDate={startDate} onSuccess={(e) => onTabledatas(e)}></UserSource>
|
|
155
|
+ <UserSource BuildSelectHide={true} endDate={endDate} startDate={startDate} onSuccess={(e) => onTabledatas(e)}></UserSource>
|
199
|
156
|
</div>
|
200
|
157
|
<div style={{
|
201
|
158
|
width: '509px',
|
202
|
159
|
height: '600px',
|
203
|
|
-
|
204
|
160
|
paddingTop: '40px',
|
205
|
161
|
|
206
|
162
|
}}>
|
|
@@ -212,7 +168,7 @@ const header = props => {
|
212
|
168
|
<Option value='registered'>注册用户</Option>
|
213
|
169
|
</Select>
|
214
|
170
|
|
215
|
|
- <Table dataSource={tableData} columns={columns} pagination={false} scroll={{ y: 500 }}></Table>
|
|
171
|
+ <Table style={{marginTop:'20px'}} dataSource={tableData} columns={columns} pagination={false} scroll={{ y: 500 }}></Table>
|
216
|
172
|
</div>
|
217
|
173
|
</div>
|
218
|
174
|
</>
|