Selaa lähdekoodia

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

魏超 5 vuotta sitten
vanhempi
commit
ecb0cac565

+ 32
- 2
config/routes.js Näytä tiedosto

@@ -611,13 +611,19 @@ export default [
611 611
               },
612 612
               {
613 613
                 path: '/statistical/consultant/table',
614
-                name: '拓客统计',
614
+                name: '客户总计',
615
+                hideInMenu: true,
616
+                component: './statistical/consultant/table',
617
+              },
618
+              {
619
+                path: '/statistical/consultant/newPersons',
620
+                name: '新增客户',
615 621
                 hideInMenu: true,
616 622
                 component: './statistical/consultant/table',
617 623
               },
618 624
               {
619 625
                 path: '/statistical/consultant/sharetable',
620
-                name: '分享统计',
626
+                name: '分享次数',
621 627
                 hideInMenu: true,
622 628
                 component: './statistical/consultant/sharetable',
623 629
               },
@@ -633,12 +639,36 @@ export default [
633 639
                 hideInMenu: true,
634 640
                 component: './statistical/consultant/visitNum',
635 641
               },
642
+              {
643
+                path: '/statistical/consultant/sharePersons',
644
+                name: '分享拓客',
645
+                hideInMenu: true,
646
+                component: './statistical/consultant/table',
647
+              },
636 648
               {
637 649
                 path: '/statistical/consultant/homePagePersons',
638 650
                 name: '主页访问人数',
639 651
                 hideInMenu: true,
640 652
                 component: './statistical/consultant/homePagePersons',
641 653
               },
654
+              {
655
+                path: '/statistical/consultant/homepageNum',
656
+                name: '主页访问次数',
657
+                hideInMenu: true,
658
+                component: './statistical/consultant/table',
659
+              },
660
+              {
661
+                path: '/statistical/consultant/chatPersons',
662
+                name: '咨询数',
663
+                hideInMenu: true,
664
+                component: './statistical/consultant/table',
665
+              },
666
+              {
667
+                path: '/statistical/consultant/favorNum',
668
+                name: '点赞数',
669
+                hideInMenu: true,
670
+                component: './statistical/consultant/table',
671
+              },
642 672
             ],
643 673
           },
644 674
           {

+ 5
- 1
src/layouts/SecurityLayout.jsx Näytä tiedosto

@@ -2,6 +2,7 @@ import React from 'react';
2 2
 import { connect } from 'dva';
3 3
 import { Redirect } from 'umi';
4 4
 import PageLoading from '@/components/PageLoading';
5
+import Swiper from '../pages/swiper/index';
5 6
 
6 7
 class SecurityLayout extends React.Component {
7 8
   state = {
@@ -33,7 +34,10 @@ class SecurityLayout extends React.Component {
33 34
       return <Redirect to="/user/login"></Redirect>;
34 35
     }
35 36
 
36
-    return children;
37
+    return <>
38
+      {children}
39
+      <Swiper />
40
+    </>;
37 41
   }
38 42
 }
39 43
 

+ 2
- 2
src/pages/Monitor.jsx Näytä tiedosto

@@ -3,7 +3,7 @@ import { Card, Typography, Alert, Row, Col } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import EchartsTest from '../components/EchartsTest';
5 5
 import IndexEcharts from './indexEcharts/index';
6
-import Swiper from './swiper/index';
6
+// import Swiper from './swiper/index';
7 7
 import router from 'umi/router';
8 8
 import request from '../utils/request';
9 9
 import apis from '../services/apis';
@@ -69,7 +69,7 @@ const Monitor = props => {
69 69
           </div>
70 70
         }
71 71
       </div>
72
-      <Swiper />
72
+      {/* <Swiper /> */}
73 73
       <IndexEcharts style={{ width: '100%' }} onReData={(e) => redata(e)} checkData={checkData}></IndexEcharts>
74 74
     </>
75 75
   )

+ 5
- 1
src/pages/building/list/add/index.jsx Näytä tiedosto

@@ -5,7 +5,7 @@ import request from '../../../../utils/request';
5 5
 import apis from '../../../../services/apis';
6 6
 import Styles from './style.less';
7 7
 import { router } from 'umi';
8
-
8
+import Prompt from 'umi/prompt';
9 9
 
10 10
 import ImageUpload from '../../../../components/XForm/ImageUpload'
11 11
 import Wangedit from '../../../../components/Wangedit/Wangedit'
@@ -77,6 +77,10 @@ function AddBuilding(props) {
77 77
         { (tab === 'poster' && <Poster building={buildingData} />)}
78 78
         { (tab === 'share' && <Share building={buildingData} />)}
79 79
       </div>
80
+      <Prompt message={location =>
81
+                          location.pathname.startsWith("/building/list")
82
+                            ? true
83
+                            : localStorage.removeItem("pageParams")} />
80 84
     </>
81 85
     // <Tabs defaultActiveKey="1" onChange={tabsCallback}>
82 86
     //   <TabPane tab="基本信息" key="1">

+ 19
- 3
src/pages/building/list/index.jsx Näytä tiedosto

@@ -5,6 +5,7 @@ import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7 7
 import { router } from 'umi';
8
+import Prompt from 'umi/prompt';
8 9
 import AuthButton from '@/components/AuthButton';
9 10
 import SelectCity from '../../../components/SelectButton/CitySelect'
10 11
 
@@ -179,7 +180,11 @@ function body(props) {
179 180
 
180 181
   // eslint-disable-next-line react-hooks/rules-of-hooks
181 182
   useEffect(() => {
182
-    getList({ pageNum: 1, pageSize: 9 })
183
+    if(localStorage.getItem("pageParams")){
184
+      getList(JSON.parse(localStorage.getItem("pageParams")))
185
+    }else{
186
+      getList({ pageNum: 1, pageSize: 9 })
187
+    } 
183 188
   }, [])
184 189
 
185 190
   function getList(params) {
@@ -212,6 +217,7 @@ function body(props) {
212 217
 
213 218
           values.startDate = `${moment(startDate).format('YYYY-MM-DDT00:00:00.000')}Z`
214 219
         }
220
+        localStorage.setItem("pageParams",JSON.stringify({ pageNum: 1, pageSize: 9, ...values }));
215 221
         getList({ pageNum: 1, pageSize: 9, ...values })
216 222
       }
217 223
     });
@@ -225,6 +231,7 @@ function body(props) {
225 231
 
226 232
   // 分页
227 233
   function onChange(pageNumber) {
234
+    localStorage.setItem("pageParams",JSON.stringify({ pageNum: pageNumber, pageSize: 9, ...props.form.getFieldsValue() }));
228 235
     // eslint-disable-next-line react-hooks/rules-of-hooks
229 236
     getList({ pageNum: pageNumber, pageSize: 9, ...props.form.getFieldsValue() })
230 237
   }
@@ -258,11 +265,16 @@ function body(props) {
258 265
    */
259 266
   function handleReset() {
260 267
     props.form.resetFields();
268
+    localStorage.setItem("pageParams",JSON.stringify({ pageNum: 1, pageSize: 9 }));
261 269
     getList({ pageNum: 1, pageSize: 9 })
262 270
   }
263 271
 
264 272
   function onSuccess() {
265
-    getList({ pageNum: 1, pageSize: 9 })
273
+    if(localStorage.getItem("pageParams")){
274
+      getList(JSON.parse(localStorage.getItem("pageParams")))
275
+    }else{
276
+      getList({ pageNum: 1, pageSize: 9 })
277
+    } 
266 278
   }
267 279
 
268 280
 
@@ -348,8 +360,12 @@ function body(props) {
348 360
       </Row>
349 361
       {/* 分页 */}
350 362
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
351
-        <Pagination showQuickJumper defaultCurrent={1} total={dataSource.total} onChange={onChange} pageSize={dataSource.size} />
363
+        <Pagination showQuickJumper current={dataSource.current} total={dataSource.total} onChange={onChange} pageSize={dataSource.size} />
352 364
       </div>
365
+      <Prompt message={location =>
366
+                          location.pathname.startsWith("/building/list")
367
+                            ? true
368
+                            : localStorage.removeItem("pageParams")} />
353 369
     </>
354 370
   );
355 371
 }

+ 16
- 2
src/pages/statistical/consultant/homePagePersons.jsx Näytä tiedosto

@@ -22,6 +22,7 @@ function record(props) {
22 22
 
23 23
     // 获取初始化数据
24 24
     const [data, setData] = useState({})
25
+    const [loading, updataLoading] = useState(true)
25 26
 
26 27
 
27 28
     useEffect(() => {
@@ -32,6 +33,7 @@ function record(props) {
32 33
     const getList = (params) => {
33 34
         request({ ...apis.stats.homePagePersons, params: { ...params }, }).then((data) => {
34 35
             setData(data)
36
+            updataLoading(false)
35 37
         })
36 38
     }
37 39
 
@@ -51,6 +53,17 @@ function record(props) {
51 53
             },
52 54
         });
53 55
     }
56
+    const toHomepageNum = (personId) => {
57
+
58
+        router.push({
59
+            pathname: '/statistical/consultant/homepageNum',
60
+            query: {
61
+                ...props.location.query,
62
+                type: 'homePageNums',
63
+                personId,
64
+            },
65
+        });
66
+    }
54 67
     // 表格数据
55 68
     const columns = [
56 69
 
@@ -66,7 +79,7 @@ function record(props) {
66 79
             dataIndex: 'name',
67 80
             key: 'name',
68 81
             align: 'center',
69
-            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.name}</span>,
82
+            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.name || record.nickname}</span>,
70 83
         },
71 84
         {
72 85
             title: '电话',
@@ -86,7 +99,7 @@ function record(props) {
86 99
             dataIndex: 'visitTimes',
87 100
             key: 'visitTimes',
88 101
             align: 'center',
89
-            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.visitTimes}</span>,
102
+            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toHomepageNum(record.personId)} >{record.visitTimes}</span>,
90 103
         },
91 104
         {
92 105
             title: '最后访问时间',
@@ -107,6 +120,7 @@ function record(props) {
107 120
                 dataSource={data.records}
108 121
                 columns={columns}
109 122
                 pagination={false}
123
+                loading={loading}
110 124
             />
111 125
             < div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
112 126
                 <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />

+ 54
- 33
src/pages/statistical/consultant/index.jsx Näytä tiedosto

@@ -5,6 +5,7 @@ import moment from 'moment';
5 5
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
6 6
 import apis from '../../../services/apis';
7 7
 import request from '../../../utils/request'
8
+import AuthButton from '../../../components/AuthButton';
8 9
 
9 10
 /**
10 11
   @param {*} props
@@ -21,13 +22,15 @@ function record(props) {
21 22
         startDate: moment().subtract(radioVal, 'day').format('YYYYMMDD'),
22 23
         endDate: moment().format('YYYYMMDD'),
23 24
         buildingId: '',
24
-        asc: '',
25
-        desc: '',
25
+        // asc: '',
26
+        // desc: '',
26 27
     })
27 28
 
28 29
     // 获取初始化数据
29 30
     const [data, setData] = useState({})
30 31
     const [totalRow, setTotalRow] = useState({})
32
+    const [loading, updataLoading] = useState(true)
33
+    const [btnloading, updataBtnloading] = useState(false)
31 34
 
32 35
     useEffect(() => {
33 36
         getList(formData);
@@ -38,6 +41,9 @@ function record(props) {
38 41
         request({ ...apis.stats.consultantKPI, params: { ...params }, }).then((data) => {
39 42
             setData(data.paged)
40 43
             setTotalRow(data.total)
44
+            updataLoading(false)
45
+        }).catch(err => {
46
+            updataLoading(false)
41 47
         })
42 48
     }
43 49
 
@@ -91,7 +97,7 @@ function record(props) {
91 97
 
92 98
     const clickCon = (val, record, type) => {
93 99
         if (val == 0) {
94
-            return <><span onClick={() => toDetail(record, type)}>{val}</span></>
100
+            return <><span>{val}</span></>
95 101
         }
96 102
         return <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toDetail(record, type)} >{val}</span></>
97 103
     }
@@ -102,17 +108,17 @@ function record(props) {
102 108
             router.push({
103 109
                 pathname: '/statistical/consultant/table',
104 110
                 query: {
105
-                    buildingId: formData.buildingId,
111
+                    buildingId: record.buildingId,
106 112
                     userId: record.userId,
107 113
                 },
108 114
             });
109 115
         } else if (type === 'newPersons') {
110 116
             router.push({
111
-                pathname: '/statistical/consultant/table',
117
+                pathname: '/statistical/consultant/newPersons',
112 118
                 query: {
113 119
                     startDate: formData.startDate,
114 120
                     endDate: formData.endDate,
115
-                    buildingId: formData.buildingId,
121
+                    buildingId: record.buildingId,
116 122
                     userId: record.userId,
117 123
                 },
118 124
             });
@@ -122,7 +128,7 @@ function record(props) {
122 128
                 query: {
123 129
                     startDate: formData.startDate,
124 130
                     endDate: formData.endDate,
125
-                    buildingId: formData.buildingId,
131
+                    buildingId: record.buildingId,
126 132
                     userId: record.userId,
127 133
                 },
128 134
             });
@@ -132,7 +138,7 @@ function record(props) {
132 138
                 query: {
133 139
                     startDate: formData.startDate,
134 140
                     endDate: formData.endDate,
135
-                    buildingId: formData.buildingId,
141
+                    buildingId: record.buildingId,
136 142
                     userId: record.userId,
137 143
                 },
138 144
             });
@@ -142,17 +148,17 @@ function record(props) {
142 148
                 query: {
143 149
                     startDate: formData.startDate,
144 150
                     endDate: formData.endDate,
145
-                    buildingId: formData.buildingId,
151
+                    buildingId: record.buildingId,
146 152
                     userId: record.userId,
147 153
                 },
148 154
             });
149 155
         } else if (type === 'sharePersons') {
150 156
             router.push({
151
-                pathname: '/statistical/consultant/table',
157
+                pathname: '/statistical/consultant/sharePersons',
152 158
                 query: {
153 159
                     startDate: formData.startDate,
154 160
                     endDate: formData.endDate,
155
-                    buildingId: formData.buildingId,
161
+                    buildingId: record.buildingId,
156 162
                     userId: record.userId,
157 163
                     type: 'sharePersons',
158 164
                 },
@@ -163,46 +169,55 @@ function record(props) {
163 169
                 query: {
164 170
                     startDate: formData.startDate,
165 171
                     endDate: formData.endDate,
166
-                    buildingId: formData.buildingId,
172
+                    buildingId: record.buildingId,
167 173
                     userId: record.userId,
168 174
                 },
169 175
             });
170 176
         } else if (type === 'homePageNums') {
171 177
             router.push({
172
-                pathname: '/statistical/consultant/table',
178
+                pathname: '/statistical/consultant/homepageNum',
173 179
                 query: {
174 180
                     startDate: formData.startDate,
175 181
                     endDate: formData.endDate,
176
-                    buildingId: formData.buildingId,
182
+                    buildingId: record.buildingId,
177 183
                     userId: record.userId,
178 184
                     type: 'homePageNums',
179 185
                 },
180 186
             });
181 187
         } else if (type === 'chatPersons') {
182 188
             router.push({
183
-                pathname: '/statistical/consultant/table',
189
+                pathname: '/statistical/consultant/chatPersons',
184 190
                 query: {
185 191
                     startDate: formData.startDate,
186 192
                     endDate: formData.endDate,
187
-                    buildingId: formData.buildingId,
193
+                    buildingId: record.buildingId,
188 194
                     userId: record.userId,
189 195
                     type: 'chatPersons',
190 196
                 },
191 197
             });
192 198
         } else if (type === 'favorNum') {
193 199
             router.push({
194
-                pathname: '/statistical/consultant/table',
200
+                pathname: '/statistical/consultant/favorNum',
195 201
                 query: {
196 202
                     startDate: formData.startDate,
197 203
                     endDate: formData.endDate,
198
-                    buildingId: formData.buildingId,
204
+                    buildingId: record.buildingId,
199 205
                     userId: record.userId,
200 206
                     type: 'favorNum',
201 207
                 },
202 208
             });
203 209
         }
204
-
205 210
     }
211
+    //排序
212
+    const handleChange = (pagination, filters, sorter) => {
213
+        if (sorter.order == 'ascend') {
214
+            getList({ ...formData, asc: sorter.columnKey, })
215
+        } else if (sorter.order == 'descend') {
216
+            getList({ ...formData, desc: sorter.columnKey, })
217
+        } else {
218
+            getList(formData);
219
+        }
220
+    };
206 221
 
207 222
     // 表格数据
208 223
     const columns = [
@@ -232,7 +247,7 @@ function record(props) {
232 247
             dataIndex: 'totalPersons',
233 248
             key: 'totalPersons',
234 249
             align: 'center',
235
-            sorter: (a, b) => a.totalPersons - b.totalPersons,
250
+            sorter: true,
236 251
             render: (txt, record, index) => clickCon(txt, record, 'totalPersons'),
237 252
             // render: (txt, record, index) => index ? clickCon(txt, record, 'totalPersons') : <strong>{txt}</strong>,
238 253
         },
@@ -241,7 +256,7 @@ function record(props) {
241 256
             dataIndex: 'newPersons',
242 257
             key: 'newPersons',
243 258
             align: 'center',
244
-            sorter: (a, b) => a.newPersons - b.newPersons,
259
+            sorter: true,
245 260
             render: (txt, record, index) => clickCon(txt, record, 'newPersons'),
246 261
         },
247 262
         {
@@ -249,7 +264,7 @@ function record(props) {
249 264
             dataIndex: 'shareNum',
250 265
             key: 'shareNum',
251 266
             align: 'center',
252
-            sorter: (a, b) => a.shareNum - b.shareNum,
267
+            sorter: true,
253 268
             render: (txt, record, index) => clickCon(txt, record, 'shareNum'),
254 269
         },
255 270
         {
@@ -257,7 +272,7 @@ function record(props) {
257 272
             dataIndex: 'visitPersons',
258 273
             key: 'visitPersons',
259 274
             align: 'center',
260
-            sorter: (a, b) => a.visitPersons - b.visitPersons,
275
+            sorter: true,
261 276
             render: (txt, record, index) => clickCon(txt, record, 'visitPersons'),
262 277
         },
263 278
         {
@@ -265,7 +280,7 @@ function record(props) {
265 280
             dataIndex: 'visitNum',
266 281
             key: 'visitNum',
267 282
             align: 'center',
268
-            sorter: (a, b) => a.visitNum - b.visitNum,
283
+            sorter: true,
269 284
             render: (txt, record, index) => clickCon(txt, record, 'visitNum'),
270 285
         },
271 286
 
@@ -274,7 +289,7 @@ function record(props) {
274 289
             dataIndex: 'sharePersons',
275 290
             key: 'sharePersons',
276 291
             align: 'center',
277
-            sorter: (a, b) => a.sharePersons - b.sharePersons,
292
+            sorter: true,
278 293
             render: (txt, record, index) => clickCon(txt, record, 'sharePersons'),
279 294
         },
280 295
         {
@@ -282,7 +297,7 @@ function record(props) {
282 297
             dataIndex: 'homePagePersons',
283 298
             key: 'homePagePersons',
284 299
             align: 'center',
285
-            sorter: (a, b) => a.homePagePersons - b.homePagePersons,
300
+            sorter: true,
286 301
             render: (txt, record, index) => clickCon(txt, record, 'homePagePersons'),
287 302
         },
288 303
         {
@@ -290,7 +305,7 @@ function record(props) {
290 305
             dataIndex: 'homePageNums',
291 306
             key: 'homePageNums',
292 307
             align: 'center',
293
-            sorter: (a, b) => a.homePageNums - b.homePageNums,
308
+            sorter: true,
294 309
             render: (txt, record, index) => clickCon(txt, record, 'homePageNums'),
295 310
         },
296 311
         {
@@ -298,7 +313,7 @@ function record(props) {
298 313
             dataIndex: 'chatPersons',
299 314
             key: 'chatPersons',
300 315
             align: 'center',
301
-            sorter: (a, b) => a.chatPersons - b.chatPersons,
316
+            sorter: true,
302 317
             render: (txt, record, index) => clickCon(txt, record, 'chatPersons'),
303 318
         },
304 319
         {
@@ -306,7 +321,7 @@ function record(props) {
306 321
             dataIndex: 'favorNum',
307 322
             key: 'favorNum',
308 323
             align: 'center',
309
-            sorter: (a, b) => a.favorNum - b.favorNum,
324
+            sorter: true,
310 325
             render: (txt, record, index) => clickCon(txt, record, 'favorNum'),
311 326
         },
312 327
     ];
@@ -325,11 +340,13 @@ function record(props) {
325 340
     }
326 341
     // 导出
327 342
     function exportRecord() {
343
+        updataBtnloading(true)
328 344
         request({ ...apis.stats.exportConsultantKPI, responseType: 'blob', params: { startDate: formData.startDate, endDate: formData.endDate, buildingId: formData.buildingId } })
329 345
             .then(response => {
330 346
                 download(response)
347
+                updataBtnloading(false)
331 348
             }).catch(error => {
332
-
349
+                updataBtnloading(false)
333 350
             })
334 351
     }
335 352
     // 默认日期
@@ -360,14 +377,18 @@ function record(props) {
360 377
                     </Form.Item>
361 378
                 </div>
362 379
             </Form>
363
-            <Button type="primary" onClick={exportRecord} style={{ float: 'right', margin: '20px 23px 20px 0', zIndex: 1 }}>
364
-                导出
365
-          </Button>
380
+            <AuthButton name="admin.statistical.consultant.export" noRight={null}>
381
+                <Button type="primary" onClick={exportRecord} loading={btnloading} style={{ float: 'right', margin: '20px 23px 20px 0', zIndex: 1 }}>
382
+                    导出
383
+                </Button>
384
+            </AuthButton>
366 385
             <Table rowKey={record => (record.userId + record.buildingId || '')}
367 386
                 style={{ marginTop: '30px' }}
368 387
                 dataSource={data.records}
369 388
                 columns={columns}
370 389
                 pagination={false}
390
+                onChange={handleChange}
391
+                loading={loading}
371 392
             />
372 393
             < div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
373 394
                 <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />

+ 31
- 12
src/pages/statistical/consultant/sharetable.jsx Näytä tiedosto

@@ -43,11 +43,24 @@ const typeList = [
43 43
         value: 'mian'
44 44
     },
45 45
 ]
46
-
47
-
48
-function getType(type) {
49
-    return typeList.filter(t => t.value === type)[0].label
50
-}
46
+const showTypeList = [
47
+    {
48
+        label: '直播活动',
49
+        value: 'livePost',
50
+    },
51
+    {
52
+        label: '直播活动',
53
+        value: 'liveApp',
54
+    },
55
+    {
56
+        label: '房源列表',
57
+        value: 'housePost',
58
+    },
59
+    {
60
+        label: '房源列表',
61
+        value: 'houseApp',
62
+    },
63
+]
51 64
 
52 65
 /**
53 66
   @param {*} props
@@ -65,6 +78,7 @@ function record(props) {
65 78
 
66 79
     // 获取初始化数据
67 80
     const [data, setData] = useState({})
81
+    const [loading, updataLoading] = useState(true)
68 82
 
69 83
     useEffect(() => {
70 84
         getList(formData);
@@ -74,6 +88,7 @@ function record(props) {
74 88
     const getList = (params) => {
75 89
         request({ ...apis.stats.shareNum, params: { ...params }, }).then((data) => {
76 90
             setData(data)
91
+            updataLoading(false)
77 92
         })
78 93
     }
79 94
 
@@ -101,23 +116,26 @@ function record(props) {
101 116
         });
102 117
     }
103 118
 
119
+    function getType(type) {
120
+        return typeList.concat(showTypeList).filter(t => t.value == type)[0].label
121
+    }
104 122
 
105 123
     // 表格数据
106 124
     const columns = [
107 125
 
108 126
         {
109 127
             title: '分享标题',
110
-            dataIndex: 'intention',
111
-            key: 'intention',
128
+            dataIndex: 'targetType',
129
+            key: 'targetType',
112 130
             align: 'center',
113
-            render: (_, record) => <><span>{() => getType(record.targetType)}{record.targetName}</span></>
131
+            render: (_, record) => <><span>{getType(record.targetType)} {'【' + record.targetName + '】'}</span></>
114 132
         },
115 133
         {
116 134
             title: '分享时间',
117
-            dataIndex: 'userName',
118
-            key: 'userName',
135
+            dataIndex: 'createDate',
136
+            key: 'createDate',
119 137
             align: 'center',
120
-            render: (_, record) => <><span>{record.reportDate && moment(record.reportDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
138
+            render: (_, record) => <><span>{record.createDate && moment(record.createDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
121 139
         },
122 140
 
123 141
     ];
@@ -152,11 +170,12 @@ function record(props) {
152 170
                     </Form.Item>
153 171
                 </div>
154 172
             </Form>
155
-            <Table rowKey={record => (record.userId + record.buildingId || '')}
173
+            <Table rowKey={record => (record.personId + record.buildingId || '')}
156 174
                 style={{ marginTop: '30px' }}
157 175
                 dataSource={data.records}
158 176
                 columns={columns}
159 177
                 pagination={false}
178
+                loading={loading}
160 179
             />
161 180
             < div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
162 181
                 <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />

+ 21
- 9
src/pages/statistical/consultant/table.jsx Näytä tiedosto

@@ -22,7 +22,7 @@ function record(props) {
22 22
 
23 23
     // 获取初始化数据
24 24
     const [data, setData] = useState({})
25
-
25
+    const [loading, updataLoading] = useState(true)
26 26
 
27 27
     useEffect(() => {
28 28
         getList(formData);
@@ -35,21 +35,31 @@ function record(props) {
35 35
         if (typeTag == 'sharePersons') {
36 36
             request({ ...apis.stats.sharePersons, params: { ...params }, }).then((data) => {
37 37
                 setData(data)
38
+                updataLoading(false)
38 39
             })
39 40
         }
40 41
         else if (typeTag == 'homePageNums') {
41 42
             request({ ...apis.stats.homePageNums, params: { ...params }, }).then((data) => {
42 43
                 setData(data)
44
+                updataLoading(false)
43 45
             })
44 46
         }
45 47
         else if (typeTag == 'chatPersons') {
46 48
             request({ ...apis.stats.chatPersons, params: { ...params }, }).then((data) => {
47 49
                 setData(data)
50
+                updataLoading(false)
51
+            })
52
+        }
53
+        else if (typeTag == 'favorNum') {
54
+            request({ ...apis.stats.favorNum, params: { ...params }, }).then((data) => {
55
+                setData(data)
56
+                updataLoading(false)
48 57
             })
49 58
         }
50 59
         else {
51 60
             request({ ...apis.stats.totalPersons, params: { ...params }, }).then((data) => {
52 61
                 setData(data)
62
+                updataLoading(false)
53 63
             })
54 64
         }
55 65
 
@@ -57,11 +67,11 @@ function record(props) {
57 67
 
58 68
     // 更新页码
59 69
     const changePageNum = (pageNumber) => {
60
-        props.form.validateFields((err, values) => {
61
-            if (!err) {
62
-                getList({ ...props.location.query, pageNum: pageNumber });
63
-            }
64
-        });
70
+        // props.form.validateFields((err, values) => {
71
+        // if (!err) {
72
+        getList({ ...props.location.query, pageNum: pageNumber });
73
+        //     }
74
+        // });
65 75
     }
66 76
     const toPersonDetail = (personId) => {
67 77
         router.push({
@@ -85,7 +95,7 @@ function record(props) {
85 95
             dataIndex: 'name',
86 96
             key: 'name',
87 97
             align: 'center',
88
-            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.name}</span>,
98
+            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.name || record.nickname}</span>,
89 99
         },
90 100
         {
91 101
             title: '电话',
@@ -133,17 +143,19 @@ function record(props) {
133 143
                 ]
134 144
     const columns = basicColunms.concat(lastColum)
135 145
 
136
-
146
+    let row = 0
137 147
 
138 148
     return (
139 149
 
140 150
         <>
141 151
             <Button type="danger" style={{ marginLeft: '18px' }} onClick={() => router.go(-1)}>返回</Button>
142
-            <Table rowKey={record => (record.phone + record.buildingId || '')}
152
+            <Table rowKey={record => data.current * data.size + (row++)}
153
+                // <Table rowKey={record => (record.personId + record.buildingId || '')}
143 154
                 style={{ marginTop: '30px' }}
144 155
                 dataSource={data.records}
145 156
                 columns={columns}
146 157
                 pagination={false}
158
+                loading={loading}
147 159
             />
148 160
             < div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
149 161
                 <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />

+ 66
- 21
src/pages/statistical/consultant/visitNum.jsx Näytä tiedosto

@@ -5,6 +5,46 @@ import moment from 'moment';
5 5
 import apis from '../../../services/apis';
6 6
 import request from '../../../utils/request'
7 7
 
8
+const typeList = [
9
+    {
10
+        label: '报名活动',
11
+        value: 'dynamic_share'
12
+    },
13
+    {
14
+        label: '助力活动',
15
+        value: 'help_share'
16
+    },
17
+    {
18
+        label: '拼团活动',
19
+        value: 'group_share'
20
+    },
21
+    {
22
+        label: 'H5活动',
23
+        value: 'h5_share'
24
+    },
25
+    {
26
+        label: '直播活动',
27
+        value: 'live_share'
28
+    },
29
+    {
30
+        label: '房源列表',
31
+        value: 'house_share'
32
+    },
33
+    {
34
+        label: '项目',
35
+        value: 'building_share'
36
+    },
37
+    {
38
+        label: '资讯',
39
+        value: 'news_share'
40
+    },
41
+    {
42
+        label: '首页',
43
+        value: 'share'
44
+    },
45
+]
46
+
47
+
8 48
 /**
9 49
   @param {*} props
10 50
   @returns
@@ -21,6 +61,7 @@ function record(props) {
21 61
 
22 62
     // 获取初始化数据
23 63
     const [data, setData] = useState({})
64
+    const [loading, updataLoading] = useState(true)
24 65
 
25 66
     useEffect(() => {
26 67
         getList(formData);
@@ -28,8 +69,10 @@ function record(props) {
28 69
 
29 70
     // 查询列表
30 71
     const getList = (params) => {
31
-        request({ ...apis.stats.totalPersons, params: { ...params }, }).then((data) => {
72
+        request({ ...apis.stats.visitNum, params: { ...params }, }).then((data) => {
32 73
             setData(data)
74
+            updataLoading(false)
75
+
33 76
         })
34 77
     }
35 78
 
@@ -44,35 +87,40 @@ function record(props) {
44 87
         props.form.validateFields((err, values) => {
45 88
             if (!err) {
46 89
                 console.log('提交数据: ', values)
90
+                getList({ ...formData, ...values });
47 91
 
48 92
             }
49 93
         });
50
-        // getList(formData);
51 94
     }
52 95
     // 更新页码
53 96
     const changePageNum = (pageNumber) => {
54 97
         props.form.validateFields((err, values) => {
55 98
             if (!err) {
56
-                getList({ ...formData, pageNum: pageNumber });
99
+                getList({ ...formData, pageNum: pageNumber, ...values });
57 100
             }
58 101
         });
59 102
     }
60 103
 
104
+    function getType(type) {
105
+        return typeList.filter(t => t.value === type)[0].label
106
+    }
61 107
 
62 108
     // 表格数据
63 109
     const columns = [
64 110
 
65 111
         {
66 112
             title: '分享标题',
67
-            dataIndex: 'intention',
68
-            key: 'intention',
113
+            dataIndex: 'targetType',
114
+            key: 'targetType',
69 115
             align: 'center',
116
+            render: (_, record) => <><span>{getType(record.targetType)} {'【' + record.targetName + '】'}</span></>
70 117
         },
71 118
         {
72 119
             title: '姓名',
73 120
             dataIndex: 'name',
74 121
             key: 'name',
75 122
             align: 'center',
123
+            render: (_, record) => <><span>{record.name || record.nickname}</span></>
76 124
         },
77 125
         {
78 126
             title: '电话',
@@ -89,15 +137,18 @@ function record(props) {
89 137
         },
90 138
         {
91 139
             title: '访问时间',
92
-            dataIndex: 'userName',
93
-            key: 'userName',
140
+            dataIndex: 'createDate',
141
+            key: 'createDate',
94 142
             align: 'center',
95
-            render: (_, record) => <><span>{record.reportDate && moment(record.reportDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
143
+            render: (_, record) => <><span>{record.createDate && moment(record.createDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
96 144
         },
97 145
 
98 146
     ];
99 147
 
100 148
     const { getFieldDecorator } = props.form
149
+    
150
+    let row = 0
151
+
101 152
     return (
102 153
 
103 154
         <>
@@ -105,22 +156,16 @@ function record(props) {
105 156
             <Form layout="inline">
106 157
                 <div style={{ display: 'flex', alignItems: 'center' }}>
107 158
                     <Form.Item>
108
-                        {getFieldDecorator('eventType')(
159
+                        {getFieldDecorator('targetType')(
109 160
                             <Select placeholder="分享类型" style={{ width: 150 }}>
110
-                                <Option value="activity_share">报名活动</Option>
111
-                                <Option value="help_share">助力活动</Option>
112
-                                <Option value="group_share">拼团活动</Option>
113
-                                <Option value="h5_share">H5活动</Option>
114
-                                <Option value="live_share">直播活动</Option>
115
-                                <Option value="house_share">房源列表</Option>
116
-                                <Option value="building_share">项目</Option>
117
-                                <Option value="news_share">资讯</Option>
118
-                                <Option value="index_share">首页</Option>
161
+                                {typeList.map((item, index) => (
162
+                                    <Option key={index} value={item.value}>{item.label}</Option>
163
+                                ))}
119 164
                             </Select>
120 165
                         )}
121 166
                     </Form.Item>
122 167
                     <Form.Item>
123
-                        {getFieldDecorator('activityName')(
168
+                        {getFieldDecorator('targetName')(
124 169
                             <Input
125 170
                                 prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
126 171
                                 placeholder="分享标题"
@@ -141,14 +186,14 @@ function record(props) {
141 186
                     </Form.Item>
142 187
                 </div>
143 188
             </Form>
144
-            <Table rowKey={record => (record.userId + record.buildingId || '')}
189
+            <Table rowKey={record => data.current * data.size + (row++)}
145 190
                 style={{ marginTop: '30px' }}
146 191
                 dataSource={data.records}
147 192
                 columns={columns}
148 193
                 pagination={false}
149 194
             />
150 195
             < div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
151
-                <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
196
+                <Pagination showQuickJumper defaultCurrent={1} loading={loading} total={data.total} onChange={changePageNum} current={data.current} />
152 197
             </div>
153 198
         </>
154 199
     )

+ 26
- 12
src/pages/statistical/consultant/visitPersons.jsx Näytä tiedosto

@@ -23,6 +23,7 @@ function record(props) {
23 23
 
24 24
     // 获取初始化数据
25 25
     const [data, setData] = useState({})
26
+    const [loading, updataLoading] = useState(true)
26 27
 
27 28
 
28 29
     useEffect(() => {
@@ -31,8 +32,9 @@ function record(props) {
31 32
 
32 33
     // 查询列表
33 34
     const getList = (params) => {
34
-        request({ ...apis.stats.totalPersons, params: { ...params }, }).then((data) => {
35
+        request({ ...apis.stats.visitPerson, params: { ...params }, }).then((data) => {
35 36
             setData(data)
37
+            updataLoading(false)
36 38
         })
37 39
     }
38 40
 
@@ -40,18 +42,28 @@ function record(props) {
40 42
     const changePageNum = (pageNumber) => {
41 43
         props.form.validateFields((err, values) => {
42 44
             if (!err) {
43
-                getList({ ...props.location.query, pageNum: pageNumber });
45
+                getList({ ...props.location.query, pageNum: pageNumber, pageSize: 10, });
44 46
             }
45 47
         });
46 48
     }
47
-    const toPersonDetail = (personId) => {
49
+    const tovisitNum = (name, personId) => {
48 50
         router.push({
49
-            pathname: '/customer/customerlist/publicCustomerDetail',
51
+            pathname: '/statistical/consultant/visitNum',
50 52
             query: {
51
-                id: personId,
53
+                ...props.location.query,
54
+                userName: name,
55
+                personId,
52 56
             },
53 57
         });
54 58
     }
59
+    // const toPersonDetail = (personId) => {
60
+    //     router.push({
61
+    //         pathname: '/customer/customerlist/publicCustomerDetail',
62
+    //         query: {
63
+    //             id: personId,
64
+    //         },
65
+    //     });
66
+    // }
55 67
     // 表格数据
56 68
     const columns = [
57 69
         {
@@ -59,6 +71,7 @@ function record(props) {
59 71
             dataIndex: 'name',
60 72
             key: 'name',
61 73
             align: 'center',
74
+            render: (_, record) => <span >{record.name || record.nickname}</span>,
62 75
         },
63 76
         {
64 77
             title: '电话',
@@ -75,17 +88,17 @@ function record(props) {
75 88
         },
76 89
         {
77 90
             title: '访问次数',
78
-            dataIndex: 'visitNum',
79
-            key: 'visitNum',
91
+            dataIndex: 'visitTimes',
92
+            key: 'visitTimes',
80 93
             align: 'center',
81
-            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.visitNum}</span>,
94
+            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => tovisitNum(record.name || record.nickname, record.personId)} >{record.visitTimes}</span>,
82 95
         },
83 96
         {
84 97
             title: '最后访问时间',
85
-            dataIndex: 'reportDate',
86
-            key: 'reportDate',
98
+            dataIndex: 'createDate',
99
+            key: 'createDate',
87 100
             align: 'center',
88
-            render: (_, record) => <><span>{record.reportDate && moment(record.reportDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
101
+            render: (_, record) => <><span>{record.createDate && moment(record.createDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
89 102
         },
90 103
 
91 104
     ];
@@ -94,11 +107,12 @@ function record(props) {
94 107
 
95 108
         <>
96 109
             <Button type="danger" style={{ marginLeft: '18px' }} onClick={() => router.go(-1)}>返回</Button>
97
-            <Table rowKey={record => (record.phone + record.buildingId || '')}
110
+            <Table rowKey={record => (record.personId + record.buildingId || '')}
98 111
                 style={{ marginTop: '30px' }}
99 112
                 dataSource={data.records}
100 113
                 columns={columns}
101 114
                 pagination={false}
115
+                loading={loading}
102 116
             />
103 117
             < div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
104 118
                 <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />

+ 18
- 2
src/services/apis.js Näytä tiedosto

@@ -1692,6 +1692,21 @@ export default {
1692 1692
       url: `${prefix}/stats/consultant/customer`,
1693 1693
       action: 'admin.contract.list.get',
1694 1694
     },
1695
+    shareNum: { // 分享次数
1696
+      method: 'GET',
1697
+      url: `${prefix}/stats/consultant/share/targets`,
1698
+      action: 'admin.contract.list.get',
1699
+    },
1700
+    visitPerson: { // 分享访问人数
1701
+      method: 'GET',
1702
+      url: `${prefix}/stats/consultant/share/persons`,
1703
+      action: 'admin.contract.list.get',
1704
+    },
1705
+    visitNum: { // 分享访问次数
1706
+      method: 'GET',
1707
+      url: `${prefix}/stats/consultant/share/times`,
1708
+      action: 'admin.contract.list.get',
1709
+    },
1695 1710
     sharePersons: { // 分享拓客
1696 1711
       method: 'GET',
1697 1712
       url: `${prefix}/stats/consultant/share/customer`,
@@ -1712,12 +1727,13 @@ export default {
1712 1727
       url: `${prefix}/stats/consultant/chat/persons`,
1713 1728
       action: 'admin.contract.list.get',
1714 1729
     },
1715
-    shareNum: { // 分享次
1730
+    favorNum: { // 点赞
1716 1731
       method: 'GET',
1717
-      url: `${prefix}/stats/consultant/share/targets`,
1732
+      url: `${prefix}/stats/consultant/favor`,
1718 1733
       action: 'admin.contract.list.get',
1719 1734
     },
1720 1735
 
1736
+
1721 1737
     buildingExport: {
1722 1738
       method: 'GET',
1723 1739
       url: `${prefix}/stats/buildingExport`,