Pārlūkot izejas kodu

Merge branch 'master' of http://git.ycjcjy.com/marketing/pc-admin into master

张延森 4 gadus atpakaļ
vecāks
revīzija
fafa3733d3
75 mainītis faili ar 6028 papildinājumiem un 8064 dzēšanām
  1. 72
    111
      config/routes.js
  2. 3
    2
      src/components/QueryTable/index.jsx
  3. 30
    22
      src/components/Search/Field.jsx
  4. 57
    51
      src/components/TableList/index.jsx
  5. 150
    106
      src/pages/Live/LiveActivity/Edit/components/base.jsx
  6. 58
    31
      src/pages/Live/LiveActivity/Edit/index.jsx
  7. 137
    106
      src/pages/Live/LiveActivity/List/index.jsx
  8. 176
    0
      src/pages/Live/LiveActivity/add/index.jsx
  9. 2
    1
      src/pages/Live/liveActivity copy/edit/components/shareRecord.jsx
  10. 0
    408
      src/pages/activity/ActivityList.jsx
  11. 14
    24
      src/pages/activity/SignupActivity/detail.jsx
  12. 294
    0
      src/pages/activity/SignupActivity/edit/Basic.jsx
  13. 255
    0
      src/pages/activity/SignupActivity/edit/Poster.jsx
  14. 150
    0
      src/pages/activity/SignupActivity/edit/Share.jsx
  15. 13
    19
      src/pages/activity/SignupActivity/edit/ind.jsx
  16. 34
    0
      src/pages/activity/SignupActivity/edit/index.jsx
  17. 331
    0
      src/pages/activity/SignupActivity/index.jsx
  18. 84
    51
      src/pages/activity/SignupActivity/registrationRecord.jsx
  19. 0
    16
      src/pages/activity/activityRecord.jsx
  20. 0
    122
      src/pages/activity/dataRecord/index.jsx
  21. 0
    170
      src/pages/activity/dataRecord/table/newuser.jsx
  22. 0
    170
      src/pages/activity/dataRecord/table/shareNum.jsx
  23. 0
    205
      src/pages/activity/dataRecord/table/shares.jsx
  24. 0
    195
      src/pages/activity/dataRecord/table/visitNum.jsx
  25. 0
    204
      src/pages/activity/dataRecord/table/visitors.jsx
  26. 0
    207
      src/pages/activity/drainage/Detail.jsx
  27. 0
    600
      src/pages/activity/drainage/DrainageList.jsx
  28. 0
    243
      src/pages/activity/drainage/components/Basic.jsx
  29. 0
    46
      src/pages/activity/drainage/components/CheckboxGroup.jsx
  30. 0
    211
      src/pages/activity/drainage/components/CustomerData.jsx
  31. 0
    198
      src/pages/activity/drainage/components/Help.jsx
  32. 0
    110
      src/pages/activity/drainage/components/ImageUpload.jsx
  33. 0
    148
      src/pages/activity/drainage/components/Ranking.jsx
  34. 0
    218
      src/pages/activity/drainage/components/RedPacket.jsx
  35. 0
    163
      src/pages/activity/drainage/components/RedPacketRecord.jsx
  36. 0
    120
      src/pages/activity/drainage/components/style.less
  37. 0
    39
      src/pages/activity/drainage/components/styles.less
  38. 0
    114
      src/pages/activity/drainage/detailDrainage.jsx
  39. 0
    16
      src/pages/activity/drainage/drainageRecord.jsx
  40. 0
    89
      src/pages/activity/drainage/h5edit.jsx
  41. 0
    432
      src/pages/activity/groupActivity/editGroupActivity.jsx
  42. 0
    16
      src/pages/activity/groupActivity/groupActivityRecord.jsx
  43. 0
    546
      src/pages/activity/groupActivity/helpRecord.jsx
  44. 0
    377
      src/pages/activity/groupActivity/list.jsx
  45. 107
    86
      src/pages/activity/groupRoomActivity/detail.jsx
  46. 294
    0
      src/pages/activity/groupRoomActivity/edit/Basic.jsx
  47. 255
    0
      src/pages/activity/groupRoomActivity/edit/Poster.jsx
  48. 150
    0
      src/pages/activity/groupRoomActivity/edit/Share.jsx
  49. 183
    208
      src/pages/activity/groupRoomActivity/edit/ind.jsx
  50. 34
    0
      src/pages/activity/groupRoomActivity/edit/index.jsx
  51. 331
    0
      src/pages/activity/groupRoomActivity/index.jsx
  52. 213
    0
      src/pages/activity/groupRoomActivity/registrationRecord.jsx
  53. 0
    15
      src/pages/activity/helpActivity/helpActivityRecord.jsx
  54. 0
    547
      src/pages/activity/helpActivity/helpRecord.jsx
  55. 0
    372
      src/pages/activity/helpActivity/list.jsx
  56. 0
    546
      src/pages/activity/helpActivity/signList.jsx
  57. 132
    113
      src/pages/activity/lookHouseActivity/detail.jsx
  58. 294
    0
      src/pages/activity/lookHouseActivity/edit/Basic.jsx
  59. 255
    0
      src/pages/activity/lookHouseActivity/edit/Poster.jsx
  60. 150
    0
      src/pages/activity/lookHouseActivity/edit/Share.jsx
  61. 524
    0
      src/pages/activity/lookHouseActivity/edit/ind.jsx
  62. 34
    0
      src/pages/activity/lookHouseActivity/edit/index.jsx
  63. 331
    0
      src/pages/activity/lookHouseActivity/index.jsx
  64. 213
    0
      src/pages/activity/lookHouseActivity/registrationRecord.jsx
  65. 82
    51
      src/pages/building/Developers/Edit.jsx
  66. 39
    13
      src/pages/building/Developers/index.jsx
  67. 1
    1
      src/pages/building/Developers/searchFields.js
  68. 17
    31
      src/pages/building/Developers/tableColumns.js
  69. 22
    32
      src/pages/home/Recommend/index.jsx
  70. 0
    0
      src/pages/staff/Organization/form.jsx
  71. 122
    126
      src/pages/staff/Organization/index.jsx
  72. 2
    2
      src/pages/staff/staff/Edit/index.jsx
  73. 317
    0
      src/pages/staff/staff/Edit/index1.jsx
  74. 61
    13
      src/services/apis.js
  75. 5
    1
      src/utils/request.js

+ 72
- 111
config/routes.js Parādīt failu

@@ -191,10 +191,17 @@ export default [
191 191
               },
192 192
               {
193 193
                 path: '/Live/LiveActivity/Edit',
194
-                name: '直播活动',
194
+                name: '编辑活动',
195 195
                 hideInMenu: true,
196 196
                 component: './Live/LiveActivity/Edit',
197 197
               },
198
+              {
199
+                path: '/Live/LiveActivity/add',
200
+                name: '新增活动',
201
+                hideInMenu: true,
202
+                component: './Live/LiveActivity/add',
203
+              },
204
+              
198 205
               // {
199 206
               //   path: '/staff/Staff/Edit',
200 207
               //   name: '编辑员工',
@@ -232,150 +239,104 @@ export default [
232 239
             component: '../layouts/BlankLayout',
233 240
             routes: [
234 241
               {
235
-                path: '/activity/ActivityList',
236
-                name: '报名活动',
237
-                component: './activity/ActivityList',
242
+                path: '/activity/groupRoomActivity',
243
+                name: '团房活动',
244
+                component: './activity/groupRoomActivity',
238 245
               },
239 246
               {
240
-                path: '/activity/editActivity',
241
-                name: '编辑活动',
242
-                hideInMenu: true,
243
-                component: './activity/editActivity',
244
-              },
245
-              {
246
-                path: '/activity/detailActivity',
247
+                path: '/activity/groupRoomActivity/detail',
247 248
                 name: '活动详情',
248 249
                 hideInMenu: true,
249
-                component: './activity/detailActivity',
250
-              },
251
-              {
252
-                path: '/activity/SignList',
253
-                name: '报名列表',
254
-                hideInMenu: true,
255
-                component: './activity/SignList',
256
-              },
257
-              {
258
-                path: '/activity/activityRecord',
259
-                name: '数据记录',
260
-                hideInMenu: true,
261
-                component: './activity/activityRecord',
262
-              },
263
-              {
264
-                path: '/activity/helpActivity/list',
265
-                name: '助力活动',
266
-                component: './activity/helpActivity/list',
267
-              },
268
-              {
269
-                path: '/activity/helpActivity/helpRecord',
270
-                name: '助力记录',
271
-                hideInMenu: true,
272
-                component: './activity/helpActivity/helpRecord',
250
+                component: './activity/groupRoomActivity/detail',
273 251
               },
274 252
               {
275
-                path: '/activity/helpActivity/edithelpActivity',
276
-                name: '编辑',
277
-                hideInMenu: true,
278
-                component: './activity/helpActivity/edithelpActivity',
279
-              },
280
-              {
281
-                path: '/activity/helpActivity/signList',
282
-                name: '助力记录',
283
-                hideInMenu: true,
284
-                component: './activity/helpActivity/signList',
285
-              },
286
-              {
287
-                path: '/activity/helpActivity/helpActivityRecord',
288
-                name: '数据记录',
253
+                path: '/activity/groupRoomActivity/edit',
254
+                name: '编辑活动',
289 255
                 hideInMenu: true,
290
-                component: './activity/helpActivity/helpActivityRecord',
291
-              },
292
-              {
293
-                path: '/activity/groupActivity/list',
294
-                name: '拼团活动',
295
-                component: './activity/groupActivity/list',
256
+                component: './activity/groupRoomActivity/edit',
296 257
               },
297 258
               {
298
-                path: '/activity/groupActivity/helpRecord',
299
-                name: '拼团记录',
259
+                path: '/activity/groupRoomActivity/registrationRecord',
260
+                name: '报名记录',
300 261
                 hideInMenu: true,
301
-                component: './activity/groupActivity/helpRecord',
262
+                component: './activity/groupRoomActivity/registrationRecord',
302 263
               },
264
+              
265
+
303 266
               {
304
-                path: '/activity/groupActivity/editgroupActivity',
305
-                name: '新增',
306
-                hideInMenu: true,
307
-                component: './activity/groupActivity/editgroupActivity',
267
+                path: '/activity/lookHouseActivity',
268
+                name: '看房团',
269
+                component: './activity/lookHouseActivity',
308 270
               },
309 271
               {
310
-                path: '/activity/groupActivity/detailActivity',
272
+                path: '/activity/lookHouseActivity/detail',
311 273
                 name: '活动详情',
312 274
                 hideInMenu: true,
313
-                component: './activity/groupActivity/detailActivity',
314
-              },
315
-              {
316
-                path: '/activity/groupActivity/groupActivityRecord',
317
-                name: '数据记录',
318
-                hideInMenu: true,
319
-                component: './activity/groupActivity/groupActivityRecord',
275
+                component: './activity/lookHouseActivity/detail',
320 276
               },
321 277
               {
322
-                path: '/activity/drainage/DrainageList',
323
-                name: 'H5活动',
324
-                component: './activity/drainage/DrainageList',
325
-              },
326
-              {
327
-                path: '/activity/drainage/Detail',
328
-                name: '查看详情',
278
+                path: '/activity/lookHouseActivity/edit',
279
+                name: '编辑活动',
329 280
                 hideInMenu: true,
330
-                component: './activity/drainage/Detail',
281
+                component: './activity/lookHouseActivity/edit',
331 282
               },
332 283
               {
333
-                path: '/activity/drainage/DetailDrainage',
334
-                name: 'H5详情',
284
+                path: '/activity/lookHouseActivity/registrationRecord',
285
+                name: '报名记录',
335 286
                 hideInMenu: true,
336
-                component: './activity/drainage/DetailDrainage',
287
+                component: './activity/lookHouseActivity/registrationRecord',
337 288
               },
289
+
290
+
291
+
338 292
               {
339
-                path: '/activity/drainage/h5edit',
340
-                name: 'H5详情',
341
-                hideInMenu: true,
342
-                component: './activity/drainage/h5edit',
293
+                path: '/activity/SignupActivity',
294
+                name: '报名活动',
295
+                component: './activity/SignupActivity',
343 296
               },
344 297
               {
345
-                path: '/activity/helpActivity/detailActivity',
298
+                path: '/activity/SignupActivity/detail',
346 299
                 name: '活动详情',
347 300
                 hideInMenu: true,
348
-                component: './activity/helpActivity/detailActivity',
349
-              },
350
-              {
351
-                path: '/activity/drainage/drainageRecord',
352
-                name: '数据记录',
353
-                hideInMenu: true,
354
-                component: './activity/drainage/drainageRecord',
355
-              },
356
-              {
357
-                path: '/activity/liveActivity/list/index',
358
-                name: '直播活动',
359
-                component: './activity/liveActivity/list/index',
360
-              },
361
-              {
362
-                path: '/activity/liveActivity/add',
363
-                name: '新增',
364
-                hideInMenu: true,
365
-                component: './activity/liveActivity/add',
301
+                component: './activity/SignupActivity/detail',
366 302
               },
367 303
               {
368
-                path: '/activity/liveActivity/edit',
369
-                name: '编辑',
304
+                path: '/activity/SignupActivity/edit',
305
+                name: '编辑活动',
370 306
                 hideInMenu: true,
371
-                component: './activity/liveActivity/edit',
307
+                component: './activity/SignupActivity/edit',
372 308
               },
373 309
               {
374
-                path: '/activity/liveActivity/liveActivityRecord',
375
-                name: '数据记录',
310
+                path: '/activity/SignupActivity/registrationRecord',
311
+                name: '报名记录',
376 312
                 hideInMenu: true,
377
-                component: './activity/liveActivity/list/liveActivityRecord',
313
+                component: './activity/SignupActivity/registrationRecord',
378 314
               },
315
+
316
+              // {
317
+              //   path: '/activity/SignupActivity',
318
+              //   name: '报名活动',
319
+              //   component: './activity/SignupActivity',
320
+              // },
321
+              // {
322
+              //   path: '/activity/SignupActivity/detail',
323
+              //   name: '活动详情',
324
+              //   hideInMenu: true,
325
+              //   component: './activity/SignupActivity/detail',
326
+              // },
327
+              // {
328
+              //   path: '/activity/SignupActivity/edit',
329
+              //   name: '编辑活动',
330
+              //   hideInMenu: true,
331
+              //   component: './activity/SignupActivity/edit',
332
+              // },
333
+              // {
334
+              //   path: '/activity/SignupActivity/registrationRecord',
335
+              //   name: '报名记录',
336
+              //   hideInMenu: true,
337
+              //   component: './activity/SignupActivity/registrationRecord',
338
+              // },
339
+              
379 340
             ],
380 341
           },
381 342
           {
@@ -516,7 +477,7 @@ export default [
516 477
             component: '../layouts/BlankLayout',
517 478
             routes: [
518 479
               {
519
-                path: '/home/recommend/home',
480
+                path: '/home/recommend',
520 481
                 name: '找房需求',
521 482
                 component: './home/recommend/index',
522 483
               },

+ 3
- 2
src/components/QueryTable/index.jsx Parādīt failu

@@ -6,7 +6,7 @@ export default React.forwardRef((props, ref) => {
6 6
   const tableRef = useRef()
7 7
   const searchRef = useRef()
8 8
   const [searchData, setSearchData] = useState({})
9
-  const {api, searchFields, params, onPageChange, ...leftProps} = props
9
+  const {api, searchFields, params, onPageChange,searchProps, ...leftProps} = props
10 10
   const handleSearch = (data) => setSearchData(data)
11 11
 
12 12
   useImperativeHandle(ref, () => ({
@@ -21,10 +21,11 @@ export default React.forwardRef((props, ref) => {
21 21
   return (
22 22
     <>
23 23
       <Search
24
-      ref={searchRef}
24
+        ref={searchRef}
25 25
         fields={searchFields}
26 26
         onSearch={handleSearch}
27 27
         onReset={handleSearch}
28
+        searchProps={searchProps}
28 29
       />
29 30
 
30 31
       <TableList

+ 30
- 22
src/components/Search/Field.jsx Parādīt failu

@@ -1,39 +1,47 @@
1
-import React from 'react'
2
-import { Input, Select, DatePicker } from 'antd'
1
+import React from 'react';
2
+import { Input, Select, DatePicker } from 'antd';
3 3
 
4
-const Option = Select.Option
5
-const { RangePicker } = DatePicker
4
+const Option = Select.Option;
5
+const { RangePicker } = DatePicker;
6 6
 
7
-export default (props) => {
8
-  const { style, type, value, options = [], placeholder, render, onChange } = props
7
+export default props => {
8
+  const { style, type, value, options = [], placeholder, render, onChange } = props;
9 9
 
10 10
   if (typeof render === 'function') {
11
-    const Element = render()
12
-    return React.cloneElement(Element, { value, onChange })
11
+    const Element = render();
12
+    return React.cloneElement(Element, { value, onChange });
13 13
   }
14 14
 
15
-  const handleChange = (e) => {
16
-    const isInput = !type || type === 'text' || type === 'input'
17
-    onChange(isInput ? e.target.value : e)
18
-  }
15
+  const handleChange = e => {
16
+    const isInput = !type || type === 'text' || type === 'input';
17
+    onChange(isInput ? e.target.value : e);
18
+  };
19 19
 
20 20
   switch (type) {
21 21
     case 'datepicker':
22
+      return <DatePicker value={value} placeholder={placeholder} onChange={handleChange} />;
22 23
     case 'rangepicker':
23
-      return (
24
-        <RangePicker value={value} placeholder={placeholder} onChange={handleChange} />
25
-      )
24
+      return <RangePicker value={value} placeholder={placeholder} onChange={handleChange} />;
26 25
     case 'select':
27 26
       return (
28
-        <Select style={style || {width: 160}} placeholder={placeholder} value={value} onChange={handleChange}>
29
-          {
30
-            options.map((item) => <Option key={item.value} value={item.value}>{item.label}</Option>)
31
-          }
27
+        <Select
28
+          style={style || { width: 160 }}
29
+          placeholder={placeholder}
30
+          value={value}
31
+          onChange={handleChange}
32
+        >
33
+          {options.map(item => (
34
+            <Option key={item.value} value={item.value}>
35
+              {item.label}
36
+            </Option>
37
+          ))}
32 38
         </Select>
33
-      )
39
+      );
34 40
     case 'text':
35 41
     case 'input':
36 42
     default:
37
-      return <Input style={style} value={value} placeholder={placeholder} onChange={handleChange} />
43
+      return (
44
+        <Input style={style} value={value} placeholder={placeholder} onChange={handleChange} />
45
+      );
38 46
   }
39
-}
47
+};

+ 57
- 51
src/components/TableList/index.jsx Parādīt failu

@@ -1,94 +1,100 @@
1 1
 import React, { useCallback, useRef, useState, useEffect, useImperativeHandle } from 'react';
2 2
 // import { stringify } from 'querystring';
3 3
 import { notification } from 'antd';
4
-import request from '@/utils/request'
4
+import request from '@/utils/request';
5 5
 import TableList from './TableList';
6 6
 import Pagination from './Pagination';
7 7
 
8 8
 export default React.forwardRef((props, ref) => {
9
-  const [loading, setLoading] = useState(false)
10
-  const mounted = useRef(false)
11
-  const [list, setList] = useState()
12
-  const [pageTotal, setPageTotal] = useState(0)
13
-  const [pageConfig, setPageConfig] = useState({ current: 1, pageSize: 10 })
9
+  const [loading, setLoading] = useState(false);
10
+  const mounted = useRef(false);
11
+  const [list, setList] = useState();
12
+  const [pageTotal, setPageTotal] = useState(0);
13
+  const [pageConfig, setPageConfig] = useState({ current: 1, pageSize: 10 });
14 14
 
15
-  const { api,urlData, params, onPageChange, ...tableProps } = props
15
+  const { api, urlData, params, onPageChange, postData=()=>{}, ...tableProps } = props;
16 16
 
17 17
   // 更新分页
18 18
   const updatePage = useCallback(
19 19
     (current, pageSize) => {
20
-      const config = pageSize ? { current, pageSize } : { current, pageSize:pageConfig.pageSize }
20
+      const config = pageSize ? { current, pageSize } : { current, pageSize: pageConfig.pageSize };
21 21
       const newPage = {
22 22
         ...pageConfig,
23 23
         ...config,
24
-      }
25
-  
26
-      setPageConfig(newPage)
24
+      };
25
+
26
+      setPageConfig(newPage);
27 27
       if (onPageChange) {
28
-        onPageChange(newPage)
28
+        onPageChange(newPage);
29 29
       }
30 30
     },
31 31
     [pageConfig],
32
-  )
32
+  );
33 33
 
34 34
   // 获取远程数据
35
-  const fetchData = useCallback(
36
-    () => {
37
-      setLoading(true)
38
-      const queryParams = {
39
-        ...params || {},
40
-        pageNum: pageConfig.current,
41
-        pageSize: pageConfig.pageSize,
42
-      }
43
-      request({...api, urlData:urlData||undefined, params: queryParams }).then((res) => {
44
-        if(res.records){
45
-          const {total, records = []} = res
46
-          setLoading(false)
47
-          setList(records)
48
-          setPageTotal(total)
49
-        }
50
-        else if(res.result){
51
-          const {total, records = []} = res.result
52
-          setLoading(false)
53
-          setList(records)
54
-          setPageTotal(total)
35
+  const fetchData = useCallback(() => {
36
+    setLoading(true);
37
+
38
+
39
+    const queryParams = {
40
+      ...(postData(params) || params || {}),
41
+      pageNum: pageConfig.current,
42
+      pageSize: pageConfig.pageSize,
43
+    };
44
+
45
+    request({ ...api, urlData: urlData || undefined, params: queryParams })
46
+      .then(res => {
47
+        console.log(res, 'fetchData');
48
+        if (res.records) {
49
+          const { total, records = [] } = res;
50
+          setLoading(false);
51
+          setList(records);
52
+          setPageTotal(total);
53
+        } else if (res.list) {
54
+          const { total, list = [] } = res;
55
+          setLoading(false);
56
+          setList(list);
57
+          setPageTotal(total);
58
+        } else if (res.result) {
59
+          const { total, records = [] } = res.result;
60
+          setLoading(false);
61
+          setList(records);
62
+          setPageTotal(total);
55 63
         }
56
-        
57
-      }).catch((err) => {
58
-        console.error(err)
59
-        setLoading(false)
60
-        notification.warn({ message: err.message })
61 64
       })
62
-    },
63
-    [params, pageConfig, api],
64
-  )
65
+      .catch(err => {
66
+        console.error(err);
67
+        setLoading(false);
68
+        notification.warn({ message: err.message });
69
+      });
70
+  }, [params, pageConfig, api]);
65 71
 
66 72
   // 监控查询参数的修改
67 73
   useEffect(() => {
68 74
     // 通过更新分页来触发查询
69
-    updatePage(1)
70
-  }, [params])
71
-  
75
+    updatePage(1);
76
+  }, [params]);
77
+
72 78
   // 监控分页的修改
73 79
   useEffect(() => {
74 80
     // 首次加载不查询
75 81
     if (!mounted.current) {
76
-      mounted.current = true
77
-      return
82
+      mounted.current = true;
83
+      return;
78 84
     }
79 85
 
80
-    fetchData()
81
-  }, [pageConfig])
86
+    fetchData();
87
+  }, [pageConfig]);
82 88
 
83 89
   // 透传给父组件部分方法
84 90
   useImperativeHandle(ref, () => ({
85
-    reload: fetchData
86
-  }))
91
+    reload: fetchData,
92
+  }));
87 93
 
88 94
   return (
89 95
     <>
90 96
       <TableList loading={loading} dataSource={list} {...tableProps} />
91 97
       <Pagination {...pageConfig} total={pageTotal} onChange={updatePage} />
92 98
     </>
93
-  )
99
+  );
94 100
 });

+ 150
- 106
src/pages/Live/LiveActivity/Edit/components/base.jsx Parādīt failu

@@ -1,5 +1,17 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload, InputNumber } from 'antd';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  Icon,
7
+  Select,
8
+  Tabs,
9
+  Radio,
10
+  DatePicker,
11
+  message,
12
+  Upload,
13
+  InputNumber,
14
+} from 'antd';
3 15
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 16
 import moment from 'moment';
5 17
 import router from 'umi/router';
@@ -7,56 +19,58 @@ import styles from '../../../../style/GoodsList.less';
7 19
 import XForm, { FieldTypes, createForm } from '../../../../../components/XForm';
8 20
 import apis from '../../../../../services/apis';
9 21
 import BuildSelect2 from '../../../../../components/SelectButton/BuildSelect2';
10
-import LivePlatSelect from '../../../../../components/SelectButton/LivePlatSelect'
22
+import LivePlatSelect from '../../../../../components/SelectButton/LivePlatSelect';
11 23
 import CitySelect3 from '../../../../../components/SelectButton/CitySelect3';
12
-import ImageUpload from '../../../../../components/XForm/ImageUpload'
24
+import ImageUpload from '../../../../../components/XForm/ImageUpload';
13 25
 import request from '../../../../../utils/request';
14 26
 import Navigate from '@/components/Navigate';
15 27
 
16 28
 const { Option } = Select;
17 29
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
18 30
 
19
-let cityId = ''
31
+let cityId = '';
20 32
 
21 33
 const header = props => {
22
-  console.log(props)
23
-  const liveActivityId = props.liveActivityId.liveId
24
-  console.log(liveActivityId)
25
-  const [ liveActivityData, setLiveActivityData ] = useState({})
26
-  const [showHelp, setShowHelp] = useState(false)
34
+  console.log(props);
35
+  const liveActivityId = props.liveActivityId.liveId;
36
+  console.log(liveActivityId);
37
+  const [liveActivityData, setLiveActivityData] = useState({});
38
+  const [showHelp, setShowHelp] = useState(false);
27 39
 
28
-  if(liveActivityId){
29
-    useEffect(() => {
40
+  useEffect(() => {
41
+    if (liveActivityId) {
30 42
       getLiveActivityData(liveActivityId);
31
-    },[])
43
+    }
44
+  }, []);
32 45
 
33 46
   // 查询列表
34
-  const getLiveActivityData = (liveActivityId) => {
35
-    request({ ...apis.taliveActivity.getTaLiveActivity, urlData: {id: liveActivityId} }).then((data) => {
36
-        console.log(data, 'getLiveActivityData')
37
-        setLiveActivityData(data.data)
47
+  const getLiveActivityData = liveActivityId => {
48
+    request({ ...apis.taliveActivity.getTaLiveActivity, urlData: { id: liveActivityId } }).then(
49
+      data => {
50
+        console.log(data, 'getLiveActivityData');
51
+        setLiveActivityData(data.data);
38 52
         // if(data.qrCode == 'null'){
39 53
         //   message.error("暂时无法获取二维码")
40 54
         // }
41
-    })
42
-  }
43
-  }
55
+      },
56
+    );
57
+  };
44 58
 
45
-  const cancelPage = () =>{
59
+  const cancelPage = () => {
46 60
     router.push({
47 61
       pathname: '/activity/liveActivity/list/index',
48 62
     });
49
-  }
63
+  };
50 64
 
51 65
   //打开新页面
52 66
   const openIndexImg = () => {
53
-    const newWin=window.open('about:blank');
54
-    newWin.location.href="http://njcj.oss-cn-shanghai.aliyuncs.com/%E6%95%99%E7%A8%8B.png"
55
-  }
67
+    const newWin = window.open('about:blank');
68
+    newWin.location.href = 'http://njcj.oss-cn-shanghai.aliyuncs.com/%E6%95%99%E7%A8%8B.png';
69
+  };
56 70
 
57 71
   function highlightsTypeChange(e) {
58
-    console.log(e.target.value,"ee")
59
-    setTypeState(e.target.value)
72
+    console.log(e.target.value, 'ee');
73
+    setTypeState(e.target.value);
60 74
   }
61 75
 
62 76
   function disabledDate(current) {
@@ -64,30 +78,38 @@ const header = props => {
64 78
     return current && current < moment().endOf('day');
65 79
   }
66 80
 
67
-  function handleSubmit (e) {
81
+  function handleSubmit(e) {
68 82
     e.preventDefault();
69 83
     props.form.validateFields((err, values) => {
70 84
       console.log(values, 'values');
71
-      if (!err){
72
-        let {liveTime, ...submitValue} = values
73
-        if (submitValue.status == '已发布' || submitValue.status == '1'){
74
-          submitValue.status = 1
75
-        }else{
76
-          submitValue.status = 0
85
+      if (!err) {
86
+        let { liveTime, ...submitValue } = values;
87
+        if (submitValue.status == '已发布' || submitValue.status == '1') {
88
+          submitValue.status = 1;
89
+        } else {
90
+          submitValue.status = 0;
77 91
         }
78
-        if (values.liveStartDate > values.liveEndDate){
79
-          message.info("直播结束时间大于开始时间")
92
+        if (values.liveStartDate > values.liveEndDate) {
93
+          message.info('直播结束时间大于开始时间');
80 94
           return;
81 95
         }
82
-        submitValue.liveStartDate = moment(submitValue.liveStartDate._d).format('YYYY-MM-DD HH:mm:ss')
83
-        submitValue.liveEndDate = moment(submitValue.liveEndDate._d).format('YYYY-MM-DD HH:mm:ss')
84
-        console.log(submitValue)
85
-        request({ ...apis.taliveActivity.updateTaLiveActivity, urlData: {id: liveActivityId},data: submitValue, }).then((data) => {
86
-          message.info("保存成功")
87
-          cancelPage()
88
-        }).catch((err) => {
89
-          message.info(err.msg || err.message)
96
+        submitValue.liveStartDate = moment(submitValue.liveStartDate._d).format(
97
+          'YYYY-MM-DD HH:mm:ss',
98
+        );
99
+        submitValue.liveEndDate = moment(submitValue.liveEndDate._d).format('YYYY-MM-DD HH:mm:ss');
100
+        console.log(submitValue);
101
+        request({
102
+          ...apis.taliveActivity.updateTaLiveActivity,
103
+          urlData: { id: liveActivityId },
104
+          data: submitValue,
90 105
         })
106
+          .then(data => {
107
+            message.info('保存成功');
108
+            cancelPage();
109
+          })
110
+          .catch(err => {
111
+            message.info(err.msg || err.message);
112
+          });
91 113
       }
92 114
     });
93 115
   }
@@ -101,12 +123,12 @@ const header = props => {
101 123
           {getFieldDecorator('cityId', {
102 124
             initialValue: liveActivityData.cityId,
103 125
             rules: [{ required: true, message: ' 请输入所属城市' }],
104
-          })(<CitySelect3 buildingId={props.form.getFieldValue('buildingId')}/>)}
126
+          })(<CitySelect3 buildingId={props.form.getFieldValue('buildingId')} />)}
105 127
         </Form.Item>
106 128
         <Form.Item label="所属楼盘">
107 129
           {getFieldDecorator('buildingId', {
108 130
             initialValue: liveActivityData.buildingId,
109
-          })(<BuildSelect2 cityId={props.form.getFieldValue('cityId')}/>)}
131
+          })(<BuildSelect2 cityId={props.form.getFieldValue('cityId')} />)}
110 132
         </Form.Item>
111 133
         <Form.Item label="直播活动标题">
112 134
           {getFieldDecorator('liveActivityTitle', {
@@ -115,92 +137,114 @@ const header = props => {
115 137
           })(<Input maxLength={20} placeholder="给直播活动起个名字" />)}
116 138
         </Form.Item>
117 139
         <Form.Item label="直播开始时间">
118
-          {getFieldDecorator('liveStartDate', { initialValue : liveActivityData.liveStartDate ? moment(liveActivityData.liveStartDate, 'YYYY-MM-DD HH:mm:ss') : null,
119
-                rules: [
120
-                  {
121
-                    required: true,
122
-                    message: '请选择直播开始时间',
123
-                  },
124
-                ],
125
-              })(<DatePicker placeholder="预计开始时间" style={{ width: '500px' }}format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
140
+          {getFieldDecorator('liveStartDate', {
141
+            initialValue: liveActivityData.liveStartDate
142
+              ? moment(liveActivityData.liveStartDate, 'YYYY-MM-DD HH:mm:ss')
143
+              : null,
144
+            rules: [
145
+              {
146
+                required: true,
147
+                message: '请选择直播开始时间',
148
+              },
149
+            ],
150
+          })(
151
+            <DatePicker
152
+              placeholder="预计开始时间"
153
+              style={{ width: '500px' }}
154
+              format="YYYY-MM-DD HH:mm:ss"
155
+              showTime={{ format: 'HH:mm:ss' }}
156
+            />,
157
+          )}
126 158
         </Form.Item>
127 159
         <Form.Item label="直播结束时间">
128
-          {getFieldDecorator('liveEndDate', { initialValue : liveActivityData.liveEndDate ? moment(liveActivityData.liveEndDate, 'YYYY-MM-DD HH:mm:ss') : null,
129
-                rules: [
130
-                  {
131
-                    required: true,
132
-                    message: '请选择直播结束时间',
133
-                  },
134
-                ],
135
-              })(<DatePicker placeholder="预计结束时间" disabledDate={disabledDate} style={{ width: '500px' }}format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
160
+          {getFieldDecorator('liveEndDate', {
161
+            initialValue: liveActivityData.liveEndDate
162
+              ? moment(liveActivityData.liveEndDate, 'YYYY-MM-DD HH:mm:ss')
163
+              : null,
164
+            rules: [
165
+              {
166
+                required: true,
167
+                message: '请选择直播结束时间',
168
+              },
169
+            ],
170
+          })(
171
+            <DatePicker
172
+              placeholder="预计结束时间"
173
+              disabledDate={disabledDate}
174
+              style={{ width: '500px' }}
175
+              format="YYYY-MM-DD HH:mm:ss"
176
+              showTime={{ format: 'HH:mm:ss' }}
177
+            />,
178
+          )}
136 179
         </Form.Item>
137 180
         <Form.Item label="直播小程序">
138 181
           {getFieldDecorator('liveApp', {
139
-              initialValue: liveActivityData.liveApp,
140
-              rules: [{ required: true, message: '请选择直播小程序' }],
141
-            })(<LivePlatSelect />)}
182
+            initialValue: liveActivityData.liveApp,
183
+            rules: [{ required: true, message: '请选择直播小程序' }],
184
+          })(<LivePlatSelect />)}
142 185
         </Form.Item>
143 186
         <Form.Item label="房间参数">
144 187
           {getFieldDecorator('liveRoomParam', {
145 188
             initialValue: liveActivityData.liveRoomParam,
146 189
             rules: [{ required: true, message: '请输入房间参数' }],
147
-          })(<Input maxLength={1000} placeholder="点击右侧按钮查看如何获取房间参数" style={{width:'680px'}}/>)}
190
+          })(
191
+            <Input
192
+              maxLength={1000}
193
+              placeholder="点击右侧按钮查看如何获取房间参数"
194
+              style={{ width: '680px' }}
195
+            />,
196
+          )}
148 197
           <Navigate onClick={openIndexImg}>不知道怎么填?查看说明</Navigate>
149 198
         </Form.Item>
150
-        <Form.Item label="封面图1" help="建议尺寸:750px*420px,比例16:9,格式:jpg,用于:活动列表">
151
-              {getFieldDecorator('listImg', {
152
-                  initialValue: liveActivityData.listImg,
153
-                  rules: [{ required: true, message: '请上传封面图1' }],
154
-              })(
155
-                <ImageUpload />,
156
-              )}
157
-        </Form.Item>  
199
+        <Form.Item
200
+          label="封面图1"
201
+          help="建议尺寸:750px*420px,比例16:9,格式:jpg,用于:活动列表"
202
+        >
203
+          {getFieldDecorator('listImg', {
204
+            initialValue: liveActivityData.listImg,
205
+            rules: [{ required: true, message: '请上传封面图1' }],
206
+          })(<ImageUpload />)}
207
+        </Form.Item>
158 208
         <Form.Item label="封面图2" help="建议尺寸:750*250px,比例3:1,格式:jpg,用于:项目详情页">
159
-              {getFieldDecorator('detailImg', {
160
-                  initialValue: liveActivityData.detailImg,
161
-                  rules: [{ required: true, message: '请上传封面图2' }],
162
-              })(
163
-                <ImageUpload />,
164
-              )}
165
-        </Form.Item>  
209
+          {getFieldDecorator('detailImg', {
210
+            initialValue: liveActivityData.detailImg,
211
+            rules: [{ required: true, message: '请上传封面图2' }],
212
+          })(<ImageUpload />)}
213
+        </Form.Item>
166 214
         <Form.Item label="详情图" help="格式:jpg,用于:直播活动详情页,点击可跳转到直播间">
167
-              {getFieldDecorator('detailTypeImg', {
168
-                  initialValue: liveActivityData.detailTypeImg,
169
-                  rules: [{ required: true, message: '请上传详情图' }],
170
-              })(
171
-                <ImageUpload style={{width:'300px',height:'600px'}}/>,
172
-              )}
173
-        </Form.Item>      
215
+          {getFieldDecorator('detailTypeImg', {
216
+            initialValue: liveActivityData.detailTypeImg,
217
+            rules: [{ required: true, message: '请上传详情图' }],
218
+          })(<ImageUpload style={{ width: '300px', height: '600px' }} />)}
219
+        </Form.Item>
174 220
         <Form.Item label="权重">
175
-              {getFieldDecorator('weight', {
176
-                  initialValue: liveActivityData.weight,
177
-                  rules: [{ required: true, message: '请设置权重' }],
178
-              })(
179
-                <InputNumber placeholder="权重越大越靠前" style={{width:'150px'}}/>
180
-              )}
221
+          {getFieldDecorator('weight', {
222
+            initialValue: liveActivityData.weight,
223
+            rules: [{ required: true, message: '请设置权重' }],
224
+          })(<InputNumber placeholder="权重越大越靠前" style={{ width: '150px' }} />)}
181 225
         </Form.Item>
182 226
         <Form.Item label="发布状态">
183 227
           {getFieldDecorator('status', {
184
-              initialValue: liveActivityData.status == 1 ? '已发布' : '未发布',
185
-              rules: [{ required: true, message: '请选择发布状态' }],
186
-            })(<Select placeholder="发布状态" style={{ width: '300px' }}>
187
-            <Option value="0">未发布</Option>
188
-            <Option value="1">已发布</Option>
189
-          </Select>)}
228
+            initialValue: liveActivityData.status == 1 ? '已发布' : '未发布',
229
+            rules: [{ required: true, message: '请选择发布状态' }],
230
+          })(
231
+            <Select placeholder="发布状态" style={{ width: '300px' }}>
232
+              <Option value="0">未发布</Option>
233
+              <Option value="1">已发布</Option>
234
+            </Select>,
235
+          )}
190 236
         </Form.Item>
191 237
         <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
192
-          <Button type="primary" htmlType="submit"style={{marginRight:'20px'}}>
238
+          <Button type="primary" htmlType="submit" style={{ marginRight: '20px' }}>
193 239
             确定
194 240
           </Button>
195
-          <Button onClick={() => router.go(-1)}>
196
-            取消
197
-          </Button>
241
+          <Button onClick={() => router.go(-1)}>取消</Button>
198 242
         </Form.Item>
199 243
       </Form>
200 244
     </>
201
-  )
202
-}
245
+  );
246
+};
203 247
 
204 248
 const Base = Form.create({ name: 'header' })(header);
205 249
 
206
-export default Base
250
+export default Base;

+ 58
- 31
src/pages/Live/LiveActivity/Edit/index.jsx Parādīt failu

@@ -1,19 +1,34 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, notification } from 'antd';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  DatePicker,
7
+  Select,
8
+  Card,
9
+  Row,
10
+  Col,
11
+  Pagination,
12
+  Alert,
13
+  Radio,
14
+  Tag,
15
+  Tooltip,
16
+  Tabs,
17
+  notification,
18
+} from 'antd';
3 19
 import moment from 'moment';
4 20
 import request from '../../../../utils/request';
5 21
 import apis from '../../../../services/apis';
6 22
 import { router } from 'umi';
7 23
 
8
-import Base from './components/base'
9
-import Poster from './components/poster'
10
-import Share from './components/share'
11
-import ShareRecord from './components/shareRecord'
12
-import VisitRecord from './components/visitRecord'
24
+import Base from './components/base';
25
+import Poster from './components/poster';
26
+import Share from './components/share';
27
+import ShareRecord from './components/shareRecord';
28
+import VisitRecord from './components/visitRecord';
13 29
 import Prompt from 'umi/prompt';
14 30
 
15
-
16
-const { Option } = Select
31
+const { Option } = Select;
17 32
 const { TabPane } = Tabs;
18 33
 
19 34
 const formItemLayout = {
@@ -30,37 +45,53 @@ const formItemLayout = {
30 45
 function openNotificationWithIcon(type, message) {
31 46
   notification[type]({
32 47
     message,
33
-    description:
34
-      '',
48
+    description: '',
35 49
   });
36 50
 }
37 51
 
38 52
 function EditHouse(props) {
39
-  const {liveActivityId} = props.location.query;
40
-  console.log(props.location.query.id)
41
-  const [tab, setTab] = useState('base')
42
-  const [liveActivity, setLiveActivity] = useState({ liveActivityId: undefined })
43
-  const [houseId, setHouseId] = useState('')
53
+  const { liveActivityId } = props.location.query;
54
+  console.log(props.location.query.id);
55
+  const [tab, setTab] = useState('base');
56
+  const [liveActivity, setLiveActivity] = useState({ liveActivityId: undefined });
57
+  const [houseId, setHouseId] = useState('');
44 58
 
45 59
   function tabsCallback(e) {
46
-    setTab(e.target.value)
60
+    setTab(e.target.value);
47 61
   }
48 62
 
49 63
   // building 回调
50 64
   function buildingOnSuccess(e) {
51
-    setBuildingData(e)
65
+    setBuildingData(e);
52 66
   }
53 67
 
54 68
   function housTabChange(e) {
55
-    setHouseId(e.houseId)
56
-    setTab('preselectionRecord')
69
+    setHouseId(e.houseId);
70
+    setTab('preselectionRecord');
57 71
   }
58 72
 
59
-  const liveId = liveActivity.liveActivityId || (props.location.query && props.location.query.id)
60
-  console.log(liveId)
73
+  const liveId = liveActivity.liveActivityId || (props.location.query && props.location.query.id);
74
+  console.log(liveId, 'liveId');
61 75
   return (
62
-    <>
63
-      <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
76
+    <Card>
77
+      <Tabs defaultActiveKey="1">
78
+        <TabPane tab="基本信息" key="1">
79
+          <Base liveActivityId={{ liveId }} onSuccess={e => buildingOnSuccess(e)} />
80
+        </TabPane>
81
+        <TabPane tab="海报设置" key="2">
82
+          <Poster liveActivityId={{ liveId }} />
83
+        </TabPane>
84
+        <TabPane tab="分享设置" key="3">
85
+          <Share liveActivityId={{ liveId }} />
86
+        </TabPane>
87
+        <TabPane tab="分享记录" key="4">
88
+          <ShareRecord liveActivityId={{ liveId }} />
89
+        </TabPane>
90
+        <TabPane tab="分享访问记录" key="5">
91
+          <VisitRecord liveActivityId={{ liveId }} />
92
+        </TabPane>
93
+      </Tabs>
94
+      {/* <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
64 95
         <Radio.Button value="base">基本信息</Radio.Button>
65 96
         <Radio.Button value="poster">海报设置</Radio.Button>
66 97
         <Radio.Button value="share">分享设置</Radio.Button>
@@ -73,15 +104,11 @@ function EditHouse(props) {
73 104
         { (tab === 'share' && <Share liveActivityId={{ liveId }}/>)}
74 105
         { (tab === 'shareRecord' && <ShareRecord liveActivityId={{ liveId }}/>)}
75 106
         { (tab === 'visitRecord' && <VisitRecord liveActivityId={{ liveId }}/>)}
76
-      </div>
77
-      <Prompt message={location =>
78
-        location.pathname.startsWith("/activity/liveActivity")
79
-          ? true
80
-          : localStorage.removeItem("liveActivePageParams")} />
81
-    </>
82
-  )
107
+      </div> */}
108
+    </Card>
109
+  );
83 110
 }
84 111
 
85 112
 const WrappedEditHouseForm = Form.create({ name: 'editHouse' })(EditHouse);
86 113
 
87
-export default WrappedEditHouseForm
114
+export default WrappedEditHouseForm;

+ 137
- 106
src/pages/Live/LiveActivity/List/index.jsx Parādīt failu

@@ -1,13 +1,25 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Pagination, Modal, Card, notification } from 'antd';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  Icon,
7
+  Select,
8
+  message,
9
+  Table,
10
+  Pagination,
11
+  Modal,
12
+  Card,
13
+  notification,
14
+} from 'antd';
3 15
 import router from 'umi/router';
4 16
 import moment from 'moment';
5 17
 import AuthButton from '@/components/AuthButton';
6 18
 import Prompt from 'umi/prompt';
7 19
 import withActions from '@/components/ActionList';
8 20
 import EditIcon from '@/components/EditIcon';
9
-import SelectCity from '@/components/SelectButton/CitySelect'
10
-import BuildSelect from '@/components/SelectButton/BuildSelect'
21
+import SelectCity from '@/components/SelectButton/CitySelect';
22
+import BuildSelect from '@/components/SelectButton/BuildSelect';
11 23
 import apis from '@/services/apis';
12 24
 import request from '@/utils/request';
13 25
 import Navigate from '@/components/Navigate';
@@ -17,86 +29,80 @@ const { Option } = Select;
17 29
 
18 30
 const header = props => {
19 31
   // eslint-disable-next-line react-hooks/rules-of-hooks
20
-  const [data, setData] = useState({ list: [], total: 0 })
32
+  const [data, setData] = useState({ list: [], total: 0 });
21 33
   //   const [page, changePage] = useState({})
22
-  const [liveIdList, setLiveIdList] = useState([])
23
-  const [time, setTime] = useState('')
24
-  const [showHelp, setShowHelp] = useState(false)
34
+  const [liveIdList, setLiveIdList] = useState([]);
35
+  const [time, setTime] = useState('');
36
+  const [showHelp, setShowHelp] = useState(false);
25 37
 
26 38
   // 查询列表
27 39
   const getList = params => {
28 40
     request({ ...apis.taliveActivity.taLiveActivity, params: { ...params } }).then(data => {
29
-      console.log(data)
30
-      setData(data)
31
-    })
32
-  }
41
+      console.log(data);
42
+      setData(data);
43
+    });
44
+  };
33 45
 
34 46
   // eslint-disable-next-line react-hooks/rules-of-hooks
35 47
   useEffect(() => {
36
-
37
-      getList({ pageNum: 1, pageSize: 10 });
38
-    
39
-   
40
-  }, [])
48
+    getList({ pageNum: 1, pageSize: 10 });
49
+  }, []);
41 50
 
42 51
   // 跳转到编辑
43 52
   const toAddLive = rowData => () => {
44
-    if(rowData) {
53
+    if (rowData) {
45 54
       router.push({
46
-      pathname: '/Live/LiveActivity/Edit',
47
-      query: {
48
-        id: rowData.liveActivityId,
49
-        buildingId: rowData.buildingId,
50
-      },
51
-    });
52
-      return
55
+        pathname: '/Live/LiveActivity/Edit',
56
+        query: {
57
+          id: rowData.liveActivityId,
58
+          buildingId: rowData.buildingId,
59
+        },
60
+      });
61
+      return;
53 62
     }
54 63
     router.push({
55
-      pathname: '/Live/LiveActivity/Edit',
64
+      pathname: '/Live/LiveActivity/add',
56 65
     });
57
-  }
66
+  };
58 67
 
59 68
   const toDataReacord = rowData => () => {
60
-  
61
-      router.push({
69
+    router.push({
62 70
       pathname: '/activity/liveActivity/liveActivityRecord',
63 71
       query: {
64 72
         id: rowData.liveActivityId,
65 73
       },
66 74
     });
67
-  }
75
+  };
68 76
 
69 77
   function openNotificationWithIcon(type, message) {
70 78
     notification[type]({
71 79
       message,
72
-      description:
73
-        '',
80
+      description: '',
74 81
     });
75 82
   }
76 83
 
77
-  
78
-  const toDelLiveActivity = rowData => () =>{
79
-    console.log(liveIdList, 'liveIdListliveIdList')
80
-    if(liveIdList.length < 1){
81
-      openNotificationWithIcon('error', '请先选择需要删除的直播活动')
82
-      return
84
+  const toDelLiveActivity = rowData => () => {
85
+    console.log(liveIdList, 'liveIdListliveIdList');
86
+    if (liveIdList.length < 1) {
87
+      openNotificationWithIcon('error', '请先选择需要删除的直播活动');
88
+      return;
83 89
     }
84 90
     Modal.confirm({
85 91
       title: '删除后当前直播活动关联的小程序端开屏图、banner图等也会自动下架',
86 92
       okText: '确定',
87 93
       cancelText: '取消',
88
-      onOk () {
89
-        request({ ...apis.taliveActivity.deleteTaLiveActivity, data: liveIdList, }).then((data) => {
90
-          message.info("操作成功")
91
-          getList({ pageNum: 1, pageSize: 10 });
92
-        }).catch((err) => {
93
-          // message.info(err.msg)
94
-        })
94
+      onOk() {
95
+        request({ ...apis.taliveActivity.deleteTaLiveActivity, data: liveIdList })
96
+          .then(data => {
97
+            message.info('操作成功');
98
+            getList({ pageNum: 1, pageSize: 10 });
99
+          })
100
+          .catch(err => {
101
+            // message.info(err.msg)
102
+          });
95 103
       },
96 104
     });
97
-
98
-    
99
-  }
105
+  };
100 106
 
101 107
   /**
102 108
    *
@@ -110,7 +116,7 @@ const header = props => {
110 116
       dataIndex: 'liveActivityTitle',
111 117
       key: 'liveActivityTitle',
112 118
       align: 'center',
113
-      render:  (x, row) => <Navigate onClick={toAddLive(row)}>{row.liveActivityTitle}</Navigate>,
119
+      render: (x, row) => <Navigate onClick={toAddLive(row)}>{row.liveActivityTitle}</Navigate>,
114 120
     },
115 121
     {
116 122
       title: '所属城市',
@@ -129,14 +135,22 @@ const header = props => {
129 135
       dataIndex: 'liveStartDate',
130 136
       key: 'liveStartDate',
131 137
       align: 'center',
132
-      render: (x, row) => <><span>{`${moment(row.liveStartDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
138
+      render: (x, row) => (
139
+        <>
140
+          <span>{`${moment(row.liveStartDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>
141
+        </>
142
+      ),
133 143
     },
134 144
     {
135 145
       title: '直播结束时间',
136 146
       dataIndex: 'liveEndDate',
137 147
       key: 'liveEndDate',
138 148
       align: 'center',
139
-      render: (x, row) => <><span>{`${moment(row.liveEndDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
149
+      render: (x, row) => (
150
+        <>
151
+          <span>{`${moment(row.liveEndDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>
152
+        </>
153
+      ),
140 154
     },
141 155
     {
142 156
       title: '权重',
@@ -149,7 +163,11 @@ const header = props => {
149 163
       dataIndex: 'status',
150 164
       key: 'status',
151 165
       align: 'center',
152
-      render: status => <><span>{status == 0 ? '未发布' : '已发布'}</span></>,
166
+      render: status => (
167
+        <>
168
+          <span>{status == 0 ? '未发布' : '已发布'}</span>
169
+        </>
170
+      ),
153 171
     },
154 172
     {
155 173
       title: '新增人',
@@ -162,7 +180,11 @@ const header = props => {
162 180
       dataIndex: 'createDate',
163 181
       key: 'createDate',
164 182
       align: 'center',
165
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
183
+      render: (x, row) => (
184
+        <>
185
+          <span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>
186
+        </>
187
+      ),
166 188
     },
167 189
     {
168 190
       title: '修改人',
@@ -175,17 +197,21 @@ const header = props => {
175 197
       dataIndex: 'updateDate',
176 198
       key: 'updateDate',
177 199
       align: 'center',
178
-      render: (x, row) => <><span>{`${moment(row.updateDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
200
+      render: (x, row) => (
201
+        <>
202
+          <span>{`${moment(row.updateDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>
203
+        </>
204
+      ),
179 205
     },
180 206
     {
181 207
       title: '操作',
182 208
       align: 'center',
183 209
       width: 240,
184
-      render: withActions((text, record) => [    
185
-        <AuthButton name="admin.liveActivity.dataRecord" noRight={null}>
186
-          <EditIcon type="record" text="数据记录" onClick={toDataReacord(record)} />
187
-        </AuthButton>,
188
- 
210
+      render: withActions((text, record) => [
211
+        // <AuthButton name="admin.liveActivity.dataRecord" noRight={null}>
212
+        //   <EditIcon type="record" text="数据记录" onClick={toDataReacord(record)} />
213
+        // </AuthButton>,
214
+
189 215
         <AuthButton name="admin.live.detail.get" noRight={null}>
190 216
           <EditIcon type="look" text="查看详情" onClick={toAddLive(record)} />
191 217
         </AuthButton>,
@@ -199,17 +225,16 @@ const header = props => {
199 225
         dynamicId,
200 226
       },
201 227
     });
202
-  }
228
+  };
203 229
 
204 230
   const changePageNum = pageNumber => {
205
-
206
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
207
-  }
231
+    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() });
232
+  };
208 233
 
209 234
   const rowSelection = {
210 235
     onChange: (selectedRowKeys, selectedRows) => {
211 236
       console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
212
-      setLiveIdList(selectedRows)
237
+      setLiveIdList(selectedRows);
213 238
     },
214 239
   };
215 240
 
@@ -218,93 +243,99 @@ const header = props => {
218 243
     e.preventDefault();
219 244
     props.form.validateFields((err, values) => {
220 245
       if (!err) {
221
-        console.log('提交数据: ', values)
246
+        console.log('提交数据: ', values);
222 247
         if (time) {
223
-          values.time = `${moment(time).format('YYYY-MM-DDT00:00:00.000')}Z`
248
+          values.time = `${moment(time).format('YYYY-MM-DDT00:00:00.000')}Z`;
224 249
         } else {
225
-          values.time = null
250
+          values.time = null;
226 251
         }
227
-      
228
-        getList({ pageNum: 1, pageSize: 10, ...values })
252
+
253
+        getList({ pageNum: 1, pageSize: 10, ...values });
229 254
       }
230 255
     });
231
-  }
256
+  };
232 257
 
233 258
   // 重置搜索
234
-  function handleReset () {
259
+  function handleReset() {
235 260
     props.form.resetFields();
236
-    setTime('')
261
+    setTime('');
237 262
 
238
-    getList({ pageNum: 1, pageSize: 10 })
263
+    getList({ pageNum: 1, pageSize: 10 });
239 264
   }
240 265
 
241 266
   // 时间回调
242 267
   function timeOnChange(date, dateString) {
243
-    console.log(date, dateString)
244
-    setTime(date)
268
+    console.log(date, dateString);
269
+    setTime(date);
245 270
   }
246 271
 
247
-
248
-  const { getFieldDecorator } = props.form
272
+  const { getFieldDecorator } = props.form;
249 273
   return (
250
-
251 274
     <Card>
252 275
       {/* style={{ display: 'none' }} */}
253 276
       <div id="qrcode"></div>
254 277
       <Form layout="inline" onSubmit={e => handleSubmit(e)}>
255 278
         <Form.Item>
256 279
           {getFieldDecorator('liveActivityTitle')(
257
-             <Input
258
-             prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
259
-             placeholder="直播活动标题"
260
-           />,
261
-          )}
262
-        </Form.Item>
263
-        <Form.Item>
264
-          {getFieldDecorator('cityId')(
265
-            <SelectCity />,
266
-          )}
267
-        </Form.Item>
268
-        <Form.Item>
269
-          {getFieldDecorator('buildingId')(
270
-            <BuildSelect />,
280
+            <Input
281
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
282
+              placeholder="直播活动标题"
283
+            />,
271 284
           )}
272 285
         </Form.Item>
286
+        <Form.Item>{getFieldDecorator('cityId')(<SelectCity />)}</Form.Item>
287
+        <Form.Item>{getFieldDecorator('buildingId')(<BuildSelect />)}</Form.Item>
273 288
         <Form.Item>
274 289
           {getFieldDecorator('status')(
275 290
             <Select style={{ width: '180px' }} placeholder="发布状态">
276
-            <Option value="1">已发布</Option>
277
-            <Option value="0">未发布</Option>
278
-          </Select>,
291
+              <Option value="1">已发布</Option>
292
+              <Option value="0">未发布</Option>
293
+            </Select>,
279 294
           )}
280 295
         </Form.Item>
281 296
         <Form.Item>
282 297
           <AuthButton name="admin.buildingDynamic.search" noRight={null}>
283
-            <Button type="primary" htmlType="submit" >
298
+            <Button type="primary" htmlType="submit">
284 299
               搜索
285 300
             </Button>
286 301
           </AuthButton>
287 302
           <Button style={{ marginLeft: 8 }} onClick={handleReset}>
288 303
             重置
289
-            </Button>
304
+          </Button>
290 305
         </Form.Item>
291 306
       </Form>
292
-      
307
+
293 308
       <AuthButton name="admin.live.add.post" noRight={null}>
294
-        <Button type="danger" style={{margin:'20px 0'}}  onClick={toAddLive()}>新增</Button>
309
+        <Button type="danger" style={{ margin: '20px 0' }} onClick={toAddLive()}>
310
+          新增
311
+        </Button>
295 312
       </AuthButton>
296 313
       <AuthButton name="admin.live.del" noRight={null}>
297
-        <Button type="primary"  onClick={toDelLiveActivity()} style={{marginLeft:'30px'}}>删除</Button>
298
-      </AuthButton><br/>
314
+        <Button type="primary" onClick={toDelLiveActivity()} style={{ marginLeft: '30px' }}>
315
+          删除
316
+        </Button>
317
+      </AuthButton>
318
+      <br />
299 319
       <span>共筛选出{data.total}条记录</span>
300
-      <Table rowSelection={rowSelection}
301
-       dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
320
+      <Table
321
+        rowSelection={rowSelection}
322
+        dataSource={data.records}
323
+        columns={columns}
324
+        pagination={false}
325
+        rowKey="activityList"
326
+      />
302 327
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
303
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
328
+        <Pagination
329
+          showQuickJumper
330
+          defaultCurrent={1}
331
+          total={data.total}
332
+          onChange={e => changePageNum(e)}
333
+          current={data.current}
334
+        />
304 335
       </div>
305 336
     </Card>
306
-  )
307
-}
337
+  );
338
+};
308 339
 const WrappedHeader = Form.create({ name: 'header' })(header);
309 340
 
310
-export default WrappedHeader
341
+export default WrappedHeader;

+ 176
- 0
src/pages/Live/LiveActivity/add/index.jsx Parādīt failu

@@ -0,0 +1,176 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, Radio, Upload, InputNumber } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import XForm, { FieldTypes } from '../../../../components/XForm';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import styles from '../../../style/GoodsList.less';
8
+import SelectCity from '../../../../components/SelectButton/CitySelect'
9
+import BuildSelect2 from '../../../../components/SelectButton/BuildSelect2'
10
+import LivePlatSelect from '../../../../components/SelectButton/LivePlatSelect'
11
+import CitySelect3 from '../../../../components/SelectButton/CitySelect3'
12
+import ImageUpload from '../../../../components/XForm/ImageUpload'
13
+import Wangedit from '../../../../components/Wangedit/Wangedit'
14
+import Navigate from '@/components/Navigate';
15
+import apis from '../../../../services/apis';
16
+import request from '../../../../utils/request';
17
+import AuthButton from '@/components/AuthButton';
18
+import Prompt from 'umi/prompt';
19
+
20
+const { Option } = Select;
21
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22
+
23
+let cityId = ''
24
+
25
+const header = props => {
26
+  const { salesBatchId } = props.location.query
27
+  console.log(salesBatchId)
28
+  const [ saleBatchData, setSaleBatchData ] = useState({})
29
+  const [showHelp, setShowHelp] = useState(false)
30
+
31
+  const cancelPage = () =>{
32
+    router.push({
33
+      pathname: '/activity/liveActivity/list',
34
+    });
35
+  }
36
+
37
+   //打开新页面
38
+   const openIndexImg = () => {
39
+    const newWin=window.open('about:blank');
40
+    newWin.location.href="http://njcj.oss-cn-shanghai.aliyuncs.com/%E6%95%99%E7%A8%8B.png"
41
+  }
42
+
43
+  function highlightsTypeChange(e) {
44
+    console.log(e.target.value,"ee")
45
+    setTypeState(e.target.value)
46
+  }
47
+
48
+  function disabledDate(current) {
49
+    // Can not select days before today and today
50
+    return current && current < moment().endOf('day');
51
+  }
52
+
53
+  function handleSubmit (e) {
54
+    e.preventDefault();
55
+    props.form.validateFields((err, values) => {
56
+      if (!err){
57
+        let {liveTime, ...submitValue} = values
58
+        submitValue.liveStartDate = moment(submitValue.liveStartDate._d).format('YYYY-MM-DD HH:mm:ss')
59
+        submitValue.liveEndDate = moment(submitValue.liveEndDate._d).format('YYYY-MM-DD HH:mm:ss')
60
+        
61
+        if (values.liveStartDate > values.liveEndDate){
62
+          message.info("直播结束时间大于开始时间")
63
+          return;
64
+        }
65
+
66
+        request({ ...apis.taliveActivity.addTaLiveActivity, data: { ...submitValue },}).then((data) => {
67
+          message.info("保存成功")
68
+          console.log(data,"datattttttt")
69
+          router.go('-1');
70
+        }).catch((err) => {
71
+          message.info(err.msg || err.message)
72
+        })
73
+      }
74
+    });
75
+  }
76
+
77
+  const { getFieldDecorator } = props.form;
78
+
79
+  return (
80
+    <>
81
+      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
82
+        <Form.Item label="所属城市">
83
+          {getFieldDecorator('cityId', {
84
+            rules: [{ required: true, message: ' 请输入所属城市' }],
85
+          })(<CitySelect3 buildingId={props.form.getFieldValue('buildingId')}/>)}
86
+        </Form.Item>
87
+        <Form.Item label="所属楼盘">
88
+          {getFieldDecorator('buildingId')(<BuildSelect2 cityId={props.form.getFieldValue('cityId')}/>)}
89
+        </Form.Item>
90
+        <Form.Item label="直播活动标题">
91
+          {getFieldDecorator('liveActivityTitle', {
92
+            rules: [{ required: true, message: '请输入直播活动标题' }],
93
+          })(<Input maxLength={20} placeholder="给直播活动起个名字" />)}
94
+        </Form.Item>
95
+        <Form.Item label="直播开始时间">
96
+          {getFieldDecorator('liveStartDate', {
97
+                rules: [
98
+                  {
99
+                    required: true,
100
+                    message: '请选择直播开始时间',
101
+                  },
102
+                ],
103
+              })(<DatePicker placeholder="预计开始时间"style={{ width: '500px' }}format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
104
+        </Form.Item>
105
+        <Form.Item label="直播结束时间">
106
+          {getFieldDecorator('liveEndDate', {
107
+                rules: [
108
+                  {
109
+                    required: true,
110
+                    message: '请选择直播结束时间',
111
+                  },
112
+                ],
113
+              })(<DatePicker placeholder="预计结束时间" disabledDate={disabledDate} style={{ width: '500px' }}format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
114
+        </Form.Item>
115
+        <Form.Item label="直播小程序">
116
+          {getFieldDecorator('liveApp', {
117
+              rules: [{ required: true, message: '请选择直播小程序' }],
118
+            })((<LivePlatSelect />))}
119
+        </Form.Item>
120
+        <Form.Item label="房间参数">
121
+          {getFieldDecorator('liveRoomParam', {
122
+            rules: [{ required: true, message: '请输入房间参数' }],
123
+          })(<Input maxLength={1000} placeholder="点击右侧按钮查看如何获取房间参数" style={{width:'680px'}}/>)}<Navigate onClick={openIndexImg}>不知道怎么填?查看说明</Navigate>
124
+        </Form.Item>
125
+        <Form.Item label="封面图1" help="建议尺寸:750px*420px,比例16:9,格式:jpg,用于:活动列表">
126
+              {getFieldDecorator('listImg', {
127
+                  rules: [{ required: true, message: '请上传封面图1' }],
128
+              })(
129
+                <ImageUpload />,
130
+              )}
131
+        </Form.Item>  
132
+        <Form.Item label="封面图2" help="建议尺寸:750*250px,比例3:1,格式:jpg,用于:项目详情页">
133
+              {getFieldDecorator('detailImg', {
134
+                  rules: [{ required: true, message: '请上传封面图2' }],
135
+              })(
136
+                <ImageUpload />,
137
+              )}
138
+        </Form.Item>  
139
+        <Form.Item label="详情图" help="格式:jpg,用于:直播活动详情页,点击可跳转到直播间">
140
+              {getFieldDecorator('detailTypeImg', {
141
+                  rules: [{ required: true, message: '请上传详情图' }],
142
+              })(
143
+                <ImageUpload />,
144
+              )}
145
+        </Form.Item>      
146
+        <Form.Item label="权重">
147
+              {getFieldDecorator('weight', {
148
+                  rules: [{ required: true, message: '请设置权重' }],
149
+              })(
150
+                <InputNumber placeholder="权重越大越靠前" style={{width:'150px'}}/>
151
+              )}
152
+        </Form.Item>
153
+        <Form.Item label="发布状态">
154
+          {getFieldDecorator('status', {
155
+              rules: [{ required: true, message: '请选择发布状态' }],
156
+            })(<Select placeholder="发布状态" style={{ width: '300px' }}>
157
+            <Option value="0">否</Option>
158
+            <Option value="1">是</Option>
159
+          </Select>)}
160
+        </Form.Item>
161
+        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
162
+          <Button type="primary" htmlType="submit"style={{marginRight:'20px'}}>
163
+            确定
164
+          </Button>
165
+          <Button onClick={() => router.go(-1)}>
166
+            取消
167
+          </Button>
168
+        </Form.Item>
169
+      </Form>
170
+    </>
171
+  )
172
+}
173
+
174
+const WrappedHeader = Form.create({ name: 'header' })(header);
175
+
176
+export default WrappedHeader

+ 2
- 1
src/pages/Live/liveActivity copy/edit/components/shareRecord.jsx Parādīt failu

@@ -26,7 +26,8 @@ const header = (props) => {
26 26
     request({ ...apis.taliveActivity.taLiveShare, params: { ...params },}).then((data) => {
27 27
         console.log(data)
28 28
         setData(data)
29
-    })
29
+    }).catch(e=>
30
+      console.error(e))
30 31
   }
31 32
   
32 33
   const columns = [

+ 0
- 408
src/pages/activity/ActivityList.jsx Parādīt failu

@@ -1,408 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Menu, Typography, message, Table, Pagination, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import AuthButton from '@/components/AuthButton';
6
-import Prompt from 'umi/prompt';
7
-import withActions from '@/components/ActionList';
8
-import EditIcon from '@/components/EditIcon';
9
-import Navigate from '@/components/Navigate';
10
-import styles from '../style/GoodsList.less';
11
-import SelectCity from '../../components/SelectButton/CitySelect'
12
-import BuildSelect from '../../components/SelectButton/BuildSelect'
13
-import apis from '../../services/apis';
14
-import request from '../../utils/request';
15
-
16
-const { Option } = Select;
17
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
18
-
19
-const header = props => {
20
-  // eslint-disable-next-line react-hooks/rules-of-hooks
21
-  const [data, setData] = useState({ list: [], total: 0 })
22
-  //   const [page, changePage] = useState({})
23
-  const [time, setTime] = useState('')
24
-
25
-  // 查询列表
26
-  const getList = params => {
27
-    request({ ...apis.activity.list, params: { ...params } }).then(data => {
28
-      console.log(data)
29
-      setData(data)
30
-    })
31
-  }
32
-
33
-  // eslint-disable-next-line react-hooks/rules-of-hooks
34
-  useEffect(() => {
35
-
36
-    if (localStorage.getItem("activePageParams")) {
37
-
38
-      const localStorageValue = JSON.parse(localStorage.getItem("activePageParams"))
39
-      localStorageValue.time = localStorageValue.time ? moment(localStorageValue.time) : ''
40
-
41
-      props.form.setFieldsValue(localStorageValue);
42
-      getList(JSON.parse(localStorage.getItem("activePageParams")))
43
-    } else {
44
-      localStorage.setItem("activePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
45
-      getList({ pageNum: 1, pageSize: 10 });
46
-    }
47
-  }, [])
48
-
49
-  // 跳转到编辑商品
50
-  const toEditGoods = dynamicId => () => {
51
-    router.push({
52
-      pathname: '/activity/editActivity',
53
-      query: {
54
-        dynamicId,
55
-      },
56
-    });
57
-  }
58
-
59
-  const newQrcode = row => {
60
-    const x = new XMLHttpRequest();
61
-    const resourceUrl = row.qrCode
62
-    x.open('GET', resourceUrl, true);
63
-    x.responseType = 'blob';
64
-    x.onload = function (e) {
65
-      const url = window.URL.createObjectURL(x.response)
66
-      const a = document.createElement('a');
67
-      a.href = url;
68
-      a.style.display = 'none'
69
-      a.download = '活动二维码.png';
70
-      a.click();
71
-    }
72
-    x.send();
73
-  }
74
-
75
-  const getActivityDetail = (dynamicId) => () => {
76
-    router.push({
77
-      pathname: '/activity/detailActivity',
78
-      query: {
79
-        dynamicId,
80
-      },
81
-    });
82
-  }
83
-
84
-  const getJoinPeople = (dynamicId) => () => {
85
-    router.push({
86
-      pathname: '/activity/SignList',
87
-      query: {
88
-        dynamicId,
89
-      },
90
-    });
91
-  }
92
-
93
-  const toDataReacord = (id) => () => {
94
-    router.push({
95
-      pathname: '/activity/activityRecord',
96
-      query: {
97
-
98
-        id,
99
-      },
100
-    });
101
-  }
102
-
103
-  /**
104
-   *
105
-   *
106
-   * @param {*} props
107
-   * @returns
108
-   */
109
-  const columns = [
110
-    {
111
-      title: '活动标题',
112
-      dataIndex: 'title',
113
-      key: 'title',
114
-      align: 'center',
115
-      // width: '15%',
116
-      render: (x, row) => <Navigate onClick={getActivityDetail(row.dynamicId)}><Typography.Text ellipsis>{row.title}</Typography.Text></Navigate>,
117
-    },
118
-    {
119
-      title: '活动时间',
120
-      dataIndex: 'startDate',
121
-      key: 'startDate',
122
-      align: 'center',
123
-      // width: '15%',
124
-      // width: '20%',
125
-      render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>,
126
-    },
127
-    {
128
-      title: '已参与人数',
129
-      dataIndex: 'count',
130
-      key: 'count',
131
-      align: 'center',
132
-      render: (x, row) => <Navigate onClick={getJoinPeople(row.dynamicId)}>{row.count}</Navigate>,
133
-    },
134
-    // {
135
-    //   title: '阅读量',
136
-    //   dataIndex: 'pvNum',
137
-    //   key: 'pvNum',
138
-    //   align: 'center',
139
-    //   // width: '10%',
140
-    // },
141
-    // {
142
-    //   title: '转发量',
143
-    //   dataIndex: 'shareNum',
144
-    //   key: 'shareNum',
145
-    //   align: 'center',
146
-    //   // width: '10%',
147
-    // },
148
-    // {
149
-    //   title: '收藏数',
150
-    //   dataIndex: 'saveNum',
151
-    //   key: 'saveNum',
152
-    //   align: 'center',
153
-    //   // width: '10%',
154
-    // },
155
-    {
156
-      title: '报名状态',
157
-      dataIndex: 'activityStatus',
158
-      key: 'activityStatus',
159
-      align: 'center',
160
-      render: activityStatus => (activityStatus == 0 ? '进行中' : activityStatus == 1 ? '未开始' : '已结束'),
161
-    },
162
-    {
163
-      title: '权重',
164
-      dataIndex: 'heavy',
165
-      key: 'heavy',
166
-      align: 'center',
167
-    },
168
-    {
169
-      title: '操作',
170
-      dataIndex: 'handle',
171
-      key: 'handle',
172
-      align: 'center',
173
-      render: withActions((x, row) => [
174
-        <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
175
-          <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '取消发布' : '发布'} onClick={sendOrPublicDynamic.bind(this, row)} />
176
-        </AuthButton>,
177
-
178
-        <EditIcon type="look" text="查看详情" onClick={getActivityDetail(row.dynamicId)} />,
179
-
180
-        row.activityStatus === 0 ?
181
-          <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
182
-            <EditIcon type="end" text="结束活动" onClick={finishDynamic.bind(this, row)} />
183
-          </AuthButton> : null,
184
-
185
-        <AuthButton name="admin.buildingDynamic.tag" noRight={null}>
186
-          <EditIcon type={row.weight === 1 ? 'cancel' : 'add'} text={row.weight === 1 ? '取消标签' : '添加标签'} onClick={topDynamic(row)} />
187
-        </AuthButton>,
188
-
189
-        <EditIcon type={row.home === 1 ? 'cancel' : 'top'} text={row.home === 1 ? '取消推首页' : '推荐首页'} onClick={homeDynamic(row)} />,
190
-
191
-        <AuthButton name="admin.buildingDynamic.dataRecord" noRight={null}>
192
-          <EditIcon type="record" text="数据记录" onClick={toDataReacord(row.dynamicId)} />
193
-        </AuthButton>,
194
-
195
-        (row.activityStatus === 0 || row.activityStatus === 1) ?
196
-          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
197
-            <EditIcon type="edit" text="编辑" onClick={toEditGoods(row.dynamicId, row.count)} />
198
-          </AuthButton> : null,
199
-      ]),
200
-    },
201
-  ];
202
-
203
-  const getSignList = dynamicId => {
204
-    router.push({
205
-      pathname: '/activity/SignList',
206
-      query: {
207
-        dynamicId,
208
-      },
209
-    });
210
-  }
211
-
212
-  const finishDynamic = row => {
213
-    Modal.confirm({
214
-      title: '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
215
-      okText: '确定',
216
-      cancelText: '取消',
217
-      onOk() {
218
-        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } }).then(data => {
219
-          console.log(data)
220
-          message.info('操作成功!')
221
-          getList(JSON.parse(localStorage.getItem("activePageParams")))
222
-        }).catch(err => {
223
-          console.log(err)
224
-          message.info(err.msg || err.message)
225
-        })
226
-      },
227
-    });
228
-  }
229
-
230
-  //   置顶
231
-  const topDynamic = row => () => {
232
-    const weight = Math.abs(row.weight - 1)
233
-    request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } }).then(data => {
234
-      console.log(data)
235
-      message.info('操作成功!')
236
-      getList(JSON.parse(localStorage.getItem("activePageParams")))
237
-    }).catch(err => {
238
-      console.log(err)
239
-      message.info(err.msg || err.message)
240
-    })
241
-  }
242
-
243
-  //   推首页
244
-  const homeDynamic = row => () => {
245
-    const home = Math.abs(row.home - 1)
246
-    request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } }).then(data => {
247
-      console.log(data)
248
-      message.info('操作成功!')
249
-      getList(JSON.parse(localStorage.getItem("activePageParams")))
250
-    }).catch(err => {
251
-      console.log(err)
252
-      message.info(err.msg || err.message)
253
-    })
254
-  }
255
-
256
-  const sendOrPublicDynamic = row => {
257
-    if (row.status === 1) {
258
-      cancelDynamic(row)
259
-    } else {
260
-      sendDynamic(row)
261
-    }
262
-  }
263
-
264
-  // 取消活动
265
-  const cancelDynamic = row => {
266
-    Modal.confirm({
267
-      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
268
-      okText: '确认',
269
-      cancelText: '取消',
270
-      onOk() {
271
-        request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } }).then(data => {
272
-          message.info('操作成功!')
273
-          getList(JSON.parse(localStorage.getItem("activePageParams")))
274
-
275
-        }).catch(err => {
276
-          console.log(err)
277
-          message.info(err.msg || err.message)
278
-        })
279
-      }
280
-    });
281
-  }
282
-
283
-  // 发布活动
284
-  const sendDynamic = row => {
285
-    Modal.confirm({
286
-      title: '确定发布吗?',
287
-      okText: '确认',
288
-      cancelText: '取消',
289
-      onOk() {
290
-        request({ ...apis.activity.send, urlData: { id: row.dynamicId } }).then(data => {
291
-          message.info('操作成功!')
292
-          getList(JSON.parse(localStorage.getItem("activePageParams")))
293
-        }).catch(err => {
294
-          console.log(err)
295
-          message.info(err.msg || err.message)
296
-        })
297
-      }
298
-    });
299
-  }
300
-
301
-  const changePageNum = pageNumber => {
302
-    props.form.validateFields((err, values) => {
303
-      if (!err) {
304
-        localStorage.setItem("activePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...values }));
305
-        // eslint-disable-next-line react-hooks/rules-of-hooks
306
-        getList({ pageNum: pageNumber, pageSize: 10, ...values })
307
-      }
308
-    });
309
-
310
-  }
311
-
312
-  // 提交事件
313
-  const handleSubmit = e => {
314
-    e.preventDefault();
315
-    props.form.validateFields((err, values) => {
316
-      if (!err) {
317
-        console.log('提交数据: ', values)
318
-        if (time) {
319
-          values.time = `${moment(time).format('YYYY-MM-DDT00:00:00.000')}Z`
320
-        } else {
321
-          values.time = null
322
-        }
323
-        localStorage.setItem("activePageParams", (JSON.stringify({ pageNum: 1, pageSize: 10, ...values })));
324
-        getList({ pageNum: 1, pageSize: 10, ...values })
325
-      }
326
-    });
327
-  }
328
-
329
-  // 重置搜索
330
-  function handleReset() {
331
-    props.form.resetFields();
332
-    setTime('')
333
-    props.form.resetFields();
334
-    localStorage.setItem("activePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
335
-    getList({ pageNum: 1, pageSize: 10 })
336
-  }
337
-
338
-  // 时间回调
339
-  function timeOnChange(date, dateString) {
340
-    console.log(date, dateString)
341
-    setTime(date)
342
-  }
343
-
344
-
345
-  const { getFieldDecorator } = props.form
346
-  return (
347
-
348
-    <>
349
-      {/* style={{ display: 'none' }} */}
350
-      <div id="qrcode"></div>
351
-      <Form layout="inline" onSubmit={e => handleSubmit(e)}>
352
-        <Form.Item>
353
-          {getFieldDecorator('cityId')(
354
-            <SelectCity />,
355
-          )}
356
-        </Form.Item>
357
-        <Form.Item>
358
-          {getFieldDecorator('buildingId')(
359
-            <BuildSelect />,
360
-          )}
361
-        </Form.Item>
362
-        <Form.Item>
363
-          {getFieldDecorator('title')(
364
-            <Input
365
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
366
-              placeholder="请输入标题"
367
-            />,
368
-          )}
369
-        </Form.Item>
370
-        <Form.Item>
371
-          {getFieldDecorator('time')(
372
-            <DatePicker onChange={timeOnChange} />,
373
-          )}
374
-        </Form.Item>
375
-        <Form.Item>
376
-          <AuthButton name="admin.buildingDynamic.search" noRight={null}>
377
-            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
378
-              搜索
379
-            </Button>
380
-          </AuthButton>
381
-          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
382
-            重置
383
-            </Button>
384
-        </Form.Item>
385
-      </Form>
386
-      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
387
-        <Button type="danger" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
388
-      </AuthButton>
389
-      <Table
390
-        // onRow={record => {
391
-        //   return {
392
-        //     onClick: getActivityDetail(record.dynamicId),
393
-        //   };
394
-        // }}
395
-        dataSource={data.list} columns={columns} pagination={false} rowKey="dynamicId" />
396
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
397
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
398
-      </div>
399
-      <Prompt message={location =>
400
-        location.pathname.startsWith("/activity/ActivityList")
401
-          ? true
402
-          : location.pathname.startsWith("/activity/detailActivity") ? true : localStorage.removeItem("activePageParams")} />
403
-    </>
404
-  )
405
-}
406
-const WrappedHeader = Form.create({ name: 'header' })(header);
407
-// ||"/activity/detailActivity"
408
-export default WrappedHeader

src/pages/activity/detailActivity.jsx → src/pages/activity/SignupActivity/detail.jsx Parādīt failu

@@ -1,21 +1,17 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../style/GoodsList.less';
5
-import apis from '../../services/apis';
2
+import { Form, Input, Button, Icon, Select, Card, Radio, DatePicker, message, Upload } from 'antd';
3
+
4
+import apis from '@/services/apis';
6 5
 import moment from 'moment';
7 6
 import router from 'umi/router';
8
-import BuildSelect from '../../components/SelectButton/BuildSelect'
9
-import XForm, { FieldTypes } from '../../components/XForm';
10
-import Wangedit from '../../components/Wangedit/Wangedit'
11
-import request from '../../utils/request'
12
-import yinhao from '../../assets/yinhao.png'
13
-import ImageUploader from '../../components/XForm/ImageUpload';
14
-import logo from '../../assets/logo.svg';
15
-import touxiang from '../../assets/touxiang.jpg';
16
-import poster1 from '../../assets/poster1.png';
17
-import poster2 from '../../assets/poster2.png';
18
-import xiaochengxu from '../../assets/xiaochengxu.png';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect'
8
+import request from '@/utils/request'
9
+import yinhao from '@/assets/yinhao.png'
10
+import logo from '@/assets/logo.svg';
11
+import touxiang from '@/assets/touxiang.jpg';
12
+import poster1 from '@/assets/poster1.png';
13
+import poster2 from '@/assets/poster2.png';
14
+import xiaochengxu from '@/assets/xiaochengxu.png';
19 15
 import AuthButton from '@/components/AuthButton';
20 16
 import Prompt from 'umi/prompt';
21 17
 
@@ -28,9 +24,7 @@ const formItemLayout = {
28 24
 };
29 25
 
30 26
 const cancelPage = () => {
31
-  router.push({
32
-    pathname: '/activity/ActivityList',
33
-  });
27
+  router.go('-1')
34 28
 }
35 29
 
36 30
 const getSignList = dynamicId => {
@@ -401,7 +395,7 @@ const Edit = props => {
401 395
   
402 396
 
403 397
   return (
404
-    <div>
398
+    <Card>
405 399
       <div>
406 400
         <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
407 401
           <Radio.Button value="basic">基本信息</Radio.Button>
@@ -425,11 +419,7 @@ const Edit = props => {
425 419
           取消
426 420
           </Button>
427 421
       </div>
428
-      <Prompt message={location =>
429
-        location.pathname.startsWith("/activity/ActivityList")
430
-          ? true
431
-          : location.pathname.startsWith("/activity/detailActivity") ? true : localStorage.removeItem("activePageParams")} />
432
-    </div>
422
+    </Card>
433 423
   );
434 424
 }
435 425
 

+ 294
- 0
src/pages/activity/SignupActivity/edit/Basic.jsx Parādīt failu

@@ -0,0 +1,294 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, DatePicker, message } from 'antd';
3
+import router from 'umi/router';
4
+import apis from '@/services/apis';
5
+import moment from 'moment';
6
+import BuildSelect from '@/components/SelectButton/BuildSelect2';
7
+import Wangedit from '@/components/Wangedit/Wangedit';
8
+import request from '@/utils/request';
9
+import ImageUploader from '@/components/XForm/ImageUpload';
10
+
11
+const { RangePicker } = DatePicker;
12
+
13
+const formItemLayout = {
14
+  labelCol: { span: 6 },
15
+  wrapperCol: { span: 14 },
16
+};
17
+
18
+const cancelPage = () => {
19
+  router.go('-1');
20
+};
21
+
22
+const BasicForm = props => {
23
+  const [isEnlist, setIsEnlist] = useState(1);
24
+  const [activityStatus, setActivityStatus] = useState(1);
25
+  const [disable, setDisable] = useState(false);
26
+  const [data, setData] = useState(1);
27
+  const [showSignupTime, setShowSignupTime] = useState([]);
28
+
29
+  const radioOnChange = e => {
30
+    setIsEnlist(e.target.value);
31
+  };
32
+
33
+  const { dynamicId } = props;
34
+
35
+  // 查询详情
36
+  const getDynamicData = dynamicId => {
37
+    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
38
+      data.activityTime = [moment(data.startDate), moment(data.endDate)];
39
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)];
40
+      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
41
+      setData(data);
42
+      setIsEnlist(data.isEnlist);
43
+      setActivityStatus(data.activityStatus);
44
+      setDisable(data.activityStatus === 0);
45
+      props.form.setFieldsValue(data);
46
+    });
47
+  };
48
+
49
+  // eslint-disable-next-line react-hooks/rules-of-hooks
50
+  useEffect(() => {
51
+    props.form.setFieldsValue({ isEnlist });
52
+    if (dynamicId) {
53
+      getDynamicData(dynamicId);
54
+    }
55
+  }, []);
56
+  const checkTime = () => {
57
+    function compareDate(dateTime1, dateTime2) {
58
+      return new Date(dateTime1) > new Date(dateTime2);
59
+    }
60
+    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
61
+
62
+    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
63
+
64
+    // (3)修改后结束时间<当前时间:活动已结束
65
+    if (showSignupTime[0]) {
66
+      // const date = data.signupTime
67
+      const nowDate = new Date();
68
+      // console.log(compareDate(nowDate, showSignupTime[0]))
69
+      if (compareDate(nowDate, showSignupTime[0])) {
70
+        return true;
71
+      } else {
72
+        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)';
73
+      }
74
+    }
75
+    return true;
76
+  };
77
+
78
+  const handleSubmit = e => {
79
+    e.preventDefault();
80
+    props.form.validateFields((err, values) => {
81
+      if (!err) {
82
+        console.log('Received values of form: ', values);
83
+        const { activityTime, signupTime } = values;
84
+        const [startDate, endDate] = activityTime;
85
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
86
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
87
+        if (signupTime) {
88
+          const [enlistStart, enlistEnd] = signupTime;
89
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
90
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
91
+        }
92
+
93
+        console.log('submit data --->', values);
94
+        if (dynamicId) {
95
+          const checks = checkTime();
96
+          if (checks != true) {
97
+            message.info(checks);
98
+            return;
99
+          }
100
+          console.log(data.enlistNum, values.personNum, '143');
101
+
102
+          if (data.enlistNum > values.personNum) {
103
+            message.info('活动人数必须大于已报名人数');
104
+            return;
105
+          }
106
+
107
+          values.dynamicId = dynamicId;
108
+          request({ ...apis.activity.update, data: values })
109
+            .then(data => {
110
+              message.info('保存成功');
111
+              // router.go(-1)
112
+            })
113
+            .catch(err => {
114
+              message.info(err.msg || err.message);
115
+            });
116
+        } else {
117
+          request({ ...apis.activity.add, data: { ...values } })
118
+            .then(data => {
119
+              message.info('保存成功');
120
+              router.push({
121
+                pathname: '/activity/editActivity',
122
+                query: {
123
+                  dynamicId: data.dynamicId,
124
+                },
125
+              });
126
+              // router.go(-1)
127
+            })
128
+            .catch(err => {
129
+              message.info(err.msg || err.message);
130
+            });
131
+        }
132
+      }
133
+    });
134
+  };
135
+  const changeTime = (value, date) => {
136
+    // console.log(value, data, '-----checkTime---------')
137
+    // console.log(props.form.getFieldsValue(), '--------time1-----------')
138
+    // let datas = data
139
+    // console.log(value, date, datas)
140
+    // datas.signupTime = date
141
+
142
+    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
143
+
144
+    // console.log(datas,'-------datas--------')
145
+    //   props.form.setFieldsValue(data)
146
+    setShowSignupTime(date);
147
+    // props.form.setFieldsValue(datas)
148
+    // // form.setFieldsValue
149
+    // console.log('-------1--------')
150
+  };
151
+
152
+  const { getFieldDecorator } = props.form;
153
+  return (
154
+    <>
155
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
156
+        <Form.Item label="所属项目">
157
+          {getFieldDecorator('buildingId', {
158
+            rules: [
159
+              {
160
+                required: true,
161
+                message: '请选择所属项目',
162
+              },
163
+            ],
164
+          })(<BuildSelect disabled={disable} />)}
165
+        </Form.Item>
166
+        <Form.Item
167
+          label="活动封面图1"
168
+          help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表"
169
+        >
170
+          {getFieldDecorator('listImgUrl', {
171
+            rules: [
172
+              {
173
+                required: true,
174
+                message: '请选择活动封面图1',
175
+              },
176
+            ],
177
+          })(<ImageUploader />)}
178
+        </Form.Item>
179
+        <Form.Item
180
+          label="活动封面图2"
181
+          help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页"
182
+        >
183
+          {getFieldDecorator('bannerListImg', {
184
+            rules: [
185
+              {
186
+                required: true,
187
+                message: '请选择活动封面图2',
188
+              },
189
+            ],
190
+          })(<ImageUploader />)}
191
+        </Form.Item>
192
+        <Form.Item
193
+          label="活动详情主图"
194
+          help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情"
195
+        >
196
+          {getFieldDecorator('imgUrl', {
197
+            rules: [
198
+              {
199
+                required: true,
200
+                message: '请选择活动详情主图',
201
+              },
202
+            ],
203
+          })(<ImageUploader />)}
204
+        </Form.Item>
205
+        <Form.Item label="活动标题">
206
+          {getFieldDecorator('title', {
207
+            rules: [
208
+              {
209
+                required: true,
210
+                message: '请输入活动标题',
211
+              },
212
+            ],
213
+          })(<Input />)}
214
+        </Form.Item>
215
+        <Form.Item label="活动时间">
216
+          {getFieldDecorator('activityTime', {
217
+            rules: [
218
+              {
219
+                required: true,
220
+                message: '请选择活动时间',
221
+              },
222
+            ],
223
+          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
224
+        </Form.Item>
225
+        <Form.Item label="活动地点">
226
+          {getFieldDecorator('address', {
227
+            rules: [
228
+              {
229
+                required: true,
230
+                message: '请输入活动地点',
231
+              },
232
+            ],
233
+          })(<Input />)}
234
+        </Form.Item>
235
+        {/* disabled={activityStatus === 0 ? true : false} */}
236
+        <Form.Item label="活动人数" help="当前活动最多可报名人数">
237
+          {getFieldDecorator('personNum', {
238
+            rules: [
239
+              {
240
+                required: true,
241
+                message: '请输入活动人数',
242
+              },
243
+              // {
244
+              //   min: data.personNum,min={data.personNum || 0}
245
+              //   message: '活动人数必须大于已报名人数',
246
+              // },
247
+            ],
248
+          })(<Input type="number" />)}
249
+        </Form.Item>
250
+        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
251
+          {getFieldDecorator('maxEnlistByPerson', {
252
+            rules: [
253
+              {
254
+                required: true,
255
+                message: '请输入用户携带人数',
256
+              },
257
+            ],
258
+          })(<Input type="number" min={1} />)}
259
+        </Form.Item>
260
+        <Form.Item label="活动详情">{getFieldDecorator('desc')(<Wangedit />)}</Form.Item>
261
+        <Form.Item label="报名时间">
262
+          {getFieldDecorator('signupTime', {
263
+            rules: [
264
+              {
265
+                required: true,
266
+                message: '请选择报名时间',
267
+              },
268
+            ],
269
+          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
270
+        </Form.Item>
271
+        <Form.Item label="权重">
272
+          {getFieldDecorator('heavy', {
273
+            rules: [
274
+              {
275
+                required: true,
276
+                message: '请输入权重',
277
+              },
278
+            ],
279
+          })(<Input type="number" style={{ width: 80 }} />)}
280
+          <span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
281
+        </Form.Item>
282
+        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
283
+          <Button type="primary" htmlType="submit">
284
+            确认
285
+          </Button>
286
+          &nbsp;&nbsp;&nbsp;&nbsp;
287
+          <Button onClick={() => cancelPage()}>取消</Button>
288
+        </Form.Item>
289
+      </Form>
290
+    </>
291
+  );
292
+};
293
+
294
+export default Form.create({ name: 'BasicForm' })(BasicForm);

+ 255
- 0
src/pages/activity/SignupActivity/edit/Poster.jsx Parādīt failu

@@ -0,0 +1,255 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Button, message } from 'antd';
3
+import router from 'umi/router';
4
+import apis from '@/services/apis';
5
+import request from '@/utils/request';
6
+import yinhao from '@/assets/yinhao.png';
7
+import ImageUploader from '@/components/XForm/ImageUpload';
8
+import touxiang from '@/assets/touxiang.jpg';
9
+import poster1 from '@/assets/poster1.png';
10
+import xiaochengxu from '@/assets/xiaochengxu.png';
11
+
12
+const { TextArea } = Input;
13
+
14
+const cancelPage = () => {
15
+  router.go('-1');
16
+};
17
+
18
+const Poster = props => {
19
+  const { dynamicId } = props;
20
+  const [inputValue, changeInput] = useState('');
21
+  const [textAreaValue, changeTextArea] = useState('');
22
+  const [imgValue, changeImg] = useState('');
23
+  const [posterId, setPosterId] = useState('');
24
+
25
+  useEffect(() => {
26
+    if (dynamicId) {
27
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } })
28
+        .then(data => {
29
+          if (data.length > 0) {
30
+            setPosterId(data[0].posterId);
31
+            changeImg(data[0].posterImg);
32
+            changeTextArea(data[0].posterDescription);
33
+            changeInput(data[0].posterTitle);
34
+          }
35
+        })
36
+        .catch(err => {
37
+          message.info(err.msg || err.message);
38
+        });
39
+    }
40
+    // getMiniappName()
41
+  }, []);
42
+
43
+  // 获取小程序名称
44
+  // const [miniappName, setMiniappName] = useState('')
45
+  // function getMiniappName() {
46
+  //   request({ ...apis.building.getMiniappName }).then(res => {
47
+  //     console.log(res, "0000000000000")
48
+  //     setMiniappName(res)
49
+  //   })
50
+  // }
51
+
52
+  const submitPoster = () => {
53
+    if (dynamicId) {
54
+      if (posterId) {
55
+        request({
56
+          ...apis.activity.updatePoster,
57
+          urlData: { id: posterId },
58
+          data: {
59
+            targetId: dynamicId,
60
+            targetType: 'activity',
61
+            posterImg: imgValue,
62
+            posterTitle: inputValue,
63
+            posterDescription: textAreaValue,
64
+          },
65
+        })
66
+          .then(data => {
67
+            message.info('保存成功');
68
+          })
69
+          .catch(err => {
70
+            message.info(err.msg || err.message);
71
+          });
72
+      } else {
73
+        request({
74
+          ...apis.activity.addPoster,
75
+          data: {
76
+            targetId: dynamicId,
77
+            targetType: 'activity',
78
+            posterImg: imgValue,
79
+            posterTitle: inputValue,
80
+            posterDescription: textAreaValue,
81
+          },
82
+        })
83
+          .then(data => {
84
+            setPosterId(data.posterId);
85
+            message.info('保存成功');
86
+          })
87
+          .catch(err => {
88
+            message.info(err.msg || err.message);
89
+          });
90
+      }
91
+    } else {
92
+      message.warn('请先保存基本信息数据');
93
+    }
94
+  };
95
+
96
+  return (
97
+    <div>
98
+      <div style={{ display: 'flex' }}>
99
+        <div
100
+          style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}
101
+        >
102
+          <div
103
+            style={{
104
+              width: '375px',
105
+              height: '700px',
106
+              backgroundColor: '#fff',
107
+              boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)',
108
+              position: 'relative',
109
+              margin: '0 auto',
110
+            }}
111
+          >
112
+            <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
113
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
114
+              <img
115
+                style={{
116
+                  width: '70px',
117
+                  height: '70px',
118
+                  border: '4px solid #fff',
119
+                  borderRadius: '35px',
120
+                  marginLeft: '16px',
121
+                }}
122
+                src={touxiang}
123
+                alt=""
124
+              />
125
+              <span
126
+                style={{
127
+                  color: '#222',
128
+                  fontWeight: '600',
129
+                  margin: '24px 10px 0 14px',
130
+                  fontSize: '17px',
131
+                }}
132
+              >
133
+                喵喵
134
+              </span>
135
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
136
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>
137
+                2019.09.21
138
+              </span>
139
+            </div>
140
+            <p
141
+              style={{
142
+                margin: '10px 20px',
143
+                fontSize: '20px',
144
+                color: '#222',
145
+                fontWeight: '600',
146
+                display: '-webkit-box',
147
+                lineClamp: '3',
148
+                height: '60px',
149
+                WebkitLineClamp: '2',
150
+                WebkitBoxOrient: 'vertical',
151
+                overflow: 'hidden',
152
+                textOverflow: 'ellipsis',
153
+              }}
154
+            >
155
+              {inputValue || '海报标题'}
156
+            </p>
157
+
158
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
159
+            <p
160
+              style={{
161
+                margin: '16px 20px 28px 20px',
162
+                fontSize: '17px',
163
+                color: '#999',
164
+                display: '-webkit-box',
165
+                lineClamp: '3',
166
+                height: '72px',
167
+                WebkitLineClamp: '3',
168
+                WebkitBoxOrient: 'vertical',
169
+                overflow: 'hidden',
170
+                textOverflow: 'ellipsis',
171
+              }}
172
+            >
173
+              {textAreaValue || '海报描述'}
174
+            </p>
175
+            <div
176
+              style={{
177
+                backgroundColor: '#f1f1f1',
178
+                padding: '22px 30px',
179
+                boxShadow: '0px 6px 12px -4px #dcdcdc',
180
+                position: 'relative',
181
+              }}
182
+            >
183
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
184
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
185
+              <img
186
+                style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }}
187
+                src={xiaochengxu}
188
+                alt=""
189
+              />
190
+            </div>
191
+          </div>
192
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>
193
+            海报模板
194
+          </p>
195
+        </div>
196
+
197
+        <div>
198
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
199
+            <p
200
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
201
+            >
202
+              活动海报图
203
+            </p>
204
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
205
+          </div>
206
+          <p
207
+            style={{
208
+              fontSize: '0.5vw',
209
+              color: '#A9A9A9',
210
+              marginLeft: '230px',
211
+              marginBottom: '30px',
212
+            }}
213
+          >
214
+            建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报
215
+          </p>
216
+          <div
217
+            style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}
218
+          >
219
+            <p
220
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
221
+            >
222
+              海报标题
223
+            </p>
224
+            <Input
225
+              style={{ width: '20vw' }}
226
+              value={inputValue}
227
+              placeholder="请输入海报标题"
228
+              onChange={e => changeInput(e.target.value)}
229
+            />
230
+          </div>
231
+          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
232
+            <p
233
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
234
+            >
235
+              海报描述
236
+            </p>
237
+            <TextArea
238
+              rows={5}
239
+              maxLength={1024}
240
+              value={textAreaValue}
241
+              onChange={e => changeTextArea(e.target.value)}
242
+            />
243
+          </div>
244
+        </div>
245
+      </div>
246
+      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}>
247
+        {' '}
248
+        确定
249
+      </Button>
250
+      <Button onClick={() => cancelPage()}>取消</Button>
251
+    </div>
252
+  );
253
+};
254
+
255
+export default Poster;

+ 150
- 0
src/pages/activity/SignupActivity/edit/Share.jsx Parādīt failu

@@ -0,0 +1,150 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Card } from 'antd';
3
+
4
+import router from 'umi/router';
5
+import apis from '@/services/apis';
6
+import moment from 'moment';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect2';
8
+import Wangedit from '@/components/Wangedit/Wangedit';
9
+import request from '@/utils/request';
10
+import yinhao from '@/assets/yinhao.png';
11
+import ImageUploader from '@/components/XForm/ImageUpload';
12
+import logo from '@/assets/logo.png';
13
+import touxiang from '@/assets/touxiang.jpg';
14
+import poster1 from '@/assets/poster1.png';
15
+import poster2 from '@/assets/poster2.png';
16
+import xiaochengxu from '@/assets/xiaochengxu.png';
17
+
18
+const { TextArea } = Input;
19
+
20
+const cancelPage = () => {
21
+  router.go('-1');
22
+};
23
+
24
+const Share = props => {
25
+  const { dynamicId } = props;
26
+  const [inputValue, changeInput] = useState('');
27
+  const [imgValue, changeImg] = useState('');
28
+  const [shareContentId, setShareContentId] = useState('');
29
+
30
+  useEffect(() => {
31
+    if (dynamicId) {
32
+      request({
33
+        ...apis.activity.shareContent,
34
+        params: { targetId: dynamicId, targetType: 'activity' },
35
+      })
36
+        .then(data => {
37
+          if (data.length > 0) {
38
+            setShareContentId(data[0].shareContentId);
39
+            changeImg(data[0].shareContentImg);
40
+            changeInput(data[0].shareContentTitle);
41
+          }
42
+        })
43
+        .catch(err => {
44
+          message.info(err.msg || err.message);
45
+        });
46
+    }
47
+  }, [dynamicId]);
48
+
49
+  const submitShare = () => {
50
+    if (dynamicId) {
51
+      if (shareContentId) {
52
+        request({
53
+          ...apis.activity.updateShareContent,
54
+          urlData: { id: shareContentId },
55
+          data: {
56
+            targetId: dynamicId,
57
+            shareContentType: 'activity',
58
+            shareContentImg: imgValue,
59
+            shareContentTitle: inputValue,
60
+          },
61
+        })
62
+          .then(data => {
63
+            message.info('保存成功');
64
+          })
65
+          .catch(err => {
66
+            message.info(err.msg || err.message);
67
+          });
68
+      } else {
69
+        request({
70
+          ...apis.activity.addShareContent,
71
+          data: {
72
+            targetId: dynamicId,
73
+            shareContentType: 'activity',
74
+            shareContentImg: imgValue,
75
+            shareContentTitle: inputValue,
76
+          },
77
+        })
78
+          .then(data => {
79
+            setShareContentId(data.shareContentId);
80
+            message.info('保存成功');
81
+          })
82
+          .catch(err => {
83
+            message.info(err.msg || err.message);
84
+          });
85
+      }
86
+    } else {
87
+      message.warn('请先保存基本信息数据');
88
+    }
89
+  };
90
+
91
+  return (
92
+    <div style={{ padding: '20px' }}>
93
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
94
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
95
+          分享模板
96
+        </p>
97
+        <div>
98
+          <p
99
+            style={{
100
+              display: 'flex',
101
+              alignItems: 'center',
102
+              fontSize: '14px',
103
+              color: '#999',
104
+              margin: '0',
105
+              lineHeight: '0',
106
+            }}
107
+          >
108
+            <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt="" />
109
+            橙蕉互动
110
+          </p>
111
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>
112
+            {inputValue || '置业V客厅 精准获客平台'}
113
+          </p>
114
+          <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
115
+        </div>
116
+      </div>
117
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
118
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
119
+          分享标题
120
+        </p>
121
+        <Input
122
+          placeholder="请输入分享标题"
123
+          value={inputValue}
124
+          onChange={e => changeInput(e.target.value)}
125
+        />
126
+      </div>
127
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
128
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
129
+          活动分享图
130
+        </p>
131
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
132
+      </div>
133
+      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>
134
+        建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友
135
+      </p>
136
+      <Button
137
+        type="primary"
138
+        htmlType="submit"
139
+        onClick={submitShare}
140
+        style={{ margin: '40px 40px 40px 220px' }}
141
+      >
142
+        {' '}
143
+        确定
144
+      </Button>
145
+      <Button onClick={() => cancelPage()}>取消</Button>
146
+    </div>
147
+  );
148
+};
149
+
150
+export default Share;

src/pages/activity/editActivity.jsx → src/pages/activity/SignupActivity/edit/ind.jsx Parādīt failu

@@ -1,22 +1,19 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import Prompt from 'umi/prompt';
3
+
5 4
 import router from 'umi/router';
6
-import styles from '../style/GoodsList.less';
7
-import apis from '../../services/apis';
5
+import apis from '@/services/apis';
8 6
 import moment from 'moment';
9
-import BuildSelect from '../../components/SelectButton/BuildSelect2'
10
-import XForm, { FieldTypes } from '../../components/XForm';
11
-import Wangedit from '../../components/Wangedit/Wangedit'
12
-import request from '../../utils/request'
13
-import yinhao from '../../assets/yinhao.png'
14
-import ImageUploader from '../../components/XForm/ImageUpload';
15
-import logo from '../../assets/logo.svg';
16
-import touxiang from '../../assets/touxiang.jpg';
17
-import poster1 from '../../assets/poster1.png';
18
-import poster2 from '../../assets/poster2.png';
19
-import xiaochengxu from '../../assets/xiaochengxu.png'
7
+import BuildSelect from '@/components/SelectButton/BuildSelect2'
8
+import Wangedit from '@/components/Wangedit/Wangedit'
9
+import request from '@/utils/request'
10
+import yinhao from '@/assets/yinhao.png'
11
+import ImageUploader from '@/components/XForm/ImageUpload';
12
+import logo from '@/assets/logo.svg';
13
+import touxiang from '@/assets/touxiang.jpg';
14
+import poster1 from '@/assets/poster1.png';
15
+import poster2 from '@/assets/poster2.png';
16
+import xiaochengxu from '@/assets/xiaochengxu.png'
20 17
 
21 18
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22 19
 const { TextArea } = Input;
@@ -519,10 +516,7 @@ const Edit = props => {
519 516
         {tab === 'poster' && <Poster dynamicId={dynamicId}/>}
520 517
         {tab === 'share' && <Share dynamicId={dynamicId}/>}
521 518
       </div>
522
-      <Prompt message={location =>
523
-        (location.pathname.startsWith('/activity/ActivityList')
524
-          ? true
525
-          : (location.pathname.startsWith("/activity/detailActivity") ? true : localStorage.removeItem("activePageParams")))} />
519
+    
526 520
     </div>
527 521
   );
528 522
 }

+ 34
- 0
src/pages/activity/SignupActivity/edit/index.jsx Parādīt failu

@@ -0,0 +1,34 @@
1
+import React, { useState } from 'react';
2
+import { Radio, Card } from 'antd';
3
+import Basic from './Basic';
4
+import Poster from './Poster';
5
+import Share from './Share';
6
+/**
7
+ *
8
+ *
9
+ * @param {*} props
10
+ * @returns
11
+ */
12
+const Edit = props => {
13
+  const [tab, changeTab] = useState('basic');
14
+  const { dynamicId } = props.location.query;
15
+
16
+  return (
17
+    <Card>
18
+      <div>
19
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
20
+          <Radio.Button value="basic">基本信息</Radio.Button>
21
+          <Radio.Button value="poster">海报图片</Radio.Button>
22
+          <Radio.Button value="share">分享设置</Radio.Button>
23
+        </Radio.Group>
24
+      </div>
25
+      <div>
26
+        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
27
+        {tab === 'poster' && <Poster dynamicId={dynamicId} />}
28
+        {tab === 'share' && <Share dynamicId={dynamicId} />}
29
+      </div>
30
+    </Card>
31
+  );
32
+};
33
+
34
+export default Edit;

+ 331
- 0
src/pages/activity/SignupActivity/index.jsx Parādīt failu

@@ -0,0 +1,331 @@
1
+import React, { useState, useEffect, useRef } from 'react';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  Icon,
7
+  Typography,
8
+  message,
9
+  Table,
10
+  Pagination,
11
+  Modal,
12
+  DatePicker,
13
+  Card,
14
+} from 'antd';
15
+import router from 'umi/router';
16
+import moment from 'moment';
17
+import AuthButton from '@/components/AuthButton';
18
+import withActions from '@/components/ActionList';
19
+import EditIcon from '@/components/EditIcon';
20
+import Navigate from '@/components/Navigate';
21
+import SelectCity from '@/components/SelectButton/CitySelect';
22
+import BuildSelect from '@/components/SelectButton/BuildSelect';
23
+import apis from '@/services/apis';
24
+import request from '@/utils/request';
25
+import QueryTable from '@/components/QueryTable';
26
+
27
+const SignupActivity = props => {
28
+  const ref = useRef();
29
+
30
+  const searchFields = [
31
+    {
32
+      name: 'cityId',
33
+      label: '城市',
34
+      placeholder: '请选择城市',
35
+      render: () => <SelectCity style={{ width: 160 }} />,
36
+    },
37
+    {
38
+      name: 'buildingId',
39
+      label: '项目',
40
+      placeholder: '请选择项目',
41
+      render: () => <BuildSelect style={{ width: 160 }} />,
42
+    },
43
+
44
+    {
45
+      name: 'title',
46
+      label: '标题',
47
+      placeholder: '请输入标题',
48
+    },
49
+    {
50
+      name: 'time',
51
+      label: '时间',
52
+      placeholder: '请选择时间',
53
+      type: 'datepicker',
54
+    },
55
+  ];
56
+
57
+  const toSignupActivityDetail = dynamicId => () => {
58
+    router.push({
59
+      pathname: '/activity/SignupActivity/detail',
60
+      query: {
61
+        dynamicId,
62
+      },
63
+    });
64
+  };
65
+
66
+  // 跳转到编辑
67
+  const toSignupActivityEdit = dynamicId => {
68
+    router.push({
69
+      pathname: '/activity/SignupActivity/edit',
70
+      query: {
71
+        dynamicId,
72
+      },
73
+    });
74
+  };
75
+
76
+  //   置顶
77
+  const topDynamic = row => () => {
78
+    const weight = Math.abs(row.weight - 1);
79
+    request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } })
80
+      .then(data => {
81
+        message.info('操作成功!');
82
+        ref.current.reload();
83
+      })
84
+      .catch(err => {
85
+        console.log(err);
86
+        message.info(err.msg || err.message);
87
+      });
88
+  };
89
+
90
+  //   推首页
91
+  const homeDynamic = row => () => {
92
+    const home = Math.abs(row.home - 1);
93
+    request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } })
94
+      .then(data => {
95
+        message.info('操作成功!');
96
+        ref.current.reload();
97
+      })
98
+      .catch(err => {
99
+        console.log(err);
100
+        message.info(err.msg || err.message);
101
+      });
102
+  };
103
+
104
+  //结束活动
105
+  const finishDynamic = row => {
106
+    Modal.confirm({
107
+      title:
108
+        '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
109
+      okText: '确定',
110
+      cancelText: '取消',
111
+      onOk() {
112
+        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } })
113
+          .then(data => {
114
+            message.info('操作成功!');
115
+            ref.current.reload();
116
+          })
117
+          .catch(err => {
118
+            console.log(err);
119
+            message.info(err.msg || err.message);
120
+          });
121
+      },
122
+    });
123
+  };
124
+
125
+  // 发布活动
126
+  const sendDynamic = row => {
127
+    Modal.confirm({
128
+      title: '确定发布吗?',
129
+      okText: '确认',
130
+      cancelText: '取消',
131
+      onOk() {
132
+        request({ ...apis.activity.send, urlData: { id: row.dynamicId } })
133
+          .then(data => {
134
+            message.info('操作成功!');
135
+            ref.current.reload();
136
+          })
137
+          .catch(err => {
138
+            console.log(err);
139
+            message.info(err.msg || err.message);
140
+          });
141
+      },
142
+    });
143
+  };
144
+
145
+  // 取消活动
146
+  const cancelDynamic = row => {
147
+    Modal.confirm({
148
+      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
149
+      okText: '确认',
150
+      cancelText: '取消',
151
+      onOk() {
152
+        request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } })
153
+          .then(data => {
154
+            message.info('操作成功!');
155
+            ref.current.reload();
156
+          })
157
+          .catch(err => {
158
+            console.log(err);
159
+            message.info(err.msg || err.message);
160
+          });
161
+      },
162
+    });
163
+  };
164
+
165
+  //   发布or取消发布
166
+  const sendOrPublicDynamic = row => {
167
+    if (row.status === 1) {
168
+      cancelDynamic(row);
169
+    } else {
170
+      sendDynamic(row);
171
+    }
172
+  };
173
+
174
+  const getJoinPeople = dynamicId => () => {
175
+    router.push({
176
+      pathname: '/activity/SignupActivity/registrationRecord',
177
+      query: {
178
+        dynamicId,
179
+      },
180
+    });
181
+  };
182
+
183
+  const columns = [
184
+    {
185
+      title: '活动标题',
186
+      dataIndex: 'title',
187
+      key: 'title',
188
+      align: 'center',
189
+      width: '20%',
190
+      render: (x, row) => (
191
+        <Navigate onClick={toSignupActivityDetail(row.dynamicId)}>
192
+          <Typography.Text ellipsis>{row.title}</Typography.Text>
193
+        </Navigate>
194
+      ),
195
+    },
196
+    {
197
+      title: '活动时间',
198
+      dataIndex: 'startDate',
199
+      key: 'startDate',
200
+      align: 'center',
201
+      width: '15%',
202
+      // width: '20%',
203
+      render: (x, row) => (
204
+        <>
205
+          <span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format(
206
+            'YYYY-MM-DD',
207
+          )}`}</span>
208
+        </>
209
+      ),
210
+    },
211
+    {
212
+      title: '已参与人数',
213
+      dataIndex: 'count',
214
+      key: 'count',
215
+      align: 'center',
216
+      render: (x, row) => <Navigate onClick={getJoinPeople(row.dynamicId)}>{row.count}</Navigate>,
217
+    },
218
+    // {
219
+    //   title: '阅读量',
220
+    //   dataIndex: 'pvNum',
221
+    //   key: 'pvNum',
222
+    //   align: 'center',
223
+    //   // width: '10%',
224
+    // },
225
+    // {
226
+    //   title: '转发量',
227
+    //   dataIndex: 'shareNum',
228
+    //   key: 'shareNum',
229
+    //   align: 'center',
230
+    //   // width: '10%',
231
+    // },
232
+    // {
233
+    //   title: '收藏数',
234
+    //   dataIndex: 'saveNum',
235
+    //   key: 'saveNum',
236
+    //   align: 'center',
237
+    //   // width: '10%',
238
+    // },
239
+    {
240
+      title: '报名状态',
241
+      dataIndex: 'activityStatus',
242
+      key: 'activityStatus',
243
+      align: 'center',
244
+      render: activityStatus =>
245
+        activityStatus == 0 ? '进行中' : activityStatus == 1 ? '未开始' : '已结束',
246
+    },
247
+    {
248
+      title: '权重',
249
+      dataIndex: 'heavy',
250
+      key: 'heavy',
251
+      align: 'center',
252
+    },
253
+    {
254
+      title: '操作',
255
+      dataIndex: 'handle',
256
+      key: 'handle',
257
+      align: 'center',
258
+      render: withActions((x, row) => [
259
+        <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
260
+          <EditIcon
261
+            type={row.status === 1 ? 'cancel' : 'publish'}
262
+            text={row.status === 1 ? '取消发布' : '发布'}
263
+            onClick={() => sendOrPublicDynamic(row)}
264
+          />
265
+        </AuthButton>,
266
+
267
+        // //   <EditIcon type="look" text="查看详情" onClick={toSignupActivityDetail(row.dynamicId)} />,
268
+
269
+        row.activityStatus === 0 ? (
270
+          <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
271
+            <EditIcon type="end" text="结束活动" onClick={finishDynamic.bind(this, row)} />
272
+          </AuthButton>
273
+        ) : null,
274
+
275
+        <AuthButton name="admin.buildingDynamic.tag" noRight={null}>
276
+          <EditIcon
277
+            type={row.weight === 1 ? 'cancel' : 'add'}
278
+            text={row.weight === 1 ? '取消标签' : '添加标签'}
279
+            onClick={topDynamic(row)}
280
+          />
281
+        </AuthButton>,
282
+
283
+        <EditIcon
284
+          type={row.home === 1 ? 'cancel' : 'top'}
285
+          text={row.home === 1 ? '取消推首页' : '推荐首页'}
286
+          onClick={homeDynamic(row)}
287
+        />,
288
+
289
+        //   <AuthButton name="admin.buildingDynamic.dataRecord" noRight={null}>
290
+        //     <EditIcon type="record" text="数据记录" onClick={toDataReacord(row.dynamicId)} />
291
+        //   </AuthButton>,
292
+
293
+        row.activityStatus === 0 || row.activityStatus === 1 ? (
294
+          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
295
+            <EditIcon
296
+              type="edit"
297
+              text="编辑"
298
+              onClick={() => toSignupActivityEdit(row.dynamicId, row.count)}
299
+            />
300
+          </AuthButton>
301
+        ) : null,
302
+      ]),
303
+    },
304
+  ];
305
+
306
+  const actionRender = () => {
307
+    return (
308
+      <Button type="primary" icon="plus" onClick={() => toSignupActivityEdit()}>
309
+        新增
310
+      </Button>
311
+    );
312
+  };
313
+
314
+  return (
315
+    <QueryTable
316
+      ref={ref}
317
+      rowKey="dynamicId"
318
+      api={apis.activity.list}
319
+      searchFields={searchFields}
320
+      columns={columns}
321
+      postData={data => {
322
+        data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
323
+        return data;
324
+      }}
325
+      actionRender={actionRender}
326
+      // onPageChange={(pg) => setPage(pg)}
327
+    />
328
+  );
329
+};
330
+
331
+export default SignupActivity;

src/pages/activity/SignList.jsx → src/pages/activity/SignupActivity/registrationRecord.jsx Parādīt failu

@@ -1,14 +1,12 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../style/GoodsList.less';
2
+import { Form, Input, Button, Icon, Select, Table, Card } from 'antd';
3
+
5 4
 import router from 'umi/router';
6 5
 import moment from 'moment';
7
-import apis from '../../services/apis';
8
-import request from '../../utils/request'
6
+import apis from '@/services/apis';
7
+import request from '@/utils/request';
9 8
 
10 9
 const { Option } = Select;
11
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
12 10
 
13 11
 /**
14 12
  *
@@ -41,10 +39,14 @@ const columns = [
41 39
     dataIndex: 'createDate',
42 40
     key: 'createDate',
43 41
     align: 'center',
44
-    render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span></>,
42
+    render: (x, row) => (
43
+      <>
44
+        <span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span>
45
+      </>
46
+    ),
45 47
   },
46 48
   {
47
-    title: '引流人',
49
+    title: '推广人员',
48 50
     dataIndex: 'sharePersonName',
49 51
     key: 'sharePersonName',
50 52
     align: 'center',
@@ -60,77 +62,90 @@ const columns = [
60 62
     dataIndex: 'isCheckin',
61 63
     key: 'isCheckin',
62 64
     align: 'center',
63
-    render: (x, row) => <><span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span></>,
65
+    render: (x, row) => (
66
+      <>
67
+        <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
+      </>
69
+    ),
64 70
   },
65 71
 ];
66 72
 
67
-
68
-
69 73
 const header = props => {
70
-  const [data, setData] = useState({ list: {} })
74
+  const [data, setData] = useState({ list: {} });
75
+  const [loading, setLoading] = useState(false);
76
+  
71 77
   //   const [page, changePage] = useState({})
72 78
   // 存入导入数据的值
73
-  const { getFieldDecorator, getFieldsValue } = props.form
79
+  const { getFieldDecorator, getFieldsValue } = props.form;
74 80
   // eslint-disable-next-line react-hooks/rules-of-hooks
75 81
   useEffect(() => {
76 82
     // eslint-disable-next-line no-use-before-define
77 83
     getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId });
78
-  }, [])
84
+  }, []);
79 85
 
80 86
   // 查询列表
81 87
   const getSignList = params => {
82 88
     // eslint-disable-next-line no-shadow
89
+    setLoading(true)
83 90
     request({ ...apis.activity.signList, params: { ...params } }).then(data => {
84
-      console.log(data)
85
-      setData(data)
86
-    })
87
-  }
91
+     
92
+      setData(data);
93
+      setLoading(false)
94
+    });
95
+  };
88 96
 
89
-  const changePageNum = (pageNumber) => {
90
-    getSignList({ pageNum: pageNumber, pageSize: 10, dynamicId: props.location.query.dynamicId })
91
-  }
97
+  const changePageNum = pageNumber => {
98
+    getSignList({ pageNum: pageNumber, pageSize: 10, dynamicId: props.location.query.dynamicId });
99
+  };
92 100
 
93 101
   const toActivityList = () => {
94
-    router.push({
95
-      pathname: '/activity/ActivityList',
96
-    });
97
-  }
102
+    router.go('-1')
103
+  };
98 104
   // 提交事件
99 105
   // eslint-disable-next-line no-shadow
100 106
   const handleSubmit = (e, props) => {
101 107
     e.preventDefault();
102 108
     props.form.validateFields((err, values) => {
103
-      getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId, isCheckin: values.isCheckin, name: values.name, phone: values.phone })
109
+      getSignList({
110
+        pageNum: 1,
111
+        pageSize: 10,
112
+        dynamicId: props.location.query.dynamicId,
113
+        isCheckin: values.isCheckin,
114
+        name: values.name,
115
+        phone: values.phone,
116
+      });
104 117
     });
105
-  }
118
+  };
106 119
   // 重置搜索
107 120
   function handleReset() {
108 121
     props.form.resetFields();
109
-    getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId })
122
+    getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId });
110 123
   }
111 124
   // eslint-disable-next-line class-methods-use-this
112 125
   function exportHelp() {
113
-    const fieldsValue = getFieldsValue()
114
-    console.log('fieldsValue', fieldsValue)
115
-    request({ ...apis.activity.getTaActivityDynamicEnlistExport, params: { ...fieldsValue, dynamicId: props.location.query.dynamicId } })
126
+    const fieldsValue = getFieldsValue();
127
+    console.log('fieldsValue', fieldsValue);
128
+    request({
129
+      ...apis.activity.getTaActivityDynamicEnlistExport,
130
+      params: { ...fieldsValue, dynamicId: props.location.query.dynamicId },
131
+    })
116 132
       .then(data => {
117 133
         if (!data) {
118
-          return
134
+          return;
119 135
         }
120
-        const url = window.URL.createObjectURL(new Blob([data]))
121
-        const link = document.createElement('a')
122
-        link.style.display = 'none'
123
-        link.href = url
124
-        link.setAttribute('download', '报名列表.xlsx')
125
-        document.body.append(link)
126
-        link.click()
127
-      }).catch(() => {
128
-
136
+        const url = window.URL.createObjectURL(new Blob([data]));
137
+        const link = document.createElement('a');
138
+        link.style.display = 'none';
139
+        link.href = url;
140
+        link.setAttribute('download', '报名列表.xlsx');
141
+        document.body.append(link);
142
+        link.click();
129 143
       })
144
+      .catch(() => {});
130 145
   }
131 146
 
132 147
   return (
133
-    <>
148
+    <Card>
134 149
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
135 150
         <Form.Item>
136 151
           {getFieldDecorator('isCheckin')(
@@ -157,24 +172,42 @@ const header = props => {
157 172
           )}
158 173
         </Form.Item>
159 174
         <Form.Item>
160
-          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
175
+          <Button type="primary" htmlType="submit">
161 176
             搜索
162 177
           </Button>
163 178
           <Button style={{ marginLeft: 8 }} onClick={handleReset}>
164 179
             重置
165
-            </Button>
180
+          </Button>
166 181
         </Form.Item>
167
-        <Button style={{ position: 'absolute', right: '30px' }} onClick={toActivityList}>返回</Button>
182
+        <Button style={{ position: 'absolute', right: '30px' }} onClick={toActivityList}>
183
+          返回
184
+        </Button>
168 185
       </Form>
169 186
 
170
-     <div style={{textAlign:'right',margin:'6px 0 10px 0'}}> <Button name="admin.activityDynamicEnlist.export.get" noRight={null} type="primary" onClick={exportHelp}>导出</Button></div>
171
-      <Table dataSource={data.list.data} columns={columns} pagination={{ total: data.total, onChange: changePageNum }} rowKey="activity" />
187
+      <div style={{ textAlign: 'right', margin: '6px 0 10px 0' }}>
188
+        {' '}
189
+        <Button
190
+          name="admin.activityDynamicEnlist.export.get"
191
+          noRight={null}
192
+          type="primary"
193
+          onClick={exportHelp}
194
+        >
195
+          导出
196
+        </Button>
197
+      </div>
198
+      <Table
199
+        dataSource={data.list.data}
200
+        columns={columns}
201
+        pagination={{ total: data.total, onChange: changePageNum }}
202
+        loading={loading}
203
+        rowKey="activity"
204
+      />
172 205
       {/* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
173 206
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
174 207
       </div> */}
175
-    </>
176
-  )
177
-}
208
+    </Card>
209
+  );
210
+};
178 211
 const WrappedHeader = Form.create({ name: 'header' })(header);
179 212
 
180
-export default WrappedHeader
213
+export default WrappedHeader;

+ 0
- 16
src/pages/activity/activityRecord.jsx Parādīt failu

@@ -1,16 +0,0 @@
1
-import React from 'react';
2
-import DataRecord from './dataRecord/index'
3
-import Prompt from 'umi/prompt';
4
-
5
-const header = props =>{
6
-    const id = props.location.query.id
7
-    // type:'activity',
8
-    return <><DataRecord id = {id} activeType = "activity"/>
9
-    <Prompt message={location =>
10
-        location.pathname.startsWith("/activity/ActivityList")
11
-          ? true
12
-          : location.pathname.startsWith("/activity/detailActivity") ? true : localStorage.removeItem("activePageParams")} />
13
-          </>
14
-}
15
-
16
-export default header

+ 0
- 122
src/pages/activity/dataRecord/index.jsx Parādīt failu

@@ -1,122 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Input, Menu, Dropdown, Button, Icon, Modal, message, Table, Divider, Tabs, Tag, Select, Pagination } from 'antd';
3
-import router from 'umi/router';
4
-import apis from '../../../services/apis';
5
-import request from '../../../utils/request';
6
-import Visitors from './table/visitors'
7
-import VisitNum from './table/visitNum'
8
-import Newuser from './table/newuser'
9
-import Shares from './table/shares'
10
-import ShareNum from './table/shareNum'
11
-import moment from 'moment';
12
-
13
-const { TabPane } = Tabs;
14
-
15
-
16
-
17
-const DataRecord = props => {
18
-
19
-    const [tab, setTab] = useState('1')
20
-    const [data, setData] = useState({})
21
-
22
-    const id = props.id
23
-    const type = props.activeType
24
-
25
-
26
-    useEffect(() => {
27
-
28
-        getData({ id: id, type: type })
29
-
30
-    }, [])
31
-
32
-    const getData = (params) => {
33
-
34
-        request({ ...apis.activityDataStatis.getStatisticData, params: { ...params, } }).then((data) => {
35
-            console.log(data)
36
-            setData(data || {})
37
-        })
38
-    }
39
-
40
-    function tabsCallback(e) {
41
-
42
-        setTab(e)
43
-    }
44
-
45
-    return <>
46
-        <div>
47
-            <div>
48
-                <span>{data.activityName || '0'}</span>
49
-                <Button style={{ float: 'right', zIndex: 1 }} onClick={() => router.go(-1)}>
50
-                    返回
51
-               </Button>
52
-            </div>
53
-            <div>
54
-
55
-                <div style={{ display: 'flex', marginBottom: '33px', marginTop: '20px' }}>
56
-                    <div style={{
57
-                        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(241,43,62,1) 0%,rgba(254,144,155,1) 100%)', height: '100px',
58
-                        borderRadius: '12px', width: '32%', marginRight: '15px'
59
-                    }}>
60
-                        <span style={{ fontSize: '20px', color: '#fff' }}>访问总人数 </span>
61
-                        <span style={{ fontSize: '46px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>{data.visitPersons || '0'}</span>
62
-                    </div>
63
-                    <div style={{
64
-                        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(255,126,74,1) 0%,rgba(255,196,168,1) 100%)', height: '100px',
65
-                        borderRadius: '12px', width: '32%', marginRight: '15px'
66
-                    }}>
67
-                        <span style={{ fontSize: '20px', color: '#fff' }}>访问总次数 </span>
68
-                        <span style={{ fontSize: '46px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>{data.visitNum || '0'}</span>
69
-                    </div>
70
-                    <div style={{
71
-                        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(137deg,rgba(107,130,230,1) 0%,rgba(152,175,251,1) 100%)', height: '100px',
72
-                        borderRadius: '12px', width: '32%', marginRight: '15px'
73
-                    }}>
74
-                        <span style={{ fontSize: '20px', color: '#fff' }}>新增注册用户 </span>
75
-                        <span style={{ fontSize: '46px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>{data.newPersons || '0'}</span>
76
-                    </div>
77
-                    <div style={{
78
-                        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(137deg,rgba(150,83,215,1) 0%,rgba(208,160,255,1) 100%)', height: '100px',
79
-                        borderRadius: '12px', width: '32%', marginRight: '15px'
80
-                    }}>
81
-                        <span style={{ fontSize: '20px', color: '#fff' }}>分享总人数 </span>
82
-                        <span style={{ fontSize: '46px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>{data.sharePersons || '0'}</span>
83
-                    </div>
84
-                    <div style={{
85
-                        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(0,175,141,1) 0%,rgba(115,231,209,1) 100%)', height: '100px',
86
-                        borderRadius: '12px', width: '32%'
87
-                    }}>
88
-                        <span style={{ fontSize: '20px', color: '#fff' }}>分享总次数 </span>
89
-                        <span style={{ fontSize: '46px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>{data.shareNum || '0'}</span>
90
-                    </div>
91
-                </div>
92
-            </div>
93
-
94
-        </div>
95
-        <div>
96
-            <Tabs type="card" value={tab} buttonStyle="solid" onChange={e => tabsCallback(e)}>
97
-                <TabPane tab="访问人数" key="1" ></TabPane>
98
-                <TabPane tab="访问次数" key="2" ></TabPane>
99
-                <TabPane tab="新增注册用户" key="3" ></TabPane>
100
-                <TabPane tab="分享人数" key="4" ></TabPane>
101
-                <TabPane tab="分享次数" key="5" ></TabPane>
102
-            </Tabs>
103
-            <div style={{ marginTop: '20px' }}>
104
-                {/* 访问人数 */}
105
-                {(tab === '1' && < Visitors id={id} type={type} getData={() => getData({ id: id, type: type })} />)}
106
-                {/* 访问次数 */}
107
-                {(tab === '2' && <VisitNum id={id} type={type} getData={() => getData({ id: id, type: type })} />)}
108
-                {/* 新增注册用户 */}
109
-                {(tab === '3' && <Newuser id={id} type={type} getData={() => getData({ id: id, type: type })} />)}
110
-                {/* 分享人数 */}
111
-                {(tab === '4' && <Shares id={id} type={type} getData={() => getData({ id: id, type: type })} />)}
112
-                {/* 分享次数 */}
113
-                {(tab === '5' && <ShareNum id={id} type={type} getData={() => getData({ id: id, type: type })} />)}
114
-
115
-                {/* { (tab === 'desc' && <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft:'30px'}} />)} */}
116
-
117
-            </div>
118
-        </div>
119
-    </>
120
-}
121
-
122
-export default DataRecord

+ 0
- 170
src/pages/activity/dataRecord/table/newuser.jsx Parādīt failu

@@ -1,170 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import apis from '../../../../services/apis';
5
-import request from '../../../../utils/request';
6
-import AuthButton from '../../../../components/AuthButton';
7
-import WxDictSelect from '@/components/SelectButton/WxDictSelect';
8
-import moment from 'moment';
9
-
10
-const date = {
11
-  startDate: moment().year(1000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z',
12
-  endDate: moment().year(3000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z'
13
-}
14
-
15
-const header = props => {
16
-  const [showHelp, setShowHelp] = useState(false)
17
-  const [data, setData] = useState({})
18
-  const activityId = props.id
19
-  const activityType = props.type
20
-
21
-  useEffect(() => {
22
-    console.log(activityId, activityType)
23
-    getList({ pageNum: 1, pageSize: 10 })
24
-
25
-  }, [])
26
-
27
-  const getList = params => {
28
-    console.log(params)
29
-    request({ ...apis.activityDataStatis.activityAddRegist, params: { ...params, activityId: activityId, activityType: activityType, ...date } }).then(data => {
30
-      console.log(data)
31
-      props.getData()
32
-      setData(data)
33
-    }).catch(e => {
34
-      console.log(e)
35
-    })
36
-  }
37
-
38
-  const columns = [
39
-    {
40
-      title: '姓名',
41
-      dataIndex: 'nickName',
42
-      key: 'nickName',
43
-    },
44
-    {
45
-      title: '电话',
46
-      dataIndex: 'phone',
47
-      key: 'phone',
48
-    },
49
-    {
50
-      title: '性别',
51
-      dataIndex: 'gender',
52
-      key: 'gender',
53
-    },
54
-    {
55
-      title: '归属地',
56
-      dataIndex: 'province',
57
-      key: 'province',
58
-    },
59
-    {
60
-      title: '来源渠道',
61
-      dataIndex: 'personFrom',
62
-      key: 'personFrom',
63
-    },
64
-    {
65
-      title: '置业顾问',
66
-      dataIndex: 'realtyConsultant',
67
-      key: 'realtyConsultant',
68
-    },
69
-    {
70
-      title: '置业顾问电话',
71
-      dataIndex: 'realtyConsultantPhone',
72
-      key: 'realtyConsultantPhone',
73
-    },
74
-    {
75
-      title: '分享者',
76
-      dataIndex: 'sharePersonName',
77
-      key: 'sharePersonName',
78
-    },
79
-    {
80
-      title: '分享者电话',
81
-      dataIndex: 'sharePersonPhone',
82
-      key: 'sharePersonPhone',
83
-    },
84
-  ]
85
-
86
-  function handleReset() {
87
-    props.form.resetFields();
88
-    getList({ pageNum: 1, pageSize: 10 })
89
-  }
90
-
91
-  const changePageNum = pageNumber => {
92
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
93
-  }
94
-
95
-  const handleSubmit = e => {
96
-    e.preventDefault();
97
-    props.form.validateFields((err, values) => {
98
-      if (!err) {
99
-        console.log('提交数据: ', values)
100
-
101
-        getList({ pageNum: 1, pageSize: 10, ...values })
102
-      }
103
-    });
104
-  }
105
-
106
-  const exportActivityStats = () => {
107
-
108
-    request({ ...apis.activityDataStatis.activityAddRegistNumExport, params: { activityId: activityId, activityType: activityType, ...props.form.getFieldsValue(), ...date } }).then(data => {
109
-      if (!data) {
110
-        return
111
-      }
112
-      const url = window.URL.createObjectURL(new Blob([data]))
113
-      const link = document.createElement('a')
114
-      link.style.display = 'none'
115
-      link.href = url
116
-      link.setAttribute('download', '访问统计.xlsx')
117
-      document.body.append(link)
118
-      link.click()
119
-    }).catch()
120
-  }
121
-
122
-  const { getFieldDecorator } = props.form
123
-  return <>
124
-    <div>
125
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ display: 'flex', alignItems: 'center' }}>
126
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
127
-          {getFieldDecorator('personFrom')(
128
-            <WxDictSelect />,
129
-          )}
130
-        </Form.Item>
131
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
132
-          {getFieldDecorator('province')(<Input placeholder="请输入归属地" />)}
133
-        </Form.Item>
134
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
135
-          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}> 搜索</Button>
136
-          <Button onClick={handleReset} style={{ marginLeft: '30px' }}>重置</Button>
137
-          <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
138
-          <Modal
139
-            title="指标说明(数据会存在一定时间延迟)"
140
-            centered
141
-            visible={showHelp}
142
-            footer={null}
143
-            onCancel={() => setShowHelp(false)}
144
-          >
145
-            <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享人数:</p>
146
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>分享小程序活动的总人数</p>
147
-            <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享次数:</p>
148
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>触发小程序活动分享的总次数</p>
149
-            <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>新增注册用户:</p>
150
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前活动授权手机号的总人数</p>
151
-            <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问人数:</p>
152
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总人数</p>
153
-            <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问次数:</p>
154
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总次数</p>
155
-          </Modal>
156
-        </Form.Item>
157
-      </Form>
158
-      <div>
159
-        <Button type="primary" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={exportActivityStats}>导出</Button>
160
-      </div>
161
-      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
162
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
163
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
164
-      </div>
165
-    </div>
166
-  </>
167
-}
168
-
169
-const WrappedTypeForm = Form.create()(header);
170
-export default WrappedTypeForm

+ 0
- 170
src/pages/activity/dataRecord/table/shareNum.jsx Parādīt failu

@@ -1,170 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import apis from '../../../../services/apis';
5
-import request from '../../../../utils/request';
6
-import AuthButton from '../../../../components/AuthButton';
7
-import WxDictSelect from '@/components/SelectButton/WxDictSelect';
8
-import moment from 'moment';
9
-
10
-
11
-const date = {
12
-  startDate: moment().year(1000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z',
13
-  endDate: moment().year(3000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z'
14
-}
15
-
16
-const header = props => {
17
-
18
-  const [data, setData] = useState({})
19
-  const [showHelp, setShowHelp] = useState(false)
20
-  const activityId = props.id
21
-  const activityType = props.type
22
-
23
-  useEffect(() => {
24
-    console.log(activityId, activityType)
25
-    getList({ pageNum: 1, pageSize: 10 })
26
-
27
-  }, [])
28
-
29
-  const getList = params => {
30
-    console.log(params)
31
-    request({ ...apis.activityDataStatis.activityShareNum, params: { ...params, activityId: activityId, activityType: activityType, ...date } }).then(data => {
32
-      console.log(data)
33
-      props.getData()
34
-      setData(data)
35
-    }).catch(e => {
36
-      console.log(e)
37
-    })
38
-  }
39
-
40
-  const columns = [
41
-    {
42
-      title: '分享者姓名',
43
-      dataIndex: 'sharePersonName',
44
-      key: 'sharePersonName',
45
-    },
46
-    {
47
-      title: '分享者类型',
48
-      dataIndex: 'shareType',
49
-      key: 'shareType',
50
-      render: (text, records) => {
51
-        if (records.sharePersonType === 'drift') { return '游客' }
52
-        if (records.sharePersonType === 'customer') { return '普通客户' }
53
-        if (records.sharePersonType === 'Realty Consultant') { return '置业顾问' }
54
-        if (records.sharePersonType === 'estate agent') { return '专业经纪人' }
55
-      },
56
-    },
57
-    {
58
-      title: '分享时间',
59
-      dataIndex: 'shareTime',
60
-      key: 'shareTime',
61
-      render: (x, row) => <><span>{`${moment(row.shareTime).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
62
-    },
63
-    {
64
-      title: '分享者电话',
65
-      dataIndex: 'sharePersonPhone',
66
-      key: 'sharePersonPhone',
67
-    },
68
-    // {
69
-    //   title: '访问人数',
70
-    //   dataIndex: 'visitPersonNum',
71
-    //   key: 'visitPersonNum',
72
-    // },
73
-  ]
74
-
75
-  function handleReset() {
76
-    props.form.resetFields();
77
-    getList({ pageNum: 1, pageSize: 10 })
78
-  }
79
-
80
-  const changePageNum = pageNumber => {
81
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
82
-  }
83
-
84
-  const handleSubmit = e => {
85
-    e.preventDefault();
86
-    props.form.validateFields((err, values) => {
87
-      if (!err) {
88
-
89
-        getList({ pageNum: 1, pageSize: 10, ...values })
90
-      }
91
-    });
92
-  }
93
-
94
-
95
-
96
-  const exportActivityStats = () => {
97
-
98
-    request({ ...apis.activityDataStatis.activityShareNumExport, params: { activityId: activityId, activityType: activityType, ...props.form.getFieldsValue(), ...date } }).then(data => {
99
-      if (!data) {
100
-        return
101
-      }
102
-      const url = window.URL.createObjectURL(new Blob([data]))
103
-      const link = document.createElement('a')
104
-      link.style.display = 'none'
105
-      link.href = url
106
-      link.setAttribute('download', '访问统计.xlsx')
107
-      document.body.append(link)
108
-      link.click()
109
-    }).catch()
110
-  }
111
-
112
-
113
-  const { getFieldDecorator } = props.form
114
-  return <>
115
-    <div>
116
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ display: 'flex', alignItems: 'center' }}>
117
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
118
-          {getFieldDecorator('sharePersonType')(
119
-            <Select placeholder="分享者类型" style={{ width: 150, marginLeft: '20px' }}>
120
-              <Option value="">全部</Option>
121
-              <Option value="drift">游客</Option>
122
-              <Option value="customer">普通客户</Option>
123
-              <Option value="Realty Consultant">置业顾问</Option>
124
-              <Option value="estate agent">专业经纪人</Option>
125
-            </Select>
126
-          )}
127
-        </Form.Item>
128
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
129
-          {getFieldDecorator('sharePersonPhone')(<Input placeholder="分享者电话" />)}
130
-        </Form.Item>
131
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
132
-          {getFieldDecorator('sharePersonName')(<Input placeholder="分享者姓名" />)}
133
-        </Form.Item>
134
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
135
-          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}> 搜索</Button>
136
-          <Button onClick={handleReset} style={{ marginLeft: '30px' }}>重置</Button>
137
-        </Form.Item>
138
-        <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
139
-        <Modal
140
-          title="指标说明(数据会存在一定时间延迟)"
141
-          centered
142
-          visible={showHelp}
143
-          footer={null}
144
-          onCancel={() => setShowHelp(false)}
145
-        >
146
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享人数:</p>
147
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>分享小程序活动的总人数</p>
148
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享次数:</p>
149
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>触发小程序活动分享的总次数</p>
150
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>新增注册用户:</p>
151
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前活动授权手机号的总人数</p>
152
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问人数:</p>
153
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总人数</p>
154
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问次数:</p>
155
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总次数</p>
156
-        </Modal>
157
-      </Form>
158
-      <div>
159
-        <Button type="primary" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={exportActivityStats}>导出</Button>
160
-      </div>
161
-      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
162
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
163
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
164
-      </div>
165
-    </div>
166
-  </>
167
-}
168
-
169
-const WrappedTypeForm = Form.create()(header);
170
-export default WrappedTypeForm

+ 0
- 205
src/pages/activity/dataRecord/table/shares.jsx Parādīt failu

@@ -1,205 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import apis from '../../../../services/apis';
5
-import request from '../../../../utils/request';
6
-import AuthButton from '../../../../components/AuthButton';
7
-import WxDictSelect from '@/components/SelectButton/WxDictSelect';
8
-import moment from 'moment';
9
-
10
-const date = {
11
-  startDate: moment().year(1000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss')+'.000Z',
12
-  endDate: moment().year(3000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss')+'.000Z'
13
-}
14
-
15
-const header = props => {
16
-
17
-  const [data, setData] = useState({})
18
-  const [sort, setSort] = useState({})
19
-  const [showHelp, setShowHelp] = useState(false)
20
-  const activityId = props.id
21
-  const activityType = props.type
22
-
23
-  useEffect(() => {
24
-    console.log(activityId, activityType)
25
-    getList({pageNum: 1, pageSize: 10 })
26
-
27
-  }, [])
28
-
29
-  const getList = params => {
30
-    console.log(params)
31
-    request({ ...apis.activityDataStatis.activitySharePersonNum, params: { ...params, activityId: activityId, activityType: activityType, ...date } }).then(data => {
32
-      console.log(data)
33
-      props.getData()
34
-      setData(data)
35
-    }).catch(e => {
36
-      console.log(e)
37
-    })
38
-  }
39
-
40
-  const columns = [
41
-    {
42
-      title: '分享者姓名',
43
-      dataIndex: 'sharePersonName',
44
-      key: 'sharePersonName',
45
-    },
46
-    {
47
-      title: '分享者类型',
48
-      dataIndex: 'sharePersonType',
49
-      key: 'sharePersonType',
50
-      render: (text, records) => {
51
-        if (records.sharePersonType === 'drift') { return '游客' }
52
-        if (records.sharePersonType === 'customer') { return '普通客户' }
53
-        if (records.sharePersonType === 'Realty Consultant') { return '置业顾问' }
54
-        if (records.sharePersonType === 'estate agent') { return '专业经纪人' }
55
-      //   ESTATE_AGENT']:
56
-      //   return [{ isAgent: true }, '普通用户']
57
-      // case ROLE_CODE['CHANNEL_AGENT
58
-      },
59
-    },
60
-    {
61
-      title: '分享者电话',
62
-      dataIndex: 'sharePersonPhone',
63
-      key: 'sharePersonPhone',
64
-    },
65
-    {
66
-      title: '分享次数',
67
-      dataIndex: 'shareNum',
68
-      key: 'shareNum',
69
-      sorter: true,
70
-      // render: (text, record) => (
71
-      //   <a style={{ color: '#66B3FF' }} onClick={toShareNum(record)}><span>{record.shareNum}</span></a>
72
-      // ),
73
-    },
74
-    {
75
-      title: '访问人数',
76
-      dataIndex: 'visitPersonNum',
77
-      key: 'visitPersonNum',
78
-      sorter: true,
79
-      // render: (text, record) => (
80
-      //   <a style={{ color: '#66B3FF' }} onClick={toVisitPersonNum(record)}><span>{record.visitPersonNum}</span></a>
81
-      // ),
82
-    },
83
-    {
84
-      title: '访问次数',
85
-      dataIndex: 'visitNum',
86
-      key: 'visitNum',
87
-      sorter: true,
88
-      // render: (text, record) => (
89
-      //   <a style={{ color: '#66B3FF' }} onClick={toVisitNum(record)}><span>{record.visitNum}</span></a>
90
-      // ),
91
-    },
92
-  ]
93
-
94
-  const handleTableChange = (pagination, filters, sorter) => {
95
-    console.log(pagination, filters, sorter)
96
-    setSort({
97
-      sort: sorter.order,
98
-      colKey: sorter.columnKey,
99
-    })
100
-    const query = {
101
-      pageNum: pagination.current,
102
-        pageSize: pagination.pageSize,
103
-        sort: sorter.order,
104
-        colKey: sorter.columnKey,
105
-        ...props.form.getFieldsValue()
106
-    }
107
-    getList(query)
108
-  };
109
-
110
-  function handleReset() {
111
-    props.form.resetFields();
112
-    getList({ pageNum: 1, pageSize: 10 })
113
-  }
114
-
115
-  const changePageNum = pageNumber => {
116
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue(),...sort })
117
-  }
118
-
119
-  const handleSubmit = e => {
120
-    e.preventDefault();
121
-    props.form.validateFields((err, values) => {
122
-      if (!err) {
123
-        console.log('提交数据: ', values)
124
-       
125
-        getList({ pageNum: 1, pageSize: 10, ...values })
126
-      }
127
-    });
128
-  }
129
-
130
-  const exportActivityStats = () => {
131
-    
132
-    request({ ...apis.activityDataStatis.activitySharePersonNumExport, params: {activityId: activityId, activityType: activityType,...props.form.getFieldsValue(),...date} }).then(data => {
133
-      if (!data) {
134
-        return
135
-      }
136
-      const url = window.URL.createObjectURL(new Blob([data]))
137
-        const link = document.createElement('a')
138
-        link.style.display = 'none'
139
-        link.href = url
140
-        link.setAttribute('download', '访问统计.xlsx')
141
-        document.body.append(link)
142
-        link.click()
143
-    }).catch()
144
-  }
145
-
146
-
147
-  const { getFieldDecorator } = props.form
148
-  return <>
149
-    <div>
150
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ display: 'flex', alignItems: 'center' }}>
151
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
152
-          {getFieldDecorator('sharePersonType')(
153
-            <Select placeholder="分享者类型" style={{ width: 150, marginLeft: '20px' }}>
154
-              <Option value="">全部</Option>
155
-              <Option value="drift">游客</Option>
156
-              <Option value="customer">普通客户</Option>
157
-              <Option value="Realty Consultant">置业顾问</Option>
158
-              <Option value="estate agent">专业经纪人</Option>
159
-              
160
-            </Select>
161
-          )}
162
-        </Form.Item>
163
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
164
-          {getFieldDecorator('sharePersonPhone')(<Input placeholder="分享者电话" />)}
165
-        </Form.Item>
166
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
167
-          {getFieldDecorator('sharePersonName')(<Input placeholder="分享者姓名" />)}
168
-        </Form.Item>
169
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
170
-          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}> 搜索</Button>
171
-          <Button onClick={handleReset} style={{ marginLeft: '30px' }}>重置</Button>
172
-        </Form.Item>
173
-        <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
174
-        <Modal
175
-          title="指标说明(数据会存在一定时间延迟)"
176
-          centered
177
-          visible={showHelp}
178
-          footer={null}
179
-          onCancel={() => setShowHelp(false)}
180
-        >
181
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享人数:</p>
182
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>分享小程序活动的总人数</p>
183
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享次数:</p>
184
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>触发小程序活动分享的总次数</p>
185
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>新增注册用户:</p>
186
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前活动授权手机号的总人数</p>
187
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问人数:</p>
188
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总人数</p>
189
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问次数:</p>
190
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总次数</p>
191
-        </Modal>
192
-      </Form>
193
-      <div>
194
-        <Button type="primary" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={exportActivityStats} >导出</Button>
195
-      </div>
196
-      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} onChange={handleTableChange} rowKey="activityList" />
197
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
198
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum}  current={data.current} />
199
-      </div>
200
-    </div>
201
-  </>
202
-}
203
-
204
-const WrappedTypeForm = Form.create()(header);
205
-export default WrappedTypeForm

+ 0
- 195
src/pages/activity/dataRecord/table/visitNum.jsx Parādīt failu

@@ -1,195 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import apis from '../../../../services/apis';
5
-import request from '../../../../utils/request';
6
-import AuthButton from '../../../../components/AuthButton';
7
-import WxDictSelect from '@/components/SelectButton/WxDictSelect';
8
-import moment from 'moment';
9
-
10
-const date = {
11
-  startDate: moment().year(1000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss')+'.000Z',
12
-  endDate: moment().year(3000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss')+'.000Z'
13
-}
14
-
15
-const header = props => {
16
-  const [showHelp, setShowHelp] = useState(false)
17
-  const [data, setData] = useState({})
18
-  const activityId = props.id
19
-  const activityType = props.type
20
-
21
-  useEffect(() => {
22
-    console.log(activityId, activityType)
23
-    getList({ pageNum: 1, pageSize: 10 })
24
-
25
-  }, [])
26
-
27
-  const getList = params => {
28
-    console.log(params)
29
-    request({ ...apis.activityDataStatis.activityVisitNum, params: { ...params, activityId: activityId, activityType: activityType, ...date } }).then(data => {
30
-      console.log(data)
31
-      props.getData()
32
-      setData(data)
33
-    }).catch(e => {
34
-      console.log(e)
35
-    })
36
-  }
37
-
38
-  const format = data =>{    
39
-  return <div dangerouslySetInnerHTML={{__html:data.replace(/,/g,",<br/>")}}>{}</div>
40
-  }
41
-
42
-  let columns = [
43
-    {
44
-      title: '姓名',
45
-      dataIndex: 'nickName',
46
-      key: 'nickName',
47
-    },
48
-    {
49
-      title: '电话',
50
-      dataIndex: 'phone',
51
-      key: 'phone',
52
-    },
53
-    {
54
-      title: '性别',
55
-      dataIndex: 'gender',
56
-      key: 'gender',
57
-    },
58
-    {
59
-      title: '归属地',
60
-      dataIndex: 'province',
61
-      key: 'province',
62
-    },
63
-    {
64
-      title: '来源渠道',
65
-      dataIndex: 'personFrom',
66
-      key: 'personFrom',
67
-    },
68
-    {
69
-      title: '置业顾问',
70
-      dataIndex: 'realtyConsultant',
71
-      key: 'realtyConsultant',
72
-      render: (x, row) => <>{row.realtyConsultant?format(row.realtyConsultant):''}</>,
73
-      width:180
74
-    },
75
-    {
76
-      title: '置业顾问电话',
77
-      dataIndex: 'realtyConsultantPhone',
78
-      key: 'realtyConsultantPhone',
79
-      render: (x, row) => <>{row.realtyConsultantPhone?format(row.realtyConsultantPhone):''}</>,
80
-      width:180
81
-    },
82
-    {
83
-      title: '分享者',
84
-      dataIndex: 'sharePersonName',
85
-      key: 'sharePersonName',
86
-    },
87
-    {
88
-      title: '分享者电话',
89
-      dataIndex: 'sharePersonPhone',
90
-      key: 'sharePersonPhone',
91
-    },
92
-    {
93
-      title: '访问时间',
94
-      dataIndex: 'visitDate',
95
-      key: 'visitDate',
96
-      render: (x, row) => <><span>{`${moment(row.visitDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
97
-    },
98
-  ]
99
-
100
-  function handleReset() {
101
-    props.form.resetFields();
102
-    getList({ pageNum: 1, pageSize: 10 })
103
-  }
104
-
105
-  const changePageNum = pageNumber => {
106
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
107
-  }
108
-
109
-  const handleSubmit = e => {
110
-    e.preventDefault();
111
-    props.form.validateFields((err, values) => {
112
-      if (!err) {
113
-        getList({ pageNum: 1, pageSize: 10, ...values })
114
-      }
115
-    });
116
-  }
117
-
118
-  const exportActivityStats = () => {
119
-
120
-    request({ ...apis.activityDataStatis.activityVisitNumExport, params: { activityId: activityId, activityType: activityType, ...props.form.getFieldsValue(), ...date } }).then(data => {
121
-      if (!data) {
122
-        return
123
-      }
124
-      const url = window.URL.createObjectURL(new Blob([data]))
125
-      const link = document.createElement('a')
126
-      link.style.display = 'none'
127
-      link.href = url
128
-      link.setAttribute('download', '访问统计.xlsx')
129
-      document.body.append(link)
130
-      link.click()
131
-    }).catch()
132
-  }
133
-
134
-  const { getFieldDecorator } = props.form
135
-  return <>
136
-    <div>
137
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ display: 'flex', alignItems: 'center' }}>
138
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
139
-          {getFieldDecorator('personFrom')(
140
-            <WxDictSelect />,
141
-          )}
142
-        </Form.Item>
143
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
144
-          {getFieldDecorator('province')(<Input placeholder="请输入归属地" />)}
145
-        </Form.Item>
146
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
147
-          {getFieldDecorator('realtyConsultant')(<Input placeholder="置业顾问" />)}
148
-        </Form.Item>
149
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
150
-          {getFieldDecorator('realtyConsultantPhone')(<Input placeholder="置业顾问电话" />)}
151
-        </Form.Item>
152
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
153
-          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
154
-            搜索
155
-            </Button>
156
-          <Button onClick={handleReset} style={{ marginLeft: '30px' }}>重置</Button>
157
-        </Form.Item>
158
-        <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
159
-        <Modal
160
-          title="指标说明(数据会存在一定时间延迟)"
161
-          centered
162
-          visible={showHelp}
163
-          footer={null}
164
-          onCancel={() => setShowHelp(false)}
165
-        >
166
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享人数:</p>
167
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>分享小程序活动的总人数</p>
168
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享次数:</p>
169
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>触发小程序活动分享的总次数</p>
170
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>新增注册用户:</p>
171
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前活动授权手机号的总人数</p>
172
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问人数:</p>
173
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总人数</p>
174
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问次数:</p>
175
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总次数</p>
176
-        </Modal>
177
-      </Form>
178
-      <div>
179
-
180
-
181
-        <Button type="primary" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={exportActivityStats} >
182
-          导出
183
-            </Button>
184
-
185
-      </div>
186
-      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
187
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
188
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
189
-      </div>
190
-    </div>
191
-  </>
192
-}
193
-
194
-const WrappedTypeForm = Form.create()(header);
195
-export default WrappedTypeForm

+ 0
- 204
src/pages/activity/dataRecord/table/visitors.jsx Parādīt failu

@@ -1,204 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import apis from '../../../../services/apis';
5
-import request from '../../../../utils/request';
6
-import AuthButton from '../../../../components/AuthButton';
7
-import WxDictSelect from '@/components/SelectButton/WxDictSelect';
8
-import moment from 'moment';
9
-
10
-const date = {
11
-  startDate: moment().year(1000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z',
12
-  endDate: moment().year(3000).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z'
13
-}
14
-// 2020-04-18T16:00:00.000Z
15
-
16
-const header = props => {
17
-
18
-  // const [id,type] = props
19
-  const [showHelp, setShowHelp] = useState(false)
20
-  const [data, setData] = useState({})
21
-  const activityId = props.id
22
-  const activityType = props.type
23
-
24
-
25
-  useEffect(() => {
26
-
27
-    getList({ pageNum: 1, pageSize: 10 })
28
-
29
-  }, [])
30
-
31
-  const getList = params => {
32
-    console.log(params)
33
-    request({ ...apis.activityDataStatis.activityVisitPersonNum, params: { ...params, activityId: activityId, activityType: activityType, ...date } }).then(data => {
34
-      console.log(data)
35
-      props.getData()
36
-      setData(data)
37
-    }).catch(e => {
38
-      console.log(e)
39
-    })
40
-  }
41
-
42
-  // getTableList () {
43
-
44
-  //   console.log(formData)
45
-  //   request({ ...apis.activityDataStatis.activityVisitPersonNum, params: formData }).then(data => {
46
-  //     console.log(data)
47
-  //     this.setState({ tableData: data.records, total: data.total})
48
-  //   }).catch()
49
-  // }
50
-  const format = data => {
51
-    console.log(data.replace(/,/g, '\n'))
52
-
53
-    return <div dangerouslySetInnerHTML={{ __html: data.replace(/,/g, ",<br/>") }}>{}</div>
54
-  }
55
-  const columns = [
56
-    {
57
-      title: '姓名',
58
-      dataIndex: 'nickName',
59
-      key: 'nickName',
60
-    },
61
-    {
62
-      title: '电话',
63
-      dataIndex: 'phone',
64
-      key: 'phone',
65
-    },
66
-    {
67
-      title: '性别',
68
-      dataIndex: 'gender',
69
-      key: 'gender',
70
-    },
71
-    {
72
-      title: '归属地',
73
-      dataIndex: 'province',
74
-      key: 'province',
75
-    },
76
-    {
77
-      title: '来源渠道',
78
-      dataIndex: 'personFrom',
79
-      key: 'personFrom',
80
-    },
81
-    {
82
-      title: '置业顾问',
83
-      dataIndex: 'realtyConsultant',
84
-      key: 'realtyConsultant',
85
-      render: (x, row) => <>{row.realtyConsultant ? format(row.realtyConsultant) : ''}</>,
86
-      width: 180
87
-    },
88
-    {
89
-      title: '置业顾问电话',
90
-      dataIndex: 'realtyConsultantPhone',
91
-      key: 'realtyConsultantPhone',
92
-      render: (x, row) => <>{row.realtyConsultantPhone ? format(row.realtyConsultantPhone) : ''}</>,
93
-      width: 180
94
-    },
95
-    {
96
-      title: '推广人',
97
-      dataIndex: 'sharePersonName',
98
-      key: 'sharePersonName',
99
-    },
100
-    {
101
-      title: '访问次数',
102
-      dataIndex: 'visitNum',
103
-      key: 'visitNum',
104
-    },
105
-  ]
106
-
107
-  function handleReset() {
108
-    props.form.resetFields();
109
-    getList({ pageNum: 1, pageSize: 10 })
110
-  }
111
-
112
-  const changePageNum = pageNumber => {
113
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
114
-  }
115
-
116
-  const handleSubmit = e => {
117
-    e.preventDefault();
118
-    props.form.validateFields((err, values) => {
119
-      if (!err) {
120
-        console.log('提交数据: ', values)
121
-
122
-        getList({ pageNum: 1, pageSize: 10, ...values })
123
-      }
124
-    });
125
-  }
126
-
127
-  const exportActivityStats = () => {
128
-
129
-    request({ ...apis.activityDataStatis.activityVisitPersonNumExport, params: { activityId: activityId, activityType: activityType, ...props.form.getFieldsValue(), ...date } }).then(data => {
130
-      if (!data) {
131
-        return
132
-      }
133
-      const url = window.URL.createObjectURL(new Blob([data]))
134
-      const link = document.createElement('a')
135
-      link.style.display = 'none'
136
-      link.href = url
137
-      link.setAttribute('download', '访问统计.xlsx')
138
-      document.body.append(link)
139
-      link.click()
140
-    }).catch()
141
-  }
142
-
143
-  const { getFieldDecorator } = props.form
144
-  return <>
145
-    <div >
146
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ display: 'flex', alignItems: 'center' }}>
147
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
148
-          {getFieldDecorator('personFrom')(
149
-            <WxDictSelect />,
150
-          )}
151
-        </Form.Item>
152
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
153
-          {getFieldDecorator('province')(<Input placeholder="请输入归属地" />)}
154
-        </Form.Item>
155
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
156
-          {getFieldDecorator('realtyConsultant')(<Input placeholder="置业顾问" />)}
157
-        </Form.Item>
158
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
159
-          {getFieldDecorator('realtyConsultantPhone')(<Input placeholder="置业顾问电话" />)}
160
-        </Form.Item>
161
-        <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
162
-          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
163
-            搜索
164
-            </Button>
165
-          <Button onClick={handleReset} style={{ marginLeft: '30px' }}>重置</Button>
166
-        </Form.Item>
167
-        <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
168
-        <Modal
169
-          title="指标说明(数据会存在一定时间延迟)"
170
-          centered
171
-          visible={showHelp}
172
-          footer={null}
173
-          onCancel={() => setShowHelp(false)}
174
-        >
175
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享人数:</p>
176
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>分享小程序活动的总人数</p>
177
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>分享次数:</p>
178
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>触发小程序活动分享的总次数</p>
179
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>新增注册用户:</p>
180
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前活动授权手机号的总人数</p>
181
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问人数:</p>
182
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总人数</p>
183
-          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问次数:</p>
184
-          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>访问小程序活动的总次数</p>
185
-        </Modal>
186
-      </Form>
187
-      <div>
188
-
189
-
190
-        <Button type="primary" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={exportActivityStats}>
191
-          导出
192
-            </Button>
193
-
194
-      </div>
195
-      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
196
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
197
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
198
-      </div>
199
-    </div>
200
-  </>
201
-}
202
-
203
-const WrappedTypeForm = Form.create()(header);
204
-export default WrappedTypeForm

+ 0
- 207
src/pages/activity/drainage/Detail.jsx Parādīt failu

@@ -1,207 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import { FormattedMessage } from 'umi-plugin-react/locale';
5
-import styles from '../../style/GoodsList.less';
6
-import moment from 'moment';
7
-import apis from '../../../services/apis';
8
-import request from '../../../utils/request';
9
-import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
10
-import AuthButton from '../../../components/AuthButton';
11
-import { timeout } from 'q';
12
-import Prompt from 'umi/prompt';
13
-
14
-const data = []
15
-
16
-const header = (props) => {
17
-  const { drainageId, name } = props.location.query
18
-
19
-
20
-  const [datas, setDatas] = useState([])
21
-  const [content, setContent] = useState([{}, {}])
22
-  const [columns, setColumns] = useState([])
23
-  const [startDate, setStartDate] = useState('')
24
-  const [endDate, setEndDate] = useState('')
25
-  const [total, setTotal] = useState({})
26
-  // let content = {}
27
-  useEffect(() => {
28
-
29
-    gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId })
30
-
31
-  }, [])
32
-
33
-  function gettaDrainageRecord(params) {
34
-    request({ ...apis.activity.taDrainageRecord, params: { ...params } }).then((data) => {
35
-      // setDatas(data) 
36
-      console.log(data, '3333333333333')
37
-      if (data.total != 0) {
38
-        setTotal(data)
39
-        setDatas(tableData(data.records))
40
-        // content = data.records[0]
41
-        console.log('json: ', eval('(' + data.records[0].content + ')'))
42
-        setContent(eval('(' + data.records[0].content + ')'))
43
-        setColumns(tableTitle(data.records))
44
-      }
45
-      else {
46
-        setDatas([])
47
-        message.info('数据为空')
48
-      }
49
-
50
-
51
-
52
-    }).catch((err) => {
53
-      console.log(err)
54
-      message.info(err.msg || err.message)
55
-    })
56
-  }
57
-  function tableData(data) {
58
-    console.log('tabledata', data)
59
-    return data.map((row, inx) => {
60
-      return eval('(' + row.content + ')').reduce((acc, col) => {
61
-        const r = {
62
-
63
-          key: inx + 1,
64
-          createDate: row.createDate,
65
-          [`${col.key}`]: col.value,
66
-          ...acc,
67
-        }
68
-        console.log('r', r)
69
-        return r
70
-      }, {})
71
-    })
72
-  }
73
-
74
-  function tableTitle(data) {
75
-    tableTitle = eval('(' + data[0].content + ')')
76
-    const cols = [{
77
-      title: "提交时间",
78
-      dataIndex: "createDate",
79
-      key: "createDate",
80
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
81
-    }]
82
-    return cols.concat(tableTitle.map((item) => {
83
-      const col = {
84
-        title: item.label,
85
-        dataIndex: item.key,
86
-        key: item.key
87
-      }
88
-      return col
89
-    }))
90
-  }
91
-  // function datalist () {
92
-
93
-  //   gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
94
-  // }
95
-
96
-  function fromTime(str) {
97
-    return str === '' ? null : `${moment(str).format('YYYY-MM-DDT00:00:00.000')}Z`
98
-  }
99
-
100
-  function Time(str) {
101
-    return str === '' ? null : `${moment(str).format('YYYY-MM-DD')}`
102
-  }
103
-  // 2019-10-30T11:04:49
104
-  function onChangetime(dates, dateStrings) {
105
-    console.log(dateStrings[1])
106
-    setEndDate(dateStrings[1])
107
-    setStartDate(dateStrings[0])
108
-
109
-  }
110
-
111
-  const changePageNum = pageNumber => {
112
-    gettaDrainageRecord({ pageNum: pageNumber, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
113
-  }
114
-
115
-
116
-  function excelPort() {
117
-    // const fieldsValue = getFieldsValue()
118
-
119
-    request({ ...apis.activity.exporttaDrainageRecord, params: { drainageId: drainageId, startTime: fromTime(startDate), endTime: fromTime(endDate) } })
120
-      .then(response => {
121
-        download(response)
122
-      }).catch(error => {
123
-
124
-      })
125
-  }
126
-
127
-
128
-
129
-  function download(data) {
130
-    if (!data) {
131
-      return
132
-    }
133
-    const url = window.URL.createObjectURL(new Blob([data]))
134
-    const link = document.createElement('a')
135
-    link.style.display = 'none'
136
-    link.href = url
137
-    link.setAttribute('download', '引流.xlsx')
138
-    document.body.append(link)
139
-    link.click()
140
-  }
141
-
142
-  function handleReset(e) {
143
-    console.log(e)
144
-    props.form.resetFields();
145
-    setEndDate('')
146
-    setStartDate('')
147
-  }
148
-
149
-  const handleSubmit = (e, props) => {
150
-    e.preventDefault();
151
-    gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
152
-  }
153
-
154
-  const { RangePicker } = DatePicker;
155
-  const { getFieldDecorator } = props.form
156
-  return (
157
-    <>
158
-      <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
159
-        <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
160
-
161
-          <Form.Item label="提交时间">
162
-            {getFieldDecorator('time')(
163
-              <RangePicker showTime format="YYYY-MM-DD HH:mm:ss"
164
-                showTime
165
-                onChange={onChangetime}
166
-              />,
167
-            )}
168
-          </Form.Item>
169
-          <Form.Item>
170
-            <Button type="primary" htmlType="submit" >
171
-              搜索
172
-          </Button>
173
-            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
174
-              重置
175
-            </Button>
176
-          </Form.Item>
177
-        </Form>
178
-        <Button onClick={() => router.go(-1)} style={{ float: 'right' }}>返回</Button>
179
-      </div>
180
-      <div>
181
-        <div style={{ display: 'flex', justifyContent: 'space-between' }}>
182
-          <div style={{ lineHeight: '92px', width: '600px', fontWeight: 'bold', fontSize: '18px' }}>
183
-            H5项目:{name}
184
-          </div>
185
-          {/* H5项目名称 style={{ float: 'right', margin: '20px 0', zIndex: 1 }} */}
186
-          <AuthButton name="admin.taDrainageRecord.export.get" noRight={null}>
187
-            <Button type="primary" style={{ marginLeft: '30px', float: 'right', marginTop: '30px', marginBottom: '30px', zIndex: 1 }} onClick={excelPort}>导出数据</Button>
188
-          </AuthButton>
189
-        </div>
190
-        <Table columns={columns} dataSource={datas} pagination={false} />
191
-        <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
192
-          <Pagination showQuickJumper defaultCurrent={1} total={total.total} onChange={(e) => changePageNum(e)} current={total.current} />
193
-        </div>
194
-      </div>
195
-
196
-      <Prompt message={location =>
197
-        location.pathname.startsWith("/activity/drainage")
198
-          ? true
199
-          : localStorage.removeItem("drainageActivePageParams")} />
200
-
201
-
202
-    </>
203
-  )
204
-}
205
-const WrappedHeader = Form.create({ name: 'header' })(header);
206
-
207
-export default WrappedHeader

+ 0
- 600
src/pages/activity/drainage/DrainageList.jsx Parādīt failu

@@ -1,600 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Select, message, Table, Pagination, Typography, Modal, DatePicker, Radio } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import Prompt from 'umi/prompt';
6
-import withActions from '@/components/ActionList';
7
-import EditIcon from '@/components/EditIcon';
8
-import Navigate from '@/components/Navigate';
9
-import styles from '../../style/GoodsList.less';
10
-import apis from '../../../services/apis';
11
-import request from '../../../utils/request';
12
-import AuthButton from '../../../components/AuthButton';
13
-import ImageUploader from '../../../components/XForm/ImageUpload';
14
-import BuildSelect from '../../../components/SelectButton/BuildSelect2'
15
-
16
-const toEditList = row => () => {
17
-  router.push({
18
-    pathname: '/activity/drainage/Detail',
19
-    query: {
20
-      drainageId: row.drainageId,
21
-      name: row.name,
22
-    },
23
-  });
24
-}
25
-
26
-const toDataReacord = row => () => {
27
-  router.push({
28
-    pathname: '/activity/drainage/drainageRecord',
29
-    query: {
30
-      id: row.drainageId,
31
-    },
32
-  });
33
-}
34
-const header = props => {
35
-  // const [data, setData] = useState({ data: [] })
36
-  const [datas, setDatas] = useState([])//表格数据
37
-  const [date, setDate] = useState({})
38
-  const [formsdate, setFormsDate] = useState({})
39
-  //   const [page, changePage] = useState({})
40
-  useEffect(() => {
41
-    if (localStorage.getItem('drainageActivePageParams')) {
42
-      props.form.setFieldsValue(JSON.parse(localStorage.getItem('drainageActivePageParams')));
43
-      // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
44
-
45
-      gettaDrainage(JSON.parse(localStorage.getItem('drainageActivePageParams')))
46
-    } else {
47
-      localStorage.setItem('drainageActivePageParams', JSON.stringify({ pageNum: 1, pageSize: 10 }));
48
-      gettaDrainage({ pageNum: 1, pageSize: 10 });
49
-    }
50
-
51
-
52
-    setDate({
53
-      ModalText: 'Content of the modal',
54
-      visible: false,
55
-      confirmLoading: false,
56
-    })
57
-
58
-  }, [])
59
-
60
-  function gettaDrainage(params) {
61
-    request({ ...apis.activity.taDrainage, params }).then(data => {
62
-      setDatas(data)
63
-      console.log(data.records, '_213_')
64
-    }).catch(err => {
65
-      console.log(err)
66
-      message.info(err.msg || err.message)
67
-    })
68
-  }
69
-
70
-  const deleteDrainage = (drainageIid) => () => {
71
-    Modal.confirm({
72
-      title: '确认删除该引流?',
73
-      okText: '确认',
74
-      cancelText: '取消',
75
-      onOk() {
76
-        request({ ...apis.activity.deletetaDrainage, urlData: { id: drainageIid }, }).then((data) => {
77
-          message.info('操作成功!')
78
-          gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
79
-        }).catch((err) => {
80
-          console.log('111111', err)
81
-          // message.info(err.msg || err.message)
82
-        })
83
-      }
84
-    });
85
-  }
86
-
87
-  const toDrainageDetail = (drainageId) => () => {
88
-    router.push({
89
-      pathname: '/activity/drainage/DetailDrainage',
90
-      query: {
91
-        drainageId
92
-      },
93
-    });
94
-  }
95
-
96
-  const newQrcode = row => {
97
-    const x = new XMLHttpRequest();
98
-    const resourceUrl = row.qrCode
99
-    console.log(resourceUrl);
100
-    x.open('GET', resourceUrl, true);
101
-    x.responseType = 'blob';
102
-    x.onload = function (e) {
103
-      const url = window.URL.createObjectURL(x.response)
104
-      const a = document.createElement('a');
105
-      a.href = url;
106
-      a.style.display = 'none'
107
-      a.download = 'H5二维码.png';
108
-      a.click();
109
-    }
110
-    x.send();
111
-  }
112
-
113
-  const exchangeDrainage = drainage => () => {
114
-    if (drainage.status === 1) {
115
-      if (drainage.isMiniapp) {
116
-        Modal.confirm({
117
-          title: '下架后当前H5活动关联的小程序端开屏图、banner图等也会自动下架。',
118
-          okText: '确认',
119
-          cancelText: '取消',
120
-          onOk() {
121
-            request({ ...apis.activity.exchangeDrainage, urlData: { id: drainage.drainageId }, data: drainage }).then((data) => {
122
-              message.info('操作成功!')
123
-              gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
124
-            }).catch((err) => {
125
-              console.log(err)
126
-              message.info(err.msg || err.message)
127
-            })
128
-          }
129
-        });
130
-      } else {
131
-        request({ ...apis.activity.exchangeDrainage, urlData: { id: drainage.drainageId }, data: drainage }).then((data) => {
132
-          message.info('H5活动已下架!')
133
-          gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
134
-        }).catch((err) => {
135
-          console.log(err)
136
-          message.info(err.msg || err.message)
137
-        })
138
-      }
139
-
140
-    } else {
141
-      request({ ...apis.activity.exchangeDrainage, urlData: { id: drainage.drainageId }, data: drainage }).then((data) => {
142
-        message.info('H5活动已上架!')
143
-        gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
144
-      }).catch((err) => {
145
-        console.log(err)
146
-        message.info(err.msg || err.message)
147
-      })
148
-    }
149
-
150
-  }
151
-
152
-  const columns = [
153
-    {
154
-      title: 'H5项目编号',
155
-      dataIndex: 'drainageId',
156
-      key: 'drainageId',
157
-      align: 'center',
158
-    },
159
-    {
160
-      title: '是否投放小程序',
161
-      dataIndex: 'isMiniapp',
162
-      key: 'isMiniapp',
163
-      align: 'cenxter',
164
-      render: (isMiniapp) => <span>{isMiniapp ? '是' : '否'}</span>,
165
-    },
166
-    {
167
-      title: 'H5项目名称',
168
-      dataIndex: 'name',
169
-      key: 'name',
170
-      align: 'center',
171
-      render: (text, datas) => <Navigate onClick={toDrainageDetail(datas.drainageId)}><Typography.Text ellipsis>{datas.name}</Typography.Text></Navigate>,
172
-    },
173
-    {
174
-      title: '链接地址',
175
-      dataIndex: 'h5Address',
176
-      key: 'h5Address',
177
-      align: 'center',
178
-      // render: (text, datas) => <div style={ { color: '#66B3FF' } } onClick= {() => addshowModal(datas)} >{ datas.name }</div>, 
179
-    },
180
-    {
181
-      title: '上架状态',
182
-      dataIndex: 'status',
183
-      key: 'status',
184
-      align: 'center',
185
-      render: (status) => <span>{status === 1 ? '已上架' : '已下架'}</span>,
186
-    },
187
-    {
188
-      title: '新建时间',
189
-      dataIndex: 'createDate',
190
-      key: 'createDate',
191
-      align: 'center',
192
-      render: (x, row) => (
193
-        <>
194
-          <span>{row.createDate && moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}</span>
195
-        </>
196
-      ),
197
-    },
198
-    {
199
-      title: '自动下架时间',
200
-      dataIndex: 'endDate',
201
-      key: 'endDate',
202
-      align: 'center',
203
-      render: (x, row) => (
204
-        <>
205
-          <span>{row.endDate && moment(row.endDate).format('YYYY-MM-DD HH:mm:ss')}</span>
206
-        </>
207
-      ),
208
-    },
209
-    // {
210
-    //   title: '参与数',
211
-    //   dataIndex: 'enlistNum',
212
-    //   key: 'enlistNum',
213
-    //   align: 'center',
214
-    //   // render:
215
-    // },
216
-    {
217
-      title: '操作',
218
-      key: 'action',
219
-      align: 'center',
220
-      width: 300,
221
-      render: withActions((text, datas) => [
222
-        <AuthButton name="admin.taDrainage.put" noRight={null}>
223
-          <EditIcon type="edit" text="编辑" onClick={() => addshowModal(datas)} />
224
-        </AuthButton>,
225
-
226
-        <EditIcon type="look" text="查看详情" onClick={toDrainageDetail(datas.drainageId)} />,
227
-
228
-        <AuthButton name="admin.taDrainage.id.delete" noRight={null}>
229
-          <EditIcon type="delete" text="删除" onClick={deleteDrainage(datas.drainageId)} />
230
-        </AuthButton >,
231
-
232
-        <AuthButton name="admin.taDrainage.publish" noRight={null}>
233
-          <EditIcon type={datas.status === 1 ? 'down' : 'up'} text={datas.status === 1 ? '下架' : '上架'} onClick={exchangeDrainage(datas)} />
234
-        </AuthButton>,
235
-
236
-        <AuthButton name="admin.taDrainage.data" noRight={null}>
237
-          <EditIcon text="数据" type="data" onClick={toEditList(datas)} />
238
-        </AuthButton>,
239
-
240
-        <AuthButton name="admin.drainageActivity.dataRecord" noRight={null}>
241
-          <EditIcon type="record" text="数据记录" onClick={toDataReacord(datas)} />
242
-        </AuthButton>,
243
-
244
-        <AuthButton name="admin.taDrainage.id.delete" noRight={null}>
245
-          <EditIcon text="下载二维码" type="download" onClick={newQrcode.bind(this, datas)} />
246
-        </AuthButton >,
247
-      ]),
248
-    },
249
-  ];
250
-  const Forms = props => {
251
-    const { formsDate } = props
252
-    // useEffect(() => {
253
-    //   if (formsDate) {
254
-    //     props.form.setFieldsValue({ ...formsDate, endDate: formsdate.endDate ? moment(formsdate.endDate, 'YYYY-MM-DD HH:mm') : null })
255
-    //   }
256
-    // }, [formsDate])
257
-
258
-    const [hiddenStatus, setHiddenStatus] = useState(formsdate.isMiniapp)
259
-
260
-    const handleSubmit = e => {
261
-      e.preventDefault();
262
-      props.form.validateFields((err, values) => {
263
-        if (!err) {
264
-          values.endDate = moment(values.endDate._d).format('YYYY-MM-DD HH:mm:ss')
265
-          if (formsDate.drainageId) {
266
-            // { ...apis.activity.deletetaDrainage,urlData: { id: drainageIid }, }
267
-            request({ ...apis.activity.updatetaDrainage, urlData: { id: formsDate.drainageId }, data: values }).then(data => {
268
-              message.info('操作成功!')
269
-              gettaDrainage(JSON.parse(localStorage.getItem('drainageActivePageParams')))
270
-              setDate({
271
-                visible: false,
272
-              });
273
-            }).catch(err => {
274
-              console.log('111111', err)
275
-              message.info(err.msg || err.message)
276
-            })
277
-          } else {
278
-            request({ ...apis.activity.addtaDrainage, data: values }).then(data => {
279
-              message.info('操作成功')
280
-              gettaDrainage(JSON.parse(localStorage.getItem('drainageActivePageParams')))
281
-              setDate({
282
-                visible: false,
283
-              });
284
-            }).catch(err => {
285
-              message.error(err.msg || err.message)
286
-            })
287
-          }
288
-        }
289
-      });
290
-    }
291
-
292
-    const handleCancel = val => {
293
-      setDate({
294
-        visible: false,
295
-      });
296
-    }
297
-
298
-    const tailFormItemLayout = {
299
-      wrapperCol: {
300
-        xs: {
301
-          span: 24,
302
-          offset: 0,
303
-        },
304
-        sm: {
305
-          span: 16,
306
-          offset: 8,
307
-        },
308
-      },
309
-    };
310
-
311
-    const formItemLayout = {
312
-      labelCol: {
313
-        xs: { span: 24 },
314
-        sm: { span: 8 },
315
-      },
316
-      wrapperCol: {
317
-        xs: { span: 24 },
318
-        sm: { span: 16 },
319
-      },
320
-    };
321
-
322
-    const changeMiniapp = e => {
323
-      if (e.target.value == 1) {
324
-        setHiddenStatus(true)
325
-      } else {
326
-        setHiddenStatus(false)
327
-      }
328
-    }
329
-
330
-    const { getFieldDecorator } = props.form;
331
-    {/* <XForm onSubmit={handleSubmit} onCancel={handleCancel} fields={fields} ></XForm> */ }
332
-
333
-    return <Form {...formItemLayout} onSubmit={handleSubmit}>
334
-      <span style={{ color: '#ef273a' }}>发布后请到资源位管理中关联资源位图,否则客户看不到</span>
335
-      <Form.Item label="是否投放小程序端" help='选择是后,该活动可投放至小程序的轮播位以及开屏广告'>
336
-        {getFieldDecorator('isMiniapp', {
337
-          initialValue: formsDate.isMiniapp ? 1 : 0,
338
-          rules: [
339
-            { required: true, message: '请选择是否投放小程序' },
340
-          ],
341
-        })(
342
-          <Radio.Group onChange={changeMiniapp} disabled={!!formsDate.activityId}>
343
-            <Radio value={1}>是</Radio>
344
-            <Radio value={0}>否</Radio>
345
-          </Radio.Group>
346
-        )}
347
-      </Form.Item>
348
-      <Form.Item label="H5项目名称">
349
-        {getFieldDecorator('name', {
350
-          initialValue: formsDate.name,
351
-          rules: [
352
-            { required: true, message: '请输入H5项目名称' },
353
-          ],
354
-        })(
355
-          <Input
356
-            placeholder="请输入H5项目名称"
357
-          />,
358
-        )}
359
-      </Form.Item>
360
-      {hiddenStatus && (<Form.Item label="选择项目">
361
-        {getFieldDecorator('buildingId', { initialValue: formsDate.buildingId })(
362
-          <BuildSelect />,
363
-        )}
364
-      </Form.Item>)}
365
-      <Form.Item label="下架时间">
366
-        {getFieldDecorator('endDate', {
367
-          initialValue: formsdate.endDate ? moment(formsdate.endDate, 'YYYY-MM-DD HH:mm:ss') : null,
368
-          rules: [
369
-            { required: true, message: '请输入下架时间' },
370
-          ]
371
-        })(
372
-          <DatePicker
373
-            showTime={{ format: 'HH:mm:ss' }}
374
-          />,
375
-        )}
376
-      </Form.Item>
377
-      {hiddenStatus && (<Form.Item label="活动链接地址">
378
-        {getFieldDecorator('h5Address', {
379
-          initialValue: formsDate.h5Address,
380
-          rules: [
381
-            { required: true, message: '请输入H5活动链接地址' },
382
-          ]
383
-        })(
384
-          <Input
385
-            placeholder="请输入H5活动链接地址"
386
-            disabled={formsDate.isMiniapp}
387
-          />,
388
-        )}
389
-      </Form.Item>)}
390
-      {hiddenStatus && (<Form.Item label="分享设置" help="建议图片尺寸:750*600px,比例5:4,格式:jpg">
391
-        {getFieldDecorator('shareImg', {
392
-          initialValue: formsDate.shareImg,
393
-          rules: [
394
-            { required: true, message: '请选择分享图片' },
395
-          ]
396
-        })(<ImageUploader />)}
397
-      </Form.Item>)}
398
-      {hiddenStatus && (<Form.Item label="活动分享语" help="可使用{name}代表用户昵称。">
399
-        {getFieldDecorator('shareTitle', {
400
-          initialValue: formsDate.shareTitle,
401
-          rules: [
402
-            { required: true, message: '请输入活动分享语' },
403
-          ]
404
-        })(
405
-          <Input
406
-            placeholder="分享语,不超过15个字"
407
-            maxLength="15"
408
-          />,
409
-        )}
410
-      </Form.Item>)}
411
-      {hiddenStatus && (<Form.Item label="中间页飞机图" help="建议图片尺寸:750*1667px,比例9:20,格式:jpg。图片底部不要放置关键信息。">
412
-        {getFieldDecorator('middleImg', {
413
-          initialValue: formsDate.middleImg,
414
-          rules: [
415
-            { required: true, message: '请选择中间页飞机图' },
416
-          ]
417
-        })(<ImageUploader />)}
418
-      </Form.Item>)}
419
-      <Form.Item {...tailFormItemLayout}>
420
-        <AuthButton name="admin.taDrainage.id.put" noRight={null}>
421
-          <Button type="primary" htmlType="submit" className={styles.searchBtn} onClick>
422
-            确定
423
-    </Button>
424
-        </AuthButton>
425
-        <Button style={{ marginLeft: 8 }} onClick={handleCancel}>
426
-          取消
427
-      </Button>
428
-      </Form.Item>
429
-    </Form>
430
-
431
-  }
432
-  const Formss = Form.create({ name: 'Forms' })(Forms);
433
-
434
-
435
-
436
-  //重置搜索
437
-  function handleReset() {
438
-    props.form.resetFields();
439
-    localStorage.setItem("drainageActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
440
-    gettaDrainage({ pageNum: 1, pageSize: 10 })
441
-  }
442
-
443
-
444
-
445
-  function addshowModal(datas) {
446
-
447
-    // alert(datas.drainageId)
448
-    setFormsDate(datas)
449
-    setDate({
450
-      visible: true,
451
-      title: "修改H5项目"
452
-    });
453
-  };
454
-
455
-  function showModal() {
456
-    setFormsDate({
457
-      drainageId: '',
458
-      name: '',
459
-      endDate: '',
460
-    })
461
-    setDate({
462
-      visible: true,
463
-      title: '新建H5项目'
464
-    });
465
-  };
466
-  const changePageNum = pageNumber => {
467
-    props.form.validateFields((err, values) => {
468
-      if (!err) {
469
-        localStorage.setItem("drainageActivePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...values }));
470
-        gettaDrainage({ pageNum: pageNumber, pageSize: 10, ...values })
471
-      }
472
-    });
473
-  }
474
-
475
-  function handleOk() {
476
-
477
-
478
-    setDate({
479
-      ModalText: 'The modal will be closed after two seconds',
480
-      confirmLoading: true,
481
-    });
482
-    function setTimeout() {
483
-      setDate({
484
-        visible: false,
485
-        confirmLoading: false,
486
-      });
487
-    };
488
-  };
489
-
490
-  function handleCancel() {
491
-    console.log('Clicked cancel button');
492
-    setDate({
493
-      visible: false,
494
-    });
495
-  };
496
-  function handleSubmit(e) {
497
-    e.preventDefault();
498
-    props.form.validateFields((err, values) => {
499
-      console.log('values', values)
500
-      if (!err) {
501
-        console.log('values', values)
502
-        localStorage.setItem("drainageActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10, ...values }));
503
-        gettaDrainage({ pageNum: 1, pageSize: 10, ...values })
504
-      }
505
-    });
506
-  }
507
-
508
-  //打开新页面
509
-  const openIndexImg = () => {
510
-    const newWin = window.open('about:blank');
511
-    newWin.location.href = "http://njcj.oss-cn-shanghai.aliyuncs.com/%E6%A1%88%E4%BE%8B.png"
512
-  }
513
-
514
-  const { getFieldDecorator } = props.form;
515
-  const { visible, confirmLoading, ModalText, title } = date;
516
-  return (
517
-    <>
518
-      <div>
519
-        <Form layout="inline" onSubmit={handleSubmit}>
520
-          <Form.Item>
521
-            {getFieldDecorator('drainageId')(
522
-              <Input
523
-                // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
524
-                placeholder="H5项目编号"
525
-              />,
526
-              // {getFieldDecorator('name', {
527
-              // })(<Input/>)}
528
-            )}
529
-          </Form.Item>
530
-          <Form.Item>
531
-            {getFieldDecorator('name')(
532
-              <Input
533
-                // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
534
-                placeholder="H5项目名称"
535
-              />,
536
-            )}
537
-          </Form.Item>
538
-          <Form.Item>
539
-            {getFieldDecorator('isMiniapp')(
540
-              <Select style={{ width: '180px' }} placeholder="是否投放小程序">
541
-                <Option value="1">是</Option>
542
-                <Option value="0">否</Option>
543
-              </Select>,
544
-            )}
545
-          </Form.Item>
546
-          <Form.Item>
547
-            {getFieldDecorator('status')(
548
-              <Select style={{ width: '180px' }} placeholder="上架状态">
549
-                <Option value="1">已上架</Option>
550
-                <Option value="0">已下架</Option>
551
-              </Select>,
552
-            )}
553
-          </Form.Item>
554
-          <Form.Item >
555
-            <AuthButton name="admin.taDrainage.search" noRight={null}>
556
-              <Button type="primary" htmlType="submit" className={styles.searchBtn} onClick>
557
-                搜索
558
-          </Button>
559
-            </AuthButton>
560
-            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
561
-              重置
562
-            </Button>
563
-          </Form.Item>
564
-        </Form>
565
-        <AuthButton name="admin.taDrainage.add.post" noRight={null}>
566
-          <Button type="danger" className={styles.addBtn} onClick={showModal}>新增</Button>
567
-        </AuthButton>
568
-        <span style={{ color: '#66B3FF', cursor: 'pointer', margin: '20px', display: 'inline-block' }} onClick={openIndexImg}>优质案例</span>
569
-        <Modal
570
-          title={title}
571
-
572
-          visible={visible}
573
-          //  onOk={handleOk}
574
-          confirmLoading={confirmLoading}
575
-          onCancel={handleCancel}
576
-          footer={null}
577
-        >
578
-          <Formss formsDate={formsdate} />
579
-        </Modal>
580
-        <Table
581
-          // onRow={record => {
582
-          //   return {
583
-          //     onClick: toDrainageDetail(record.drainageId),
584
-          //   };
585
-          // }}
586
-          columns={columns} dataSource={datas.records} pagination={false} rowKey="drainageList" />
587
-        <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
588
-          <Pagination showQuickJumper defaultCurrent={1} total={datas.total} onChange={(e) => changePageNum(e)} current={datas.current} />
589
-        </div>
590
-      </div>
591
-      <Prompt message={location =>
592
-        location.pathname.startsWith("/activity/drainage")
593
-          ? true
594
-          : localStorage.removeItem("drainageActivePageParams")} />
595
-    </>
596
-  )
597
-}
598
-const WrappedHeader = Form.create({ name: 'header' })(header);
599
-
600
-export default WrappedHeader

+ 0
- 243
src/pages/activity/drainage/components/Basic.jsx Parādīt failu

@@ -1,243 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Slider, Row, Col, Button, InputNumber, message } from 'antd';
3
-import router from 'umi/router';
4
-import apis from '../../../../services/apis';
5
-import request from '../../../../utils/request';
6
-import ImageUploader from './ImageUpload';
7
-import Styles from './styles.less';
8
-import BuildSelect from '../../../../components/SelectButton/BuildSelect2'
9
-import CheckboxGroup from './CheckboxGroup';
10
-
11
-function Basic(props) {
12
-
13
-    const { id, name } = props
14
-
15
-    const [data, setData] = useState({})
16
-    useEffect(() => {
17
-        getList();
18
-    }, [])
19
-    // 查询列表
20
-
21
-    const getList = () => {
22
-        request({ ...apis.redPacket.detail, urlData: { id } }).then(data => {
23
-            setData(data)
24
-        })
25
-    }
26
-
27
-    const updateRedPacket = data => {
28
-        request({ ...apis.redPacket.update, data: { ...data } }).then(data => {
29
-            // setData(data)
30
-            message.success('操作成功')
31
-        }).catch(() => {
32
-            message.error('操作失败')
33
-        })
34
-    }
35
-
36
-
37
-    function handleSubmit(e) {
38
-        e.preventDefault();
39
-        props.form.validateFields((err, values) => {
40
-            if (!err) {
41
-                values.activityId = id
42
-                updateRedPacket(values)
43
-            }
44
-        },
45
-        )
46
-    }
47
-
48
-    const { getFieldDecorator } = props.form
49
-
50
-    return (
51
-
52
-        <>
53
-            <Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
54
-                <Form.Item label="活动名称">
55
-                    <span>{data.name}</span>
56
-                </Form.Item>
57
-                <Form.Item label="扫码查看" >
58
-                    <img src={data.qrcode || ''} alt="" style={{ width: '100px' }} />
59
-                </Form.Item>
60
-                <Form.Item label="首页背景图" help="建议尺寸:640*1234px,格式:jpg;内容区大小:640*1040px(画面最上和最下部分分别预留640*97px的空间不要放置文字、logo等关键性内容,小屏手机该部分的画面会被遮挡)">
61
-                    {getFieldDecorator('indexBackgroundImg',
62
-                        {
63
-                            initialValue: data.indexBackgroundImg,
64
-                        })(
65
-                            <ImageUploader />,
66
-                        )}
67
-                </Form.Item>
68
-                <Form.Item label="分享海报图" help="建议尺寸:750*1206px,格式:jpg;内容区大小:750*1150">
69
-                    {getFieldDecorator('sharePosterImg',
70
-                        {
71
-                            initialValue: data.sharePosterImg,
72
-                        })(
73
-                            <ImageUploader />,
74
-                        )}
75
-                </Form.Item>
76
-                <Form.Item label="活动规则图" help="建议尺寸:640*1234px,格式:jpg;内容区大小:640*1040px(画面最上和最下部分分别预留640*97px的空间不要放置文字、logo等关键性内容,小屏手机该部分的画面会被遮挡)">
77
-                    {getFieldDecorator('activityRulesImg',
78
-                        {
79
-                            initialValue: data.activityRulesImg,
80
-                        })(
81
-                            <ImageUploader />,
82
-                        )}
83
-                </Form.Item>
84
-                <Form.Item label="助力页背景图" help="建议尺寸:640*1234px,格式:jpg;内容区大小:640*1040px(画面最上和最下部分分别预留640*97px的空间不要放置文字、logo等关键性内容,小屏手机该部分的画面会被遮挡)">
85
-                    {getFieldDecorator('helpBackgroundImg',
86
-                        {
87
-                            initialValue: data.helpBackgroundImg,
88
-                        })(
89
-                            <ImageUploader />,
90
-                        )}
91
-                </Form.Item>
92
-                <Form.Item label="排行榜背景图" help="建议尺寸:640*1234px,格式:jpg;内容区大小:640*1040px(画面最上和最下部分分别预留640*97px的空间不要放置文字、logo等关键性内容,小屏手机该部分的画面会被遮挡)">
93
-                    {getFieldDecorator('rankingBackgroundImg',
94
-                        {
95
-                            initialValue: data.rankingBackgroundImg,
96
-                        })(
97
-                            <ImageUploader />,
98
-                        )}
99
-                </Form.Item>
100
-                
101
-                
102
-                <Form.Item label="邀请好友按钮图" help="尺寸: 191*47px,格式:png, 背景透明, 图片上需带有 邀请好友 字样">
103
-                    {getFieldDecorator('inviteBtnImg',
104
-                        {
105
-                            initialValue: data.inviteBtnImg,
106
-                        })(
107
-                            <ImageUploader width="191" height="47" />,
108
-                        )}
109
-                </Form.Item>
110
-                
111
-                <Form.Item label="活动规则按钮图" help="尺寸: 191*47px,格式:png, 背景透明, 图片上需带有 活动规则 字样">
112
-                    {getFieldDecorator('ruleBtnImg',
113
-                        {
114
-                            initialValue: data.ruleBtnImg,
115
-                        })(
116
-                            <ImageUploader width="191" height="47" />,
117
-                        )}
118
-                </Form.Item>
119
-                
120
-                <Form.Item label="我要参加按钮图" help="尺寸: 191*47px,格式:png, 背景透明, 图片上需带有 我要参加 字样">
121
-                    {getFieldDecorator('joinBtnImg',
122
-                        {
123
-                            initialValue: data.joinBtnImg,
124
-                        })(
125
-                            <ImageUploader width="191" height="47" />,
126
-                        )}
127
-                </Form.Item>
128
-                
129
-                <Form.Item label="查看排名按钮图" help="尺寸: 191*47px,格式:png, 背景透明, 图片上需带有 查看排名 字样">
130
-                    {getFieldDecorator('topBtnImg',
131
-                        {
132
-                            initialValue: data.topBtnImg,
133
-                        })(
134
-                            <ImageUploader width="191" height="47" />,
135
-                        )}
136
-                </Form.Item>
137
-                
138
-                <Form.Item label="返回首页按钮图" help="尺寸: 191*47px,格式:png, 背景透明, 图片上需带有 返回首页 字样">
139
-                    {getFieldDecorator('homeBtnImg',
140
-                        {
141
-                            initialValue: data.homeBtnImg,
142
-                        })(
143
-                            <ImageUploader width="191" height="47" />,
144
-                        )}
145
-                </Form.Item>
146
-                
147
-                <Form.Item label="帮他助力按钮图" help="尺寸: 191*47px,格式:png, 背景透明, 图片上需带有 帮他助力 字样">
148
-                    {getFieldDecorator('helpBtnImg',
149
-                        {
150
-                            initialValue: data.helpBtnImg,
151
-                        })(
152
-                            <ImageUploader width="191" height="47" />,
153
-                        )}
154
-                </Form.Item>
155
-                
156
-                <Form.Item label="返回按钮图" help="尺寸: 191*47px,格式:png, 背景透明, 图片上需带有 返回 字样">
157
-                    {getFieldDecorator('backBtnImg',
158
-                        {
159
-                            initialValue: data.backBtnImg,
160
-                        })(
161
-                            <ImageUploader width="191" height="47" />,
162
-                        )}
163
-                </Form.Item>
164
-                
165
-                <Form.Item label="生成海报按钮图" help="尺寸: 60*60px,格式:png, 背景透明, 图片上需带有 生成海报 字样">
166
-                    {getFieldDecorator('posterBtnImg',
167
-                        {
168
-                            initialValue: data.posterBtnImg,
169
-                        })(
170
-                            <ImageUploader width="60" height="60" />,
171
-                        )}
172
-                </Form.Item>
173
-                
174
-                <Form.Item label="项目详情按钮图" help="尺寸: 60*60px,格式:png, 背景透明, 图片上需带有 项目详情 字样">
175
-                    {getFieldDecorator('buildingBtnImg',
176
-                        {
177
-                            initialValue: data.buildingBtnImg,
178
-                        })(
179
-                            <ImageUploader width="60" height="60" />,
180
-                        )}
181
-                </Form.Item>
182
-
183
-                <Form.Item label="上榜人数限制">
184
-                    <Row>
185
-                        <Col span={6}>
186
-                            {getFieldDecorator('topLimitPersons',
187
-                                {
188
-                                    initialValue: typeof data.topLimitPersons === 'number' ? data.topLimitPersons : 0,
189
-                                })(
190
-                                    <Slider
191
-                                        min={5}
192
-                                        max={100}
193
-                                        step={1}
194
-                                    />,
195
-                                )}
196
-                        </Col>
197
-                        <Col span={6}>
198
-                            {getFieldDecorator('topLimitPersons',
199
-                                {
200
-                                })(
201
-                                    <InputNumber
202
-                                        min={5}
203
-                                        max={100}
204
-                                        style={{ marginLeft: 16 }}
205
-
206
-                                    />,
207
-                                )}
208
-                        </Col>
209
-                    </Row>
210
-                </Form.Item>
211
-                <Form.Item label="查看楼盘按钮">
212
-                    {getFieldDecorator('buildingShowPos',
213
-                        {
214
-                            initialValue: data.buildingShowPos || 'index',
215
-                        })(<CheckboxGroup />)}
216
-                </Form.Item>
217
-                <Form.Item label="关联楼盘">
218
-                    {getFieldDecorator('buildingId',
219
-                        {
220
-                            initialValue: data.buildingId,
221
-                        })(
222
-                            <BuildSelect />,
223
-                        )}
224
-                </Form.Item>
225
-                <Form.Item label="生成海报按钮">
226
-                    {getFieldDecorator('posterShowPos', {
227
-                        initialValue: data.posterShowPos || 'index',
228
-                    })(<CheckboxGroup />)}
229
-                </Form.Item>
230
-                <Form.Item wrapperCol={{ span: 15, offset: 8 }}>
231
-                    <div style={{ width: '190px' }}>
232
-                        <Button type="primary" style={{ marginRight: '20px' }} htmlType="submit">保存</Button>
233
-                    </div>
234
-                </Form.Item>
235
-            </Form>
236
-        </>
237
-
238
-    )
239
-}
240
-
241
-const WrappedBasic = Form.create({ name: 'Basic' })(Basic);
242
-
243
-export default WrappedBasic

+ 0
- 46
src/pages/activity/drainage/components/CheckboxGroup.jsx Parādīt failu

@@ -1,46 +0,0 @@
1
-import React from 'react'
2
-import { Checkbox, Row, Col } from 'antd'
3
-import classNames from 'classnames'
4
-
5
-import Styles from './styles.less';
6
-
7
-const DataDict = [
8
-    {
9
-        label: '首页',
10
-        value: 'index',
11
-    },
12
-    {
13
-        label: '助力页',
14
-        value: 'help',
15
-    },
16
-    {
17
-        label: '活动规则页',
18
-        value: 'rule',
19
-    },
20
-]
21
-
22
-export default props => {
23
-    const { value, onChange } = props;
24
-    const vals = (value || '').split(',');
25
-    const handleChange = e => {
26
-        onChange(e.join(','));
27
-    }
28
-
29
-    return (
30
-        <Checkbox.Group className={Styles.Checkboxs} onChange={handleChange} style={{ width: '100%' }} value={vals}>
31
-            <Row>
32
-                {
33
-                    DataDict.map(item => {
34
-                        const key = item.value;
35
-                        return (
36
-                            <Col span={6} key={key}>
37
-                                <Checkbox className={classNames({ [Styles.CheckboxStytle]: vals.indexOf(item.value) > -1 })} value={item.value} >{item.label}</Checkbox>
38
-                            </Col>
39
-                        );
40
-                    })
41
-                }
42
-            </Row>
43
-        </Checkbox.Group>
44
-    );
45
-
46
-}

+ 0
- 211
src/pages/activity/drainage/components/CustomerData.jsx Parādīt failu

@@ -1,211 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, Avatar } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import apis from '../../../../services/apis';
6
-import request from '../../../../utils/request';
7
-
8
-const { RangePicker } = DatePicker
9
-
10
-const formateValue = v => {
11
-    const { date, ...values } = v
12
-
13
-    console.log(date)
14
-    return {
15
-        ...values,
16
-        startTime: date && date[0] ? `${date[0].format('YYYY-MM-DDT00:00:00')}Z` : undefined,
17
-        endTime: date && date[1] ? `${date[1].format('YYYY-MM-DDT23:59:59')}Z` : undefined,
18
-    }
19
-}
20
-
21
-function CustomerData(props) {
22
-
23
-    const { id, drainageId } = props
24
-    // const [taNoticeList, setTaNoticeList] = useState([])
25
-    const [data, setData] = useState({})
26
-
27
-    useEffect(() => {
28
-        getList({ pageNum: 1, pageSize: 10 });
29
-    }, [])
30
-    // 查询列表
31
-
32
-    const getList = params => {
33
-        // const { LocalDate, ...values } = params
34
-        // if (LocalDate != null && LocalDate.length > 0) {
35
-        //     const [refundStartTime, refundEndTime] = LocalDate
36
-        //     values.refundStartTime = `${moment(refundStartTime).format('YYYY-MM-DDT00:00:00')}Z`;
37
-        //     values.refundEndTime = `${moment(refundEndTime).format('YYYY-MM-DDT23:59:59')}Z`;
38
-        // } else {
39
-        //     values.refundStartTime = null
40
-        //     values.refundEndTime = null
41
-        // }
42
-        console.log(params, 'params')
43
-        request({ ...apis.redPacket.getRecordByConditionList, params: { ...params, activityId: id, drainageId } }).then(data => {
44
-            setData(data)
45
-        })
46
-    }
47
-
48
-    const changePageNum = pageNumber => {
49
-        props.form.validateFields((err, values) => {
50
-            if (!err) {
51
-                getList({ pageNum: pageNumber, pageSize: 10, ...formateValue(values) })
52
-            }
53
-        });
54
-    }
55
-
56
-    function handleSubmit(e) {
57
-        e.preventDefault();
58
-        props.form.validateFields((err, values) => {
59
-            if (!err) {
60
-                // eslint-disable-next-line no-console
61
-                console.log('提交数据: ', values)
62
-                getList({
63
-                    pageNum: 1,
64
-                    pageSize: 10,
65
-                    ...formateValue(values),
66
-                })
67
-            }
68
-        });
69
-    }
70
-
71
-    function handleReset() {
72
-        props.form.resetFields();
73
-
74
-        getList({ pageNum: 1, pageSize: 10 })
75
-    }
76
-
77
-    const columns = [
78
-        {
79
-            title: '头像',
80
-            dataIndex: 'avatarurl',
81
-            key: 'avatarurl',
82
-            align: 'center',
83
-            render: (x, row) => <img src={row.avatarurl} alt="" width="64px"></img >,
84
-        },
85
-        {
86
-            title: '昵称',
87
-            dataIndex: 'nickname',
88
-            key: 'nickname',
89
-            align: 'center',
90
-        },
91
-        {
92
-            title: '姓名',
93
-            dataIndex: 'name',
94
-            key: 'name',
95
-            align: 'center',
96
-        },
97
-        {
98
-            title: '手机号',
99
-            dataIndex: 'phone',
100
-            key: 'phone',
101
-            align: 'center',
102
-        },
103
-        {
104
-            title: '访问时间',
105
-            dataIndex: 'visitTime',
106
-            key: 'visitTime',
107
-            align: 'center',
108
-            render: (x, row) => <><span>{`${moment(row.visitTime).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
109
-        },
110
-        {
111
-            title: '分享人昵称',
112
-            dataIndex: 'sharePersonNickname',
113
-            key: 'sharePersonNickname',
114
-            align: 'center',
115
-            render: (x, row) => <><span>{row.sharePersonNickname || row.sharePersonName}</span></>,
116
-        },
117
-        {
118
-            title: '分享人手机号',
119
-            dataIndex: 'sharePersonPhone',
120
-            key: 'sharePersonPhone',
121
-            align: 'center',
122
-        },
123
-    ]
124
-
125
-    function download(data) {
126
-        if (!data) {
127
-            console.log('234')
128
-            return
129
-        }
130
-        const url = window.URL.createObjectURL(new Blob([data]))
131
-        const link = document.createElement('a')
132
-        link.style.display = 'none'
133
-        link.href = url
134
-        link.setAttribute('download', '客户数据.xlsx')
135
-        document.body.append(link)
136
-        link.click()
137
-    }
138
-
139
-    // ...formateValue(values)
140
-    const exportReport = () => {
141
-        props.form.validateFields((err, values) => {
142
-            if (!err) {
143
-                request({ ...apis.redPacket.exportVisitRecordByCondition, responseType: 'blob', params: { ...formateValue(values), activityId: id, drainageId } }).then(data => {
144
-                    download(data)
145
-                }).catch()
146
-            }
147
-        });
148
-
149
-    }
150
-
151
-    const { getFieldDecorator } = props.form
152
-
153
-    return (
154
-
155
-        <>
156
-            <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
157
-                <Form.Item>
158
-                    {getFieldDecorator('phone')(
159
-                        <Input
160
-                            placeholder="手机号"
161
-                        />,
162
-                    )}
163
-                </Form.Item>
164
-
165
-                <Form.Item>
166
-                    {getFieldDecorator('date')(
167
-                        <RangePicker placeholder={['访问开始时间', '访问结束时间']} />,
168
-                    )}
169
-                </Form.Item>
170
-
171
-                {/* <Form.Item>
172
-                    {getFieldDecorator('startTime')(
173
-                        <DatePicker placeholder="访问开始时间" />,
174
-                    )}
175
-                </Form.Item>
176
-                <Form.Item>
177
-                    {getFieldDecorator('endTime')(
178
-                        <DatePicker placeholder="访问结束时间" />,
179
-                    )}
180
-                </Form.Item> */}
181
-                <Form.Item>
182
-                    {getFieldDecorator('sharePersonPhone')(
183
-                        <Input
184
-                            placeholder="分享人手机号"
185
-                        />,
186
-                    )}
187
-                </Form.Item>
188
-                <Form.Item>
189
-                    <Button type="primary" htmlType="submit"> 搜索</Button>
190
-                    <Button style={{ marginLeft: 8 }} onClick={handleReset}>重置</Button>
191
-                </Form.Item>
192
-            </Form>
193
-            <div style={{ marginTop: '20px' }}>
194
-                <span style={{ lineHeight: '32px' }}>共筛选出{data.total}条数据</span>
195
-                <Button type="primary" onClick={() => exportReport()} style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} >导出</Button>
196
-            </div>
197
-            <Table dataSource={data.records} columns={columns} pagination={false} style={{ marginTop: '20px' }} />
198
-            <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
199
-                <Pagination
200
-                    showQuickJumper
201
-                    defaultCurrent={1}
202
-                    total={data.total} onChange={e => changePageNum(e)} current={data.current} />
203
-            </div>
204
-        </>
205
-
206
-    )
207
-}
208
-
209
-const WrappedCustomerData = Form.create({ name: 'CustomerData' })(CustomerData);
210
-
211
-export default WrappedCustomerData

+ 0
- 198
src/pages/activity/drainage/components/Help.jsx Parādīt failu

@@ -1,198 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, InputNumber, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import apis from '../../../../services/apis';
6
-import request from '../../../../utils/request';
7
-
8
-const { RangePicker } = DatePicker;
9
-
10
-function validatorNum(rule, value, callback) {
11
-    callback(value < 1 || value > 1000 ? '人数必须大于0 小于 1000' : undefined);
12
-}
13
-
14
-function Help(props) {
15
-
16
-    const { id, name } = props
17
-
18
-    // const [taNoticeList, setTaNoticeList] = useState([])
19
-    const [data, setData] = useState({})
20
-
21
-    useEffect(() => {
22
-        getHelpDetail();
23
-    }, [])
24
-    // 查询列表
25
-
26
-    const getHelpDetail = () => {
27
-        request({ ...apis.redPacket.helpDetail, urlData: { id } }).then(data => {
28
-            data.date = [moment(data.startDate), moment(data.endDate)]
29
-            setData(data)
30
-        })
31
-    }
32
-
33
-    const updateRedPacket = values => {
34
-
35
-        const [startDate, endDate] = values.date
36
-        console.log(values.date)
37
-        values.startDate = `${moment(startDate).format('YYYY-MM-DDTHH:mm:ss.000')}Z`
38
-        values.endDate = `${moment(endDate).format('YYYY-MM-DDTHH:mm:ss.000')}Z`
39
-        values.activityId = id
40
-        request({ ...apis.redPacket.updateHelp, urlData: { id }, data: { ...values } }).then(data => {
41
-            message.info('操作成功')
42
-        }).catch(() => {
43
-            message.error('操作失败')
44
-        })
45
-    }
46
-
47
-    function handleSubmit(e) {
48
-        e.preventDefault();
49
-        props.form.validateFields((err, values) => {
50
-            if (!err) {
51
-                console.log(values, '------222-------')
52
-
53
-                // date
54
-
55
-                // values.
56
-                updateRedPacket(values)
57
-            }
58
-        },
59
-        )
60
-    }
61
-
62
-    const { getFieldDecorator } = props.form
63
-
64
-    return (
65
-
66
-        <>
67
-            <Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
68
-                <Form.Item label="助力成功需要人数">
69
-                    {getFieldDecorator('helpSuccesPersons', {
70
-                        initialValue: data.helpSuccesPersons || 3,
71
-                        rules: [
72
-                            { required: true, message: '请设置 助力成功需要人数' },
73
-                            { validator: validatorNum },
74
-                        ],
75
-                    },
76
-                    )(
77
-                        <InputNumber min={1} max={1000} />,
78
-                    )}
79
-                </Form.Item>
80
-                <Form.Item label="单人每日助力次数限制">
81
-                    {getFieldDecorator('limitNumPerDay', {
82
-                        initialValue: data.limitNumPerDay || 3,
83
-                        rules: [
84
-                            { required: true, message: '请设置 单人每日助力次数限制' },
85
-                            { validator: validatorNum },
86
-                        ],
87
-                    })(
88
-                        <InputNumber min={1} max={1000} />,
89
-                    )}
90
-                </Form.Item>
91
-                <Form.Item label="超出时提示文案">
92
-                    {getFieldDecorator('limitPerDayIllegalTip', {
93
-                        initialValue: data.limitPerDayIllegalTip || '每人每天最多只能助力3次',
94
-                        rules: [
95
-                            { required: true, message: '请设置 超出时提示文案' },
96
-                        ],
97
-                    })(
98
-                        <Input placeholder="每人每天最多只能助力3次" />,
99
-                    )}
100
-                </Form.Item>
101
-                <Form.Item label="单人总助力次数限制">
102
-                    {getFieldDecorator('limitNumPerPerson', {
103
-                        initialValue: data.limitNumPerPerson || 3,
104
-                        rules: [
105
-                            { required: true, message: '请设置 单人总助力次数限制' },
106
-                            { validator: validatorNum },
107
-                        ],
108
-                    })(
109
-                        <InputNumber min={1} max={1000} />,
110
-                    )}
111
-                </Form.Item>
112
-                <Form.Item label="超出时提示文案">
113
-                    {getFieldDecorator('limitPerPersonIllegalTip', {
114
-                        initialValue: data.limitPerPersonIllegalTip || '每人最多只能为他人助力3次',
115
-                        rules: [
116
-                            { required: true, message: '请设置 超出时提示文案' },
117
-                        ],
118
-                    })(
119
-                        <Input placeholder="每人最多只能为他人助力3次" />,
120
-                    )}
121
-                </Form.Item>
122
-                <Form.Item label="为同一人助力次数限制">
123
-                    {getFieldDecorator('limitNumForEachPerson', {
124
-                        initialValue: data.limitNumForEachPerson || 1,
125
-                        rules: [
126
-                            { required: true, message: '请设置 为同一人助力次数限制' },
127
-                            { validator: validatorNum },
128
-                        ],
129
-                    })(
130
-                        <InputNumber min={1} max={1000} />,
131
-                    )}
132
-                </Form.Item>
133
-                <Form.Item label="超出时提示文案">
134
-                    {getFieldDecorator('limitForEachPersonIllegalTip', {
135
-                        initialValue: data.limitForEachPersonIllegalTip || '只能为同一人助力1次',
136
-                        rules: [
137
-                            { required: true, message: '请设置 超出时提示文案' },
138
-                        ],
139
-                    })(
140
-                        <Input placeholder="只能为同一人助力1次" />,
141
-                    )}
142
-                </Form.Item>
143
-                <Form.Item label="助力成功时提示文案">
144
-                    {getFieldDecorator('successTip', {
145
-                        initialValue: data.successTip || '助力成功!快去告诉你的好友吧',
146
-                        rules: [
147
-                            { required: true, message: '请设置 助力成功时提示文案' },
148
-                        ],
149
-                    })(
150
-                        <Input placeholder="助力成功!快去告诉你的好友吧" />,
151
-                    )}
152
-                </Form.Item>
153
-                <Form.Item label="其他无法助力时提示文案">
154
-                    {getFieldDecorator('warnningTip', {
155
-                        initialValue: data.warnningTip || '无法助力!具体原因请看活动规则',
156
-                        rules: [
157
-                            { required: true, message: '请设置 其他无法助力时提示文案' },
158
-                        ],
159
-                    })(
160
-                        <Input placeholder="无法助力!具体原因请看活动规则" />,
161
-                    )}
162
-                </Form.Item>
163
-                <Form.Item label="活动开始~结束时间">
164
-                    {getFieldDecorator('date', {
165
-                        initialValue: data.date || [],
166
-                        rules: [
167
-                            { required: true, message: '请设置 活动开始~结束时间' },
168
-                        ],
169
-                    })(
170
-                        <RangePicker showTime={{ format: 'HH:mm:ss' }} />,
171
-                    )}
172
-                </Form.Item>
173
-                <Form.Item label="活动结束提示文案">
174
-                    {getFieldDecorator('activityEndTip', {
175
-                        initialValue: data.activityEndTip,
176
-                        rules: [
177
-                            { required: true, message: '请设置 活动结束提示文案' },
178
-                        ],
179
-                    })(
180
-                        <Input placeholder="活动已经结束啦" />,
181
-                    )}
182
-                </Form.Item>
183
-
184
-
185
-                <Form.Item wrapperCol={{ span: 15, offset: 8 }}>
186
-                    <div style={{ width: '190px' }}>
187
-                        <Button type="primary" style={{ marginRight: '20px' }} htmlType="submit">保存</Button>
188
-                        {/* <Button onClick={() => router.go(-1)} >取消</Button> */}
189
-                    </div>
190
-                </Form.Item>
191
-            </Form></>
192
-
193
-    )
194
-}
195
-
196
-const WrappedHelp = Form.create({ name: 'Help' })(Help);
197
-
198
-export default WrappedHelp

+ 0
- 110
src/pages/activity/drainage/components/ImageUpload.jsx Parādīt failu

@@ -1,110 +0,0 @@
1
-import React from 'react';
2
-import { Upload, Icon, message } from 'antd';
3
-// import './style.less';
4
-import { uploaderProps } from '../../../../utils/upload';
5
-import './style.less';
6
-
7
-
8
-class ImageUpload extends React.Component {
9
-    state = {
10
-        loading: false,
11
-        imageUrl: undefined,
12
-    };
13
-
14
-    handleChange = info => {
15
-        if (info.file.status === 'uploading') {
16
-            this.setState({ loading: true });
17
-            return;
18
-        }
19
-
20
-        if (info.file.status === 'removed') {
21
-            this.props.onChange();
22
-        }
23
-
24
-        // if (info.file.status === "done") {
25
-        //   this.setState({
26
-        //     loading: false,
27
-        //   })
28
-
29
-        //   if (info.file.response && info.file.response.url) {
30
-        //     this.setState({
31
-        //       imageUrl: info.file.response.thumbUrl,
32
-        //     });
33
-
34
-        //     if (typeof this.props.onChange === 'function') {
35
-        //       this.props.onChange(info.file.response.url);
36
-        //     }
37
-        //   }
38
-        // }
39
-    };
40
-
41
-    // {(this.state.imageUrl || value) ? (
42
-    //   <img src={this.state.imageUrl || value} alt="avatar" style={{ width: "100%" }} />
43
-    // ) : (
44
-    //     uploadButton
45
-    //   )}
46
-
47
-    handleUploadSucess = (url) => {
48
-        this.setState({ loading: false });
49
-        if (typeof this.props.onChange === 'function') {
50
-            this.props.onChange(url);
51
-        }
52
-    }
53
-
54
-    render() {
55
-        const uploadButton = (
56
-            <div>
57
-                <Icon style={{ fontSize: '2em', color: '#aaa' }} type={this.state.loading ? 'loading' : 'plus'} />
58
-            </div>
59
-        );
60
-
61
-        // width: 150px;
62
-        // height: 241px;
63
-        const boundStyle = {
64
-            width: `${this.props.width || 150}px`,
65
-            height: `${this.props.height || 150}px`,
66
-            marginTop: '10px',
67
-        }
68
-        
69
-        const { value } = this.props;
70
-        return (
71
-            <>
72
-                {!(this.state.imageUrl || value) && <div style={boundStyle}> <Upload
73
-                    listType="picture-card"
74
-                    className="avatar-uploader avatar-newupdate"
75
-                    showUploadList={false}
76
-                    beforeUpload={this.props.beforeUpload}
77
-                    onChange={this.handleChange}
78
-                    {...uploaderProps}
79
-                    disabled={this.props.disabled}
80
-                    onSuccess={this.handleUploadSucess}
81
-
82
-                >
83
-                    {uploadButton}
84
-                </Upload>
85
-                </div>
86
-                }
87
-                {(this.state.imageUrl || value) && <div className="uploadbox" style={boundStyle}>
88
-                    <img className="img" src={this.state.imageUrl || value} alt="avatar" style={{ width: '100%' }} ></img>
89
-
90
-                    <Upload
91
-                        listType="picture-card"
92
-                        // className={}
93
-                        className="avatar-uploader avatar-update"
94
-                        showUploadList={false}
95
-                        beforeUpload={this.props.beforeUpload}
96
-                        onChange={this.handleChange}
97
-                        {...uploaderProps}
98
-                        disabled={this.props.disabled}
99
-                        onSuccess={this.handleUploadSucess}
100
-                    >
101
-                        更换
102
-                </Upload>
103
-                </div>}
104
-
105
-            </>
106
-        );
107
-    }
108
-}
109
-
110
-export default ImageUpload;

+ 0
- 148
src/pages/activity/drainage/components/Ranking.jsx Parādīt failu

@@ -1,148 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Avatar } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import apis from '../../../../services/apis';
6
-import request from '../../../../utils/request';
7
-
8
-function Ranking(props) {
9
-
10
-    const { id } = props
11
-    // const [taNoticeList, setTaNoticeList] = useState([])
12
-    const [data, setData] = useState({})
13
-
14
-    useEffect(() => {
15
-        getList({ pageNum: 1, pageSize: 10 });
16
-    }, [])
17
-    // 查询列表
18
-
19
-    const getList = params => {
20
-        request({ ...apis.redPacket.getRedPacketRankingList, params: { ...params, activityId: id } }).then(data => {
21
-            setData(data)
22
-        })
23
-    }
24
-
25
-    function handleSubmit(e) {
26
-        e.preventDefault();
27
-        props.form.validateFields((err, values) => {
28
-            if (!err) {
29
-                // eslint-disable-next-line no-console
30
-                console.log('提交数据: ', values)
31
-                getList({ pageNum: 1, pageSize: 10, ...values })
32
-            }
33
-        });
34
-    }
35
-
36
-    const changePageNum = pageNumber => {
37
-        props.form.validateFields((err, values) => {
38
-            if (!err) {
39
-                getList({ pageNum: pageNumber, pageSize: 10, ...values })
40
-            }
41
-        });
42
-    }
43
-
44
-    function handleReset() {
45
-        props.form.resetFields();
46
-
47
-        getList({ pageNum: 1, pageSize: 10 })
48
-    }
49
-
50
-    const columns = [
51
-        {
52
-            title: '头像',
53
-            dataIndex: 'avatarurl',
54
-            key: 'avatarurl',
55
-            align: 'center',
56
-            render: (x, row) => <img src={row.avatarurl} alt="" width="64px"></img >,
57
-        },
58
-        {
59
-            title: '昵称',
60
-            dataIndex: 'nickname',
61
-            key: 'nickname',
62
-            align: 'center',
63
-        },
64
-        {
65
-            title: '姓名',
66
-            dataIndex: 'name',
67
-            key: 'name',
68
-            align: 'center',
69
-        },
70
-        {
71
-            title: '手机号',
72
-            dataIndex: 'phone',
73
-            key: 'phone',
74
-            align: 'center',
75
-        },
76
-        {
77
-            title: '发起时间',
78
-            dataIndex: 'createDate',
79
-            key: 'createDate',
80
-            align: 'center',
81
-            render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
82
-        },
83
-        {
84
-            title: '助力人数',
85
-            dataIndex: 'votes',
86
-            key: 'votes',
87
-            align: 'center',
88
-        },
89
-    ]
90
-
91
-    function download(data) {
92
-        // if (!data) {
93
-        //     console.log('234')
94
-        //     return
95
-        // }
96
-        const url = window.URL.createObjectURL(new Blob([data]))
97
-        const link = document.createElement('a')
98
-        link.style.display = 'none'
99
-        link.href = url
100
-        link.setAttribute('download', '排行榜.xlsx')
101
-        document.body.append(link)
102
-        link.click()
103
-    }
104
-
105
-    const exportReport = () => {
106
-
107
-        request({ ...apis.redPacket.exportRedPacketRankingList, responseType: 'blob', params: { ...props.form.getFieldsValue(), activityId: id } }).then(data => {
108
-            download(data)
109
-        }).catch()
110
-    }
111
-    const { getFieldDecorator } = props.form
112
-
113
-    return (
114
-
115
-        <>
116
-            <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
117
-                <Form.Item>
118
-                    {getFieldDecorator('phone')(
119
-                        <Input
120
-                            placeholder="手机号"
121
-                        />,
122
-                    )}
123
-                </Form.Item>
124
-                <Form.Item>
125
-                    <Button type="primary" htmlType="submit"> 搜索</Button>
126
-                    <Button style={{ marginLeft: 8 }} onClick={handleReset}>重置</Button>
127
-                </Form.Item>
128
-            </Form>
129
-            <div style={{ marginTop: '20px' }}>
130
-                <span style={{ lineHeight: '32px' }}>共筛选出{data.total}条数据</span>
131
-                <Button type="primary" onClick={() => exportReport()} style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} >导出</Button>
132
-            </div>
133
-            <Table dataSource={data.records} columns={columns} pagination={false} style={{ marginTop: '20px' }} />
134
-            <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
135
-                <Pagination
136
-                    showQuickJumper
137
-                    defaultCurrent={1}
138
-                    total={data.total} onChange={e => changePageNum(e)} current={data.current} />
139
-            </div>
140
-        </>
141
-
142
-    )
143
-}
144
-
145
-
146
-const WrappedRanking = Form.create({ name: 'Ranking' })(Ranking);
147
-
148
-export default WrappedRanking

+ 0
- 218
src/pages/activity/drainage/components/RedPacket.jsx Parādīt failu

@@ -1,218 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Row, Col, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb, InputNumber } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import Navigate from '@/components/Navigate';
6
-import apis from '../../../../services/apis';
7
-import request from '../../../../utils/request';
8
-import Styles from './styles.less';
9
-
10
-
11
-function RedPacket(props) {
12
-
13
-    const { id, name } = props
14
-    // const [taNoticeList, setTaNoticeList] = useState([])
15
-    const [data, setData] = useState({})
16
-
17
-    useEffect(() => {
18
-        getMoneyDetail()
19
-        // getList({ pageNum: 1, pageSize: 10 });
20
-    }, [])
21
-    // 查询列表
22
-    //     moneyDetail
23
-    // updateMoney
24
-
25
-    const getMoneyDetail = () => {
26
-        request({ ...apis.redPacket.moneyDetail, urlData: { id } }).then(data => {
27
-            setData(data)
28
-        })
29
-    }
30
-
31
-    const updateRedPacket = data => {
32
-        request({ ...apis.redPacket.updateMoney, urlData: { id }, data: { ...data } }).then(data => {
33
-            // setData(data)
34
-            message.info('操作成功')
35
-        })
36
-    }
37
-
38
-    function handleSubmit(e) {
39
-        e.preventDefault();
40
-        props.form.validateFields((err, values) => {
41
-            if (!err) {
42
-                values.budget = Math.round(values.budget * 100)
43
-                values.minPacket = Math.round(values.minPacket * 100)
44
-                values.maxPacket = Math.round(values.maxPacket * 100)
45
-                console.log(values, '------222-------')
46
-                // values
47
-                updateRedPacket(values)
48
-            }
49
-        },
50
-        )
51
-    }
52
-
53
-    const toRecharge = () => {
54
-
55
-        router.push({
56
-            pathname: '/funds/accountfunds',
57
-        })
58
-    }
59
-
60
-
61
-    const { getFieldDecorator } = props.form
62
-    const { taRedPacketClient } = data
63
-
64
-    return (
65
-
66
-        <>
67
-            <Row style={{ marginBottom: '40px' }}>
68
-                <Col span={8} style={{ paddingRight: '30px' }}>
69
-                    <div className={Styles.redHeader}>
70
-                        <div className={Styles.redHeaderTop}><span className={Styles.redHeaderTopText}>账户余额/元</span><span className={Styles.redHeaderTopNum}>{data.availableBalance / 100 || 0}</span></div>
71
-                        <div className={Styles.redHeaderBottom}> <Navigate onClick={() => toRecharge()}>去充值</Navigate></div>
72
-                    </div>
73
-                </Col>
74
-                <Col span={8} style={{ padding: '0 10px' }}>
75
-                    <div className={Styles.redHeader}>
76
-                        {/* packetSendedNum */}
77
-                        <div className={Styles.redHeaderTop}><span className={Styles.redHeaderTopText}>已发送红包总数量/个</span><span className={Styles.redHeaderTopNum}>{data.sendNum || 0}</span></div>
78
-                        <div className={Styles.redHeaderBottom}><Navigate onClick={() => props.toDetail()}>查看详情</Navigate></div>
79
-                    </div>
80
-                </Col>
81
-                <Col span={8} style={{ paddingLeft: '30px' }}>
82
-                    <div className={Styles.redHeader}>
83
-                        <div className={Styles.redHeaderTop}><span className={Styles.redHeaderTopText}>已发送红包金额/元</span><span className={Styles.redHeaderTopNum}>{data.sendTotalAmount / 100 || 0}</span></div>
84
-                        <div className={Styles.redHeaderBottom}><Navigate onClick={() => props.toDetail(1)}>查看详情</Navigate></div>
85
-                    </div>
86
-                </Col>
87
-            </Row>
88
-            <Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
89
-                <Form.Item label="本次红包预算/元">
90
-                    {getFieldDecorator('budget', {
91
-                        initialValue: data.budget / 100,
92
-                        rules: [
93
-
94
-                            { required: true, message: '请设置合适的红包预算金额', pattern: new RegExp('^[0-9]{1,5}([.][0-9]{1,2})?$') },
95
-                            {
96
-                                validator: (rule, value, callback) => {
97
-                                    callback(value > (data.availableBalance + data.sendTotalAmount) / 100 ? '预算超支' : value < data.sendTotalAmount / 100 ? '红包预算不能小于已发送红包金额' : undefined)
98
-                                }
99
-                            }
100
-                        ],
101
-                    },
102
-                    )(
103
-                        <Input type="number"
104
-                            // formatter={value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
105
-                            // parser={value => value.replace(/\$\s?|(,*)/g, '')}
106
-                            min={0}
107
-                            max={99999}
108
-                            step={0.01}
109
-                        />,
110
-                    )}
111
-                </Form.Item>
112
-                <Form.Item label="单个红包金额范围/元">
113
-                    {getFieldDecorator('minPacket', {
114
-                        initialValue: data.minPacket / 100 || 3,
115
-                        rules: [
116
-                            { required: true, message: '请设置合适的最小红包值', pattern: new RegExp('^[0-9]{1,5}([.][0-9]{1,2})?$') },
117
-                        ],
118
-                    })(
119
-                        <InputNumber min={1} max={199} />,
120
-                    )}~
121
-                     {getFieldDecorator('maxPacket', {
122
-                        initialValue: data.maxPacket / 100 || 3,
123
-                        rules: [
124
-                            { required: true, message: '请设置合适的最大红包值', pattern: new RegExp('^[0-9]{1,5}([.][0-9]{1,2})?$') },
125
-                        ],
126
-                    })(
127
-                        <InputNumber min={1} max={199} />,
128
-                    )}
129
-                </Form.Item>
130
-                {/*  */}
131
-                <Form.Item label="发放红包个数上限">
132
-                    {getFieldDecorator('limitPacketNum', {
133
-                        initialValue: data.limitPacketNum === -1 ? -1 : data.limitPacketNum,
134
-                        rules: [
135
-                            // { required: false, message: '请设置合适的发放红包个数上限', pattern: new RegExp('^[0-9]{1,99}\d*$') }, help="-1为不限制红包个数" 
136
-                            {
137
-                                validator: (rule, value, callback) => {
138
-                                    // callback(((value > data.sendNum || data.limitPacketNum === -1) ? undefined : '不能小于已发送个数'))
139
-                                    callback(value >= data.sendNum ? undefined : value == -1 ? undefined : '不能小于已发送个数')
140
-                                },
141
-                            },
142
-
143
-                        ],
144
-                    })(<InputNumber precision={0} min={-1} />,
145
-                    )} -1为不限制红包个数
146
-                </Form.Item>
147
-                {/* <Form.Item label="余额或预算不足时提示文案">
148
-                    {getFieldDecorator('insufficientBalanceTip', {
149
-                        initialValue: data.insufficientBalanceTip || '红包已发送完毕,谢谢您的参与',
150
-                        rules: [
151
-                            { required: true, message: '请设置余额或预算不足时提示文案' },
152
-                        ],
153
-                    })(
154
-                        <Input placeholder="红包已发送完毕,谢谢您的参与" />,
155
-                    )}
156
-                </Form.Item> */}
157
-                {/* font-size:22px;
158
-font-family:PingFangSC-Medium,PingFang SC;
159
-font-weight:500;
160
-color:rgba(102,102,102,1); */}
161
-                <Row>
162
-                    <Col span={8} style={{ textAlign: 'end', fontSize: '0.13rem', fontWeight: '500', color: 'rgba(102,102,102,1)', padding: '0 0.076rem' }}>配置消息</Col>
163
-                </Row>
164
-                <Form.Item label="商户名称" >
165
-                    {getFieldDecorator('mchName', {
166
-                        initialValue: data.mchName,
167
-                        rules: [
168
-                            { required: true, message: '请设置商户名称' },
169
-                            { max: 10, message: '标商户名称长度不能超过10个字符' }
170
-                        ],
171
-                    })(
172
-                        <Input placeholder="{小程序名}" />,
173
-                    )}
174
-                </Form.Item>
175
-                <Form.Item label="红包祝福语">
176
-                    {getFieldDecorator('blessing', {
177
-                        initialValue: data.blessing,
178
-                        rules: [
179
-                            { required: true, message: '请设置红包祝福语' },
180
-                        ],
181
-                    })(
182
-                        <Input placeholder="祝您中个大红包!" />,
183
-                    )}
184
-                </Form.Item>
185
-                <Form.Item label="活动名称">
186
-                    {getFieldDecorator('activityName', {
187
-                        initialValue: data.activityName,
188
-                        rules: [
189
-                            { required: true, message: '请设置活动名称' },
190
-                        ],
191
-                    })(
192
-                        <Input placeholder="{活动标题}" />,
193
-                    )}
194
-                </Form.Item>
195
-                <Form.Item label="备注">
196
-                    {getFieldDecorator('remark', {
197
-                        initialValue: data.remark,
198
-                        rules: [
199
-                            { required: true, message: '请设置remark' },
200
-                        ],
201
-                    })(
202
-                        <Input placeholder="点我拆红包" />,
203
-                    )}
204
-                </Form.Item>
205
-                <Form.Item wrapperCol={{ span: 15, offset: 8 }}>
206
-                    <div style={{ width: '190px' }}>
207
-                        <Button type="primary" style={{ marginRight: '20px' }} htmlType="submit">保存</Button>
208
-                        {/* <Button onClick={() => router.go(-1)} >取消</Button> */}
209
-                    </div>
210
-                </Form.Item>
211
-            </Form></>
212
-
213
-    )
214
-}
215
-
216
-const WrappedRedPacket = Form.create({ name: 'RedPacket' })(RedPacket);
217
-
218
-export default WrappedRedPacket

+ 0
- 163
src/pages/activity/drainage/components/RedPacketRecord.jsx Parādīt failu

@@ -1,163 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import apis from '../../../../services/apis';
6
-import request from '../../../../utils/request';
7
-
8
-const TradingStatus = {
9
-    // processing: '进行中',
10
-    success: '成功',
11
-    fail: '失败',
12
-}
13
-
14
-function RedPacketRecord(props) {
15
-
16
-    // const [taNoticeList, setTaNoticeList] = useState([])
17
-
18
-    const { id, toRedPacketRecord } = props
19
-    const [data, setData] = useState({})
20
-
21
-    useEffect(() => {
22
-        console.log(toRedPacketRecord, 'toRedPacketRecord')
23
-        if (toRedPacketRecord === 1) {
24
-            props.form.setFieldsValue({ tradingStatus: 'success' })
25
-            getList({ pageNum: 1, pageSize: 10, tradingStatus: 'success' });
26
-        } else { getList({ pageNum: 1, pageSize: 10 }); }
27
-
28
-    }, [])
29
-    // 查询列表
30
-
31
-    const getList = params => {
32
-        request({ ...apis.redPacket.listSendRecord, params: { ...params, activityId: id } }).then(data => {
33
-            setData(data)
34
-        })
35
-    }
36
-
37
-    function handleSubmit(e) {
38
-        e.preventDefault();
39
-        props.form.validateFields((err, values) => {
40
-            if (!err) {
41
-                // eslint-disable-next-line no-console
42
-                console.log('提交数据: ', values)
43
-                getList({ pageNum: 1, pageSize: 10, ...values })
44
-            }
45
-        });
46
-    }
47
-
48
-    function handleReset() {
49
-        props.form.resetFields();
50
-
51
-        getList({ pageNum: 1, pageSize: 10 })
52
-    }
53
-
54
-    const changePageNum = pageNumber => {
55
-        props.form.validateFields((err, values) => {
56
-            if (!err) {
57
-                getList({ pageNum: pageNumber, pageSize: 10, ...values })
58
-            }
59
-        });
60
-    }
61
-
62
-    const columns = [
63
-        {
64
-            title: '订单号',
65
-            dataIndex: 'tradeNo',
66
-            key: 'tradeNo',
67
-            align: 'center',
68
-        },
69
-        {
70
-            title: '用户昵称',
71
-            dataIndex: 'nickname',
72
-            key: 'nickname',
73
-            align: 'center',
74
-        },
75
-        {
76
-            title: '头像',
77
-            dataIndex: 'avatarurl',
78
-            key: 'avatarurl',
79
-            align: 'center',
80
-            render: (x, row) => <img src={row.avatarurl} alt="" width="64px"></img >,
81
-        },
82
-        {
83
-            title: '手机号',
84
-            dataIndex: 'phone',
85
-            key: 'phone',
86
-            align: 'center',
87
-        },
88
-        {
89
-            title: '发放时间',
90
-            key: 'createDate',
91
-            align: 'center',
92
-            render: (x, row) => <span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>,
93
-        },
94
-        {
95
-            title: '金额(元)',
96
-            dataIndex: 'amount',
97
-            key: 'amount',
98
-            align: 'center',
99
-            render: x => <span>{x / 100}</span >,
100
-        },
101
-        {
102
-            title: '发送状态',
103
-            dataIndex: 'tradingStatus',
104
-            key: 'tradingStatus',
105
-            align: 'center',
106
-            render: x => <span>{TradingStatus[x] || ''}</span>,
107
-        },
108
-    ]
109
-
110
-    const { getFieldDecorator } = props.form
111
-
112
-    return (
113
-
114
-        <>
115
-            <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
116
-                <Form.Item>
117
-                    {getFieldDecorator('tradeNo')(
118
-                        <Input
119
-                            placeholder="订单号"
120
-                        />,
121
-                    )}
122
-                </Form.Item>
123
-                <Form.Item>
124
-                    {getFieldDecorator('phone')(
125
-                        <Input
126
-                            placeholder="手机号"
127
-                        />,
128
-                    )}
129
-                </Form.Item>
130
-                <Form.Item>
131
-                    {getFieldDecorator('tradingStatus')(
132
-                        <Select style={{ width: '180px' }} placeholder="发送状态">
133
-                            <option value="">全部</option>
134
-                            {
135
-                                Object.keys(TradingStatus).map(k => {
136
-                                    const key = `tds-${k}`;
137
-                                    return (<option key={key} value={k}>{TradingStatus[k]}</option>);
138
-                                })
139
-                            }
140
-                        </Select>,
141
-                    )}
142
-                </Form.Item>
143
-                <Form.Item>
144
-                    <Button type="primary" htmlType="submit"> 搜索</Button>
145
-                    <Button style={{ marginLeft: 8 }} onClick={handleReset}>重置</Button>
146
-                </Form.Item>
147
-            </Form>
148
-
149
-            <Table dataSource={data.records} columns={columns} pagination={false} rowKey={r => r.qrCodeId} style={{ marginTop: '20px' }} />
150
-            <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
151
-                <Pagination
152
-                    showQuickJumper
153
-                    defaultCurrent={1}
154
-                    total={data.total} onChange={e => changePageNum(e)} current={data.current} />
155
-            </div>
156
-        </>
157
-
158
-    )
159
-}
160
-
161
-const WrappedRedPacketRecord = Form.create({ name: 'RedPacketRecord' })(RedPacketRecord);
162
-
163
-export default WrappedRedPacketRecord

+ 0
- 120
src/pages/activity/drainage/components/style.less Parādīt failu

@@ -1,120 +0,0 @@
1
-:global {
2
-  .avatar-newupdate{
3
-    width: 100%;
4
-    height: 100%;
5
-    & > .ant-upload {
6
-      width: 100%;
7
-        height: 100%;
8
-    }
9
-    
10
-  }
11
-  
12
-  // > .ant-upload{
13
-  //   width: 100%;
14
-  //   height: 100%;
15
-  // }
16
-  .avatar-update {
17
-    & > .ant-upload {
18
-      width:36px;
19
-      height:25px;
20
-      border: none;
21
-      font-size:18px;
22
-      // font-family:PingFangSC-Medium,PingFang SC;
23
-      font-weight:500;
24
-      color:rgba(255,255,255,1);
25
-      line-height:25px;
26
-      padding: 0;
27
-      margin: 0;
28
-      border: none;
29
-      background: none;
30
-      // position: absolute;
31
-     .ant-upload{
32
-        padding: 0;
33
-        color:#fff;
34
-        // position: relative;
35
-      }
36
-    }
37
-  }
38
- .uploadbox {
39
-   margin-top: 10px;
40
-  position: relative;
41
-  width: 150px;
42
-  height: 241px;
43
- 
44
-  .img{
45
-    position: absolute;
46
-    width: 100%;
47
-    height: 100%;
48
-    border-radius:7px;
49
-    border:1px solid rgba(156,156,156,1);
50
-  }
51
-  .avatar-update{
52
-    width: 100%;
53
-    text-align: center;
54
-    position: absolute;
55
-    bottom: 0;
56
-    left: 50%;
57
-    transform: translate(-50%, 0);
58
-    // margin: 0 auto;
59
-
60
-    .ant-upload {
61
-      width: 100%;
62
-      text-align: center;
63
-      background-color: rgba(0,0,0,0.2);
64
-    }
65
-  }
66
-}
67
-}
68
-
69
-.avatar-uploader{
70
-  width: 100%;
71
-  height: 100%;
72
-}
73
-
74
-
75
-
76
-/* you can make up upload button and sample style by using stylesheets */
77
-.ant-upload-select-picture-card i {
78
-  font-size: 32px;
79
-  color: #999;
80
-}
81
-
82
-.ant-upload-select-picture-card .ant-upload-text {
83
-  margin-top: 8px;
84
-  color: #666;
85
-}
86
-
87
-.ant-checkbox-inner {
88
-  background-color: #EF273A !important;
89
-}
90
-
91
-.Checkboxs {
92
-  background-color: #EF273A !important;
93
-}
94
-
95
-.img {
96
-  position: absolute;
97
-}
98
-
99
-.avatar-update > .ant-upload {
100
-  width:36px;
101
-height:25px;
102
-border: none;
103
-font-size:18px;
104
-// font-family:PingFangSC-Medium,PingFang SC;
105
-font-weight:500;
106
-color:rgba(255,255,255,1);
107
-line-height:25px;
108
-padding: 0;
109
-}
110
-
111
-.avatar-update{
112
-  
113
-  width:36px;
114
-height:25px !important;
115
-// font-size:18px;
116
-// font-family:PingFangSC-Medium,PingFang SC;
117
-// font-weight:500;
118
-// color:rgba(255,255,255,1);
119
-// line-height:25px;
120
-}

+ 0
- 39
src/pages/activity/drainage/components/styles.less Parādīt failu

@@ -1,39 +0,0 @@
1
-
2
-  .CheckboxStytle {
3
-    color: #EF273A;
4
-    
5
-  }
6
-
7
-  .redHeader{
8
-    height: 150px;
9
-    background:rgba(249,249,249,1);
10
-    border-radius:12px;
11
-    padding: 0 24px;
12
-    .redHeaderTop{
13
-      text-align: center;
14
-      height: 97px;
15
-      font-family:PingFangSC-Regular,PingFang SC;
16
-      font-weight:400;
17
-      
18
-      line-height:97px;
19
-      display: flex;
20
-      justify-content: center;
21
-      .redHeaderTopText{
22
-        font-size:18px;
23
-        color:rgba(51,51,51,1);
24
-      }
25
-      .redHeaderTopNum{
26
-        font-size:48px;
27
-        font-family:PingFangSC-Medium,PingFang SC;
28
-        font-weight:500;
29
-        color:rgba(255,126,72,1);
30
-
31
-      }
32
-    }
33
-    .redHeaderBottom{
34
-      border-top:1px solid rgba(216,216,216,1);
35
-      height: 53px;
36
-      text-align: center;
37
-      line-height: 53px;
38
-    }
39
-  }

+ 0
- 114
src/pages/activity/drainage/detailDrainage.jsx Parādīt failu

@@ -1,114 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Button } from 'antd';
3
-// import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import moment from 'moment';
5
-import router from 'umi/router';
6
-import Navigate from '@/components/Navigate';
7
-// import AuthButton from '@/components/AuthButton';
8
-import request from '../../../utils/request';
9
-import apis from '../../../services/apis';
10
-
11
-const cancelPage = () => {
12
-  router.go(-1);
13
-};
14
-
15
-const BasicForm = props => {
16
-  const { drainageId } = props.location.query;
17
-  const [data, setData] = useState({});
18
-
19
-  useEffect(() => {
20
-    request({ ...apis.activity.detailDrainage, urlData: { id: drainageId } }).then(data => {
21
-      setData(data);
22
-    });
23
-  }, []);
24
-
25
-  const toDrainageDetail = () => {
26
-    router.push({
27
-      pathname: '/activity/drainage/h5edit',
28
-      query: {
29
-        id: data.activityId,
30
-        name: data.name,
31
-        drainageId,
32
-      },
33
-    });
34
-  }
35
-
36
-  const formItemLayout = {
37
-    labelCol: {
38
-      xs: { span: 24 },
39
-      sm: { span: 8 },
40
-    },
41
-    wrapperCol: {
42
-      xs: { span: 24 },
43
-      sm: { span: 16 },
44
-    },
45
-  };
46
-  return (
47
-    <>
48
-      <Form {...formItemLayout}>
49
-        <Form.Item label="H5活动编号:">
50
-          <span>{data.drainageId}</span>
51
-        </Form.Item>
52
-        <Form.Item label="是否投放小程序:">
53
-          <span>{data.isMiniapp ? '是' : '否'}</span>
54
-        </Form.Item>
55
-        <Form.Item label="H5活动名称:">
56
-          <span>{data.name}</span>
57
-        </Form.Item>
58
-        {data.isMiniapp && (
59
-          <Form.Item label="链接地址:">
60
-            <span>{data.h5Address}</span>
61
-          </Form.Item>
62
-        )}
63
-        {data.activityId && (
64
-          <Form.Item label="扫码查看">
65
-            <img src={data.qrCode} alt="" width="200"></img>
66
-          </Form.Item>
67
-        )}
68
-        {data.activityId && (
69
-          <Form.Item label="配置H5">
70
-            <Navigate onClick={toDrainageDetail}>修改配置</Navigate>
71
-          </Form.Item>
72
-        )}
73
-        <Form.Item label="上架状态:">
74
-          <span>{data.status === 1 ? '已上架' : '未上架'}</span>
75
-        </Form.Item>
76
-        <Form.Item label="新建时间:">
77
-          <span>{moment(data.createDate).format('YYYY-MM-DD HH:mm:ss')}</span>
78
-        </Form.Item>
79
-        <Form.Item label="自动下架时间:">
80
-          <span>{moment(data.endDate).format('YYYY-MM-DD HH:mm:ss')}</span>
81
-        </Form.Item>
82
-        <Form.Item label="appid:">
83
-          <span>{data.appid}</span>
84
-        </Form.Item>
85
-        <Form.Item label="secret:">
86
-          <span>{data.appSecret}</span>
87
-        </Form.Item>
88
-        <Form.Item label="参与人数:">
89
-          <span>{data.enlistNum}</span>
90
-        </Form.Item>
91
-        {data.isMiniapp && (
92
-          <Form.Item label="分享语:">
93
-            <span>{data.shareTitle}</span>
94
-          </Form.Item>
95
-        )}
96
-        {data.isMiniapp && (
97
-          <Form.Item label="分享图:">
98
-            <img src={data.shareImg} width="75px" height="60px" alt="" />
99
-          </Form.Item>
100
-        )}
101
-        {data.isMiniapp && (
102
-          <Form.Item label="中间页飞机图:">
103
-            <img src={data.middleImg} width="75px" height="166.7px" alt="" />
104
-          </Form.Item>
105
-        )}
106
-        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
107
-          <Button onClick={() => cancelPage()}>取消</Button>
108
-        </Form.Item>
109
-      </Form>
110
-    </>
111
-  );
112
-};
113
-
114
-export default BasicForm;

+ 0
- 16
src/pages/activity/drainage/drainageRecord.jsx Parādīt failu

@@ -1,16 +0,0 @@
1
-import React from 'react';
2
-import DataRecord from '../dataRecord/index'
3
-import Prompt from 'umi/prompt';
4
-
5
-const header = props =>{
6
-    const id = props.location.query.id
7
-    // type:'h5',
8
-    return <><DataRecord  id ={id} activeType="h5"/>
9
-    <Prompt message={location =>
10
-        location.pathname.startsWith("/activity/drainage")
11
-          ? true
12
-          : localStorage.removeItem("drainageActivePageParams")} />
13
-    </>
14
-}
15
-
16
-export default header

+ 0
- 89
src/pages/activity/drainage/h5edit.jsx Parādīt failu

@@ -1,89 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Radio } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import apis from '../../../services/apis';
6
-import request from '../../../utils/request';
7
-import Basic from './components/Basic';
8
-import Help from './components/Help';
9
-import RedPacket from './components/RedPacket';
10
-import RedPacketRecord from './components/RedPacketRecord';
11
-import CustomerData from './components/CustomerData';
12
-import Ranking from './components/Ranking';
13
-
14
-
15
-const H5configuration = props => {
16
-
17
-    const [tab, setTab] = useState('1')
18
-    const [data, setData] = useState({})
19
-    const [toRedPacketRecord, setToRedPacketRecord] = useState()
20
-
21
-    const { id, name, drainageId } = props.location.query
22
-    // const type = props.activeType
23
-
24
-
25
-    useEffect(() => {
26
-        console.log(props)
27
-        // getData({ id: id, type: type })
28
-
29
-    }, [])
30
-
31
-    const getData = (params) => {
32
-
33
-        // request({ ...apis.activityDataStatis.getStatisticData, params: { ...params, } }).then((data) => {
34
-        //     console.log(data)
35
-        //     setData(data || {})
36
-        // })
37
-    }
38
-
39
-    function tabsCallback(e) {
40
-
41
-        setTab(e.target.value)
42
-        setToRedPacketRecord()
43
-    }
44
-    const onDetai = (e) => {
45
-        console.log(e)
46
-        setTab('4')
47
-        setToRedPacketRecord(e)
48
-    }
49
-
50
-
51
-    return <>
52
-
53
-        <div>
54
-            <Radio.Group value={tab} buttonStyle="solid" onChange={e => tabsCallback(e)}>
55
-                <Radio.Button value="1">基础配置</Radio.Button>
56
-                <Radio.Button value="2">助力配置</Radio.Button>
57
-                <Radio.Button value="3">红包配置</Radio.Button>
58
-                <Radio.Button value="4">红包记录</Radio.Button>
59
-                <Radio.Button value="5">客户数据</Radio.Button>
60
-                <Radio.Button value="6">排行榜</Radio.Button>
61
-            </Radio.Group>
62
-
63
-            {/* <Tabs type="card" value={tab} buttonStyle="solid" onChange={e => tabsCallback(e)}>
64
-                <TabPane tab="基础配置" key="1" ></TabPane>
65
-                <TabPane tab="助力配置" key="2" ></TabPane>
66
-                <TabPane tab="红包配置" key="3" ></TabPane>
67
-                <TabPane tab="红包记录" key="4" ></TabPane>
68
-                <TabPane tab="客户数据" key="5" ></TabPane>
69
-                <TabPane tab="排行榜" key="6" ></TabPane>
70
-            </Tabs> */}
71
-            <div style={{ marginTop: '20px' }}>
72
-                {/* 基础配置 */}
73
-                {(tab === '1' && <Basic id={id} name={name} />)}
74
-                {/* 助力配置 */}
75
-                {(tab === '2' && <Help id={id} name={name} />)}
76
-                {/* 红包配置 */}
77
-                {(tab === '3' && <RedPacket toDetail={onDetai} id={id} name={name} />)}
78
-                {/* 红包记录 */}
79
-                {(tab === '4' && <RedPacketRecord id={id} toRedPacketRecord={toRedPacketRecord} />)}
80
-                {/* 客户数据 */}
81
-                {(tab === '5' && <CustomerData id={id} drainageId={drainageId} />)}
82
-                {/* 排行榜 */}
83
-                {(tab === '6' && <Ranking id={id} />)}
84
-            </div>
85
-        </div>
86
-    </>
87
-}
88
-
89
-export default H5configuration

+ 0
- 432
src/pages/activity/groupActivity/editGroupActivity.jsx Parādīt failu

@@ -1,432 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../../style/GoodsList.less';
5
-import apis from '../../../services/apis';
6
-import moment from 'moment';
7
-import router from 'umi/router';
8
-import BuildSelect from '../../../components/SelectButton/BuildSelect2'
9
-import XForm, { FieldTypes } from '../../../components/XForm';
10
-import Wangedit from '../../../components/Wangedit/Wangedit'
11
-import request from '../../../utils/request'
12
-import yinhao from '../../../assets/yinhao.png'
13
-import ImageUploader from '../../../components/XForm/ImageUpload';
14
-import logo from '../../../assets/logo.svg';
15
-import touxiang from '../../../assets/touxiang.jpg';
16
-import poster1 from '../../../assets/poster1.png';
17
-import poster2 from '../../../assets/poster2.png';
18
-import xiaochengxu from '../../../assets/xiaochengxu.png'
19
-import Prompt from 'umi/prompt';
20
-
21
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22
-const { TextArea } = Input;
23
-
24
-const cancelPage = () => {
25
-  router.push({
26
-    pathname: '/activity/groupActivity/list',
27
-  });
28
-}
29
-
30
-
31
-const Basic = props => {
32
-  const { dynamicData, disable, activityStatus, scoreData, groupActivityId } = props;
33
-
34
-  const fields = [
35
-    {
36
-      label: '选择项目',
37
-      name: 'buildingId',
38
-      render: <BuildSelect disabled={disable} />,
39
-      value: dynamicData.buildingId,
40
-      rules: [
41
-        { required: true, message: '请选择项目' },
42
-      ],
43
-    },
44
-    {
45
-      label: '活动标题',
46
-      name: 'activityName',
47
-      type: FieldTypes.Text,
48
-      value: dynamicData.activityName,
49
-      rules: [
50
-        { required: true, message: '请输入活动标题' },
51
-      ]
52
-    },
53
-    {
54
-      label: '拼团详情主图',
55
-      name: 'mainImg',
56
-      type: FieldTypes.ImageUploader,
57
-      value: dynamicData.mainImg,
58
-      rules: [
59
-        { required: true, message: '请输入拼团详情主图' },
60
-      ],
61
-      help: '建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:拼团活动详情',
62
-    },
63
-    {
64
-      label: '拼团封面图1',
65
-      name: 'listImg',
66
-      type: FieldTypes.ImageUploader,
67
-      value: dynamicData.listImg,
68
-      rules: [
69
-        { required: true, message: '请输入拼团封面图1' },
70
-      ],
71
-      help: '建议图片尺寸:750*420px,比例16:9,格式:jpg,用于:活动列表/首页推荐',
72
-    },
73
-    {
74
-      label: '拼团封面图2',
75
-      name: 'bannerListImg',
76
-      type: FieldTypes.ImageUploader,
77
-      value: dynamicData.bannerListImg,
78
-      rules: [
79
-        { required: true, message: '请输入拼团封面图2' },
80
-      ],
81
-      help: '建议图片尺寸:750*250px,比例3:1,格式:jpg,用于:项目详情页',
82
-    },
83
-    {
84
-      label: '活动时间',
85
-      name: 'activityTime',
86
-      type: FieldTypes.RangePicker,
87
-      value: dynamicData.startTime != null ? [moment(dynamicData.startTime, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endTime, 'YYYY-MM-DD HH:mm')] : null,
88
-      props: { showTime: { format: 'HH:mm' } },
89
-      rules: [
90
-        { required: true, message: '请选择活动时间' },
91
-      ],
92
-    },
93
-    {
94
-      label: '成团人数',
95
-      name: 'groupBuyPeople',
96
-      type: FieldTypes.Text,
97
-      value: dynamicData.groupBuyPeople,
98
-      props: { disabled: activityStatus === 0 },
99
-      help: '注:成团所需人数',
100
-      rules: [
101
-        { required: true, message: '请输入成团人数' },
102
-      ]
103
-    },
104
-    {
105
-      label: '所需积分',
106
-      name: 'integral',
107
-      type: FieldTypes.Text,
108
-      value: dynamicData.integral,
109
-      props: { disabled: activityStatus === 0 },
110
-      help: `注:用户平均积分${scoreData.averageScore}`,
111
-      rules: [
112
-        { required: true, message: '请输入所需积分' },
113
-      ]
114
-    },
115
-    {
116
-      label: '活动说明',
117
-      name: 'descImg',
118
-      type: FieldTypes.ImageUploader,
119
-      value: dynamicData.descImg,
120
-      rules: [
121
-        { required: true, message: '请输入活动说明' },
122
-      ],
123
-      help: '建议宽度:750px,高度不限,格式:jpg,用于活动详情',
124
-    },
125
-    {
126
-      label: '权重',
127
-      name: 'heavy',
128
-      type: FieldTypes.Number,
129
-      render: <Input type="number" style={{ width: 80 }} />,
130
-      value: dynamicData.heavy,
131
-      rules: [
132
-        { required: true, message: '请输入权重' },
133
-      ],
134
-      help: '数字越大越靠前',
135
-    },
136
-  ]
137
-
138
-  function compareDate(dateTime1, dateTime2) {
139
-    return new Date(dateTime1) > new Date(dateTime2);
140
-  }
141
-
142
-  const handleSubmit = val => {
143
-    const { activityTime, signupTime, ...submitValue } = val
144
-
145
-    const [startTime, endTime] = activityTime
146
-    submitValue.startTime = moment(startTime).format('YYYY-MM-DD HH:mm');
147
-    submitValue.endTime = moment(endTime).format('YYYY-MM-DD HH:mm');
148
-
149
-    if (groupActivityId) {
150
-      const nowDate = new Date()
151
-      if (!compareDate(nowDate, startTime)) {
152
-        message.info('修改后的开始时间不得大于当前时间(会存在已经成功助力或者发起助力的用户)')
153
-        return
154
-      }
155
-      submitValue.groupActivityId = groupActivityId
156
-      request({ ...apis.groupActivity.update, data: submitValue }).then(data => {
157
-        message.info('保存成功')
158
-        // cancelPage()
159
-      }).catch(() => {
160
-        // message.info(err.msg || err.message)
161
-      })
162
-    } else {
163
-      request({ ...apis.groupActivity.add, data: submitValue }).then(data => {
164
-        router.push({
165
-          pathname: '/activity/groupActivity/editGroupActivity',
166
-          query: {
167
-            groupActivityId: data,
168
-          },
169
-        });
170
-        message.info("保存成功")
171
-        // cancelPage()
172
-      }).catch(() => {
173
-        // message.info(err.msg || err.message)
174
-      })
175
-    }
176
-  }
177
-
178
-  return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
179
-}
180
-
181
-const Poster = props => {
182
-  const { groupActivityId } = props;
183
-  const [inputValue, changeInput] = useState('')
184
-  const [textAreaValue, changeTextArea] = useState('')
185
-  const [imgValue, changeImg] = useState('')
186
-  const [posterId, setPosterId] = useState('')
187
-  // const [miniappName, setMiniappName] = useState('')
188
-
189
-  useEffect(() => {
190
-    if (groupActivityId) {
191
-      request({ ...apis.activity.poster, params: { targetId: groupActivityId, targetType: 'groupActivity' } }).then(data => {
192
-        if (data.length > 0) {
193
-          setPosterId(data[0].posterId)
194
-          changeImg(data[0].posterImg)
195
-          changeTextArea(data[0].posterDescription)
196
-          changeInput(data[0].posterTitle)
197
-        }
198
-      }).catch(err => {
199
-        message.info(err.msg || err.message)
200
-      })
201
-    }
202
-
203
-    // getMiniappName()
204
-  }, [])
205
-
206
-  // // 获取小程序名称
207
-  // function getMiniappName() {
208
-  //   request({ ...apis.building.getMiniappName }).then(res => {
209
-  //     setMiniappName(res)
210
-  //   })
211
-  // }
212
-
213
-  const submitPoster = () => {
214
-    if (groupActivityId) {
215
-      if (posterId) {
216
-        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: groupActivityId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then(data => {
217
-          message.info('保存成功')
218
-        }).catch(err => {
219
-          message.info(err.msg || err.message)
220
-        })
221
-      } else {
222
-        request({ ...apis.activity.addPoster, data: { targetId: groupActivityId, targetType: 'groupActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then(data => {
223
-          setPosterId(data.posterId)
224
-          message.info('保存成功')
225
-        }).catch(err => {
226
-          message.info(err.msg || err.message)
227
-        })
228
-      }
229
-    } else {
230
-      message.warn('请先保存基本信息数据')
231
-    }
232
-  }
233
-
234
-  return <div>
235
-    <div style={{ display: 'flex' }}>
236
-      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
237
-        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
238
-          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
239
-          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
240
-            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
241
-            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
242
-            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
243
-            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
244
-          </div>
245
-          <p style={{
246
-            margin: '10px 20px',
247
-            fontSize: '20px',
248
-            color: '#222',
249
-            fontWeight: '600',
250
-            display: '-webkit-box',
251
-            lineClamp: '3',
252
-            height: '60px',
253
-            WebkitLineClamp: '2',
254
-            WebkitBoxOrient: 'vertical',
255
-            overflow: 'hidden',
256
-            textOverflow: 'ellipsis',
257
-          }}>{inputValue || '海报标题'}</p>
258
-
259
-          <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
260
-          <p style={{
261
-            margin: '16px 20px 28px 20px',
262
-            fontSize: '17px',
263
-            color: '#999',
264
-            display: '-webkit-box',
265
-            lineClamp: '3',
266
-            height: '72px',
267
-            WebkitLineClamp: '3',
268
-            WebkitBoxOrient: 'vertical',
269
-            overflow: 'hidden',
270
-            textOverflow: 'ellipsis',
271
-          }}>{textAreaValue || '海报描述'}</p>
272
-          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
273
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
274
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
275
-            <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
276
-          </div>
277
-        </div>
278
-        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
279
-      </div>
280
-
281
-      <div >
282
-        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
283
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团海报图</p>
284
-          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
285
-        </div>
286
-        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:750*600,比例5:4,格式:jpg,用于拼团活动海报</p>
287
-        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
288
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
289
-          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
290
-        </div>
291
-        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
292
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
293
-          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
294
-        </div>
295
-
296
-      </div>
297
-    </div>
298
-    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
299
-    <Button onClick={() => cancelPage()}>取消</Button>
300
-  </div>
301
-}
302
-
303
-
304
-const Share = props => {
305
-  console.log(props, 'props')
306
-  const { groupActivityId } = props
307
-  const [inputValue, changeInput] = useState('')
308
-  const [imgValue, changeImg] = useState('')
309
-  const [shareContentId, setShareContentId] = useState('')
310
-
311
-  useEffect(() => {
312
-    if (groupActivityId) {
313
-      request({ ...apis.activity.shareContent, params: { targetId: groupActivityId, targetType: 'groupActivity' } }).then(data => {
314
-        if (data.length > 0) {
315
-          setShareContentId(data[0].shareContentId)
316
-          changeImg(data[0].shareContentImg)
317
-          changeInput(data[0].shareContentTitle)
318
-        }
319
-      }).catch(err => {
320
-        message.info(err.msg || err.message)
321
-      })
322
-    }
323
-  }, [])
324
-
325
-  const submitShare = () => {
326
-    console.log(groupActivityId)
327
-    if (groupActivityId) {
328
-      if (shareContentId) {
329
-        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
330
-          message.info('保存成功')
331
-        }).catch(err => {
332
-          message.info(err.msg || err.message)
333
-        })
334
-      } else {
335
-        request({ ...apis.activity.addShareContent, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then(data => {
336
-          setShareContentId(data.shareContentId)
337
-          message.info('保存成功')
338
-        }).catch(err => {
339
-          message.info(err.msg || err.message)
340
-        })
341
-      }
342
-    } else {
343
-      message.warn('请先保存基本信息数据')
344
-    }
345
-  }
346
-
347
-  return <div style={{ padding: '20px' }}>
348
-    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
349
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
350
-      <div>
351
-        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />橙蕉互动</p>
352
-        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue || '置业V客厅 精准获客平台'}</p>
353
-        <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
354
-      </div>
355
-    </div>
356
-    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
357
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
358
-      <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
359
-    </div>
360
-    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
361
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团分享图</p>
362
-      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
363
-    </div>
364
-    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于拼团活动分享好友</p>
365
-    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
366
-    <Button onClick={() => cancelPage()}>取消</Button>
367
-  </div>
368
-}
369
-
370
-
371
-/**
372
- *
373
- *
374
- * @param {*} props
375
- * @returns
376
- */
377
-const Edit = props => {
378
-  const [tab, changeTab] = useState('basic')
379
-  // 判断是否展示助力次数的输入框
380
-  const { groupActivityId } = props.location.query
381
-  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
382
-  const [scoreData, setScoreData] = useState({})
383
-  const [activityStatus, setActivityStatus] = useState({})
384
-  const [disable, setDisable] = useState(false)
385
-
386
-  // 详情
387
-  const getDynamicData = id => {
388
-    request({ ...apis.groupActivity.details, urlData: { id } }).then(data => {
389
-      setDynamicData(data)
390
-      setActivityStatus(data.activityStatus)
391
-      setDisable(data.activityStatus === 0)
392
-    })
393
-  }
394
-
395
-  useEffect(() => {
396
-    request(apis.groupActivity.avgScore).then(data => {
397
-      setScoreData(data);
398
-    })
399
-  }, [])
400
-
401
-  useEffect(() => {
402
-    if (groupActivityId) {
403
-      getDynamicData(groupActivityId);
404
-    }
405
-  }, [groupActivityId])
406
-
407
-  // const radioOnChange = e => {
408
-  //   setDynamicData({ ...dynamicData, isEnlist: e.target.value })
409
-  // }
410
-
411
-  return (
412
-    <div>
413
-      <div>
414
-        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
415
-          <Radio.Button value="basic">基本信息</Radio.Button>
416
-          <Radio.Button value="poster">海报图片</Radio.Button>
417
-          <Radio.Button value="share">分享设置</Radio.Button>
418
-        </Radio.Group>
419
-      </div>
420
-      <div>
421
-        {tab === 'basic' && <Basic dynamicData={dynamicData} disable={disable} activityStatus={activityStatus} scoreData={scoreData} groupActivityId={groupActivityId} />}
422
-        {tab === 'poster' && <Poster groupActivityId={groupActivityId} />}
423
-        {tab === 'share' && <Share groupActivityId={groupActivityId} />}
424
-      </div>
425
-      <Prompt message={location =>
426
-        (location.pathname.startsWith('/activity/groupActivity')
427
-          ? true
428
-          : localStorage.removeItem('groupActivePageParams'))} />
429
-    </div>
430
-  );
431
-}
432
-export default Edit

+ 0
- 16
src/pages/activity/groupActivity/groupActivityRecord.jsx Parādīt failu

@@ -1,16 +0,0 @@
1
-import React from 'react';
2
-import DataRecord from '../dataRecord/index'
3
-import Prompt from 'umi/prompt';
4
-
5
-const header = props =>{
6
-    const id = props.location.query.id
7
-    // type:'group',
8
-    return <><DataRecord id ={id} activeType="group" />
9
-    <Prompt message={location =>
10
-        location.pathname.startsWith("/activity/groupActivity")
11
-          ? true
12
-          : localStorage.removeItem("groupActivePageParams")} />
13
-          </>
14
-}
15
-
16
-export default header

+ 0
- 546
src/pages/activity/groupActivity/helpRecord.jsx Parādīt failu

@@ -1,546 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, message } from 'antd';
3
-import moment from 'moment';
4
-import request from '../../../utils/request';
5
-import apis from '../../../services/apis';
6
-import router from 'umi/router';
7
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
8
-import AuthButton from '@/components/AuthButton';
9
-
10
-
11
-const { Option } = Select;
12
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
13
-const { Meta } = Card;
14
-
15
-/**
16
- * 拼团者弹框
17
- */
18
-class InviteTable extends React.Component {
19
-  constructor(props) {
20
-    super(props);
21
-    this.state = {
22
-      dataSource: { records: [] },
23
-      visibleData: { visible: false, groupActivityId: '', groupStatus: '' },
24
-    }
25
-  }
26
-
27
-  // 挂载之后
28
-  componentDidMount() {
29
-    const { groupActivityId } = this.state.visibleData
30
-    this.getList({ groupActivityId: groupActivityId, groupStatus: status, pageNumber: 1, pageSize: 5 })
31
-  }
32
-
33
-  componentDidUpdate(preProps, preState) {
34
-    const { groupActivityId } = this.props.visibleData
35
-    if (this.props.visibleData.visible !== preState.visibleData.visible) {
36
-      this.getList({ ...this.props.visibleData, pageNumber: 1, pageSize: 5 })
37
-      this.setState({ visibleData: this.props.visibleData });
38
-    }
39
-  }
40
-
41
-  // 弹框确定按钮
42
-  // eslint-disable-next-line react/sort-comp
43
-  handleOk() {
44
-    this.setState({ visibleData: { visible: false, groupActivityId: '', realtyConsultant: '' } })
45
-  }
46
-
47
-  // 弹框取消按钮
48
-  handleCancel() {
49
-    this.setState({ visibleData: { visible: false, groupActivityId: '', realtyConsultant: '' } })
50
-  }
51
-
52
-  getList(params) {
53
-    console.log("params", params);
54
-    request({ ...apis.groupActivity.shareChildList, params: { ...params } }).then(res => {
55
-      this.setState({ dataSource: res })
56
-    }).catch(err => {
57
-      // eslint-disable-next-line no-unused-expressions
58
-      <Alert
59
-        style={{
60
-          marginBottom: 24,
61
-        }}
62
-        message={err}
63
-        type="error"
64
-        showIcon
65
-      />
66
-    })
67
-  }
68
-
69
-  // 分页
70
-  onChange(pageNum) {
71
-    this.getList({ pageNumber: pageNum, pageSize: 5 })
72
-  }
73
-
74
-  exportChildRecord(params) {
75
-    request({ ...apis.groupActivity.exportShareChildRecord, responseType: 'blob', params: { ...params } })
76
-      .then(data => {
77
-        if (!data) {
78
-          return
79
-        }
80
-        const url = window.URL.createObjectURL(new Blob([data]))
81
-        const link = document.createElement('a')
82
-        link.style.display = 'none'
83
-        link.href = url
84
-        link.setAttribute('download', '拼团发起记录.xlsx')
85
-        document.body.append(link)
86
-        link.click()
87
-      }).catch(() => {
88
-
89
-      })
90
-  }
91
-
92
-  render() {
93
-    const columns = [
94
-      {
95
-        title: '用户姓名',
96
-        dataIndex: 'nickname',
97
-        key: 'nickname',
98
-        align: 'center',
99
-      },
100
-      {
101
-        title: '手机号',
102
-        dataIndex: 'phone',
103
-        key: 'phone',
104
-        align: 'center',
105
-        render: text => <a>{text}</a>,
106
-      },
107
-      {
108
-        title: '开团时间',
109
-        dataIndex: 'createTime',
110
-        key: 'createTime',
111
-        align: 'center',
112
-        render: (x, row) => <><span>{row.createTime ? `${moment(row.createTime).format('YYYY-MM-DD HH:mm:ss')}` : ''}</span></>,
113
-      },
114
-    ]
115
-    return (
116
-      <>
117
-        <Modal
118
-          title="参团者"
119
-          destroyOnClose="true"
120
-          width={900}
121
-          footer={null}
122
-          visible={this.state.visibleData.visible}
123
-          // onOk={() => this.handleOk()}
124
-          onCancel={(e) => this.handleCancel(e)}
125
-        >
126
-          <Button type="primary" name="admin.taShareChildRecord.export.get" noRight={null} onClick={() => this.exportChildRecord({ ...this.props.visibleData, pageNumber: 1, pageSize: 5 })} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
127
-            导出
128
-          </Button>
129
-
130
-          <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
131
-        </Modal>
132
-      </>
133
-    );
134
-  }
135
-}
136
-
137
-
138
-/**
139
- * 核销弹框
140
- */
141
-class Verifier extends React.Component {
142
-  constructor(props) {
143
-    super(props);
144
-    this.state = {
145
-      groupActivityId: { id: '' },
146
-      visibleData: { visible: false, groupActivityId: '', recordId: '' },
147
-    }
148
-  }
149
-
150
-  // 挂载之后
151
-  componentDidMount() {
152
-    const { groupActivityId } = this.state.visibleData
153
-  }
154
-
155
-  componentDidUpdate(preProps, preState) {
156
-    const { groupActivityId } = this.state.visibleData
157
-    console.log('this.state.visibleData', this.state.visibleData)
158
-    if (this.props.visibleData.visible !== preState.visibleData.visible) {
159
-      this.setState({ visibleData: this.props.visibleData });
160
-    }
161
-  }
162
-
163
-  // 弹框确定按钮
164
-  handleOk() {
165
-  }
166
-
167
-  // 弹框取消按钮
168
-  handleCancel() {
169
-    this.props.onSuccess({ groupActivityId: this.props.visibleData.groupActivityId, groupStatus: 0 });
170
-  }
171
-
172
-  getVerCodeList(params) {
173
-    request({ ...apis.groupActivity.verification, params: { ...params } }).then(res => {
174
-      message.info('核销成功')
175
-      this.props.onSuccess({ groupActivityId: this.state.visibleData.groupActivityId, groupStatus: 0 });
176
-    }).catch(err => {
177
-      <Alert
178
-        style={{
179
-          marginBottom: 24,
180
-        }}
181
-        message={err}
182
-        type="error"
183
-        showIcon
184
-      />
185
-    })
186
-  }
187
-
188
-  verify(e) {
189
-    this.setState({ visibleData: { visible: true, groupActivityId: this.props.visibleData.groupActivityId, verificationCode: e.target.value, recordId: this.state.visibleData.recordId } })
190
-  }
191
-
192
-  // eslint-disable-next-line class-methods-use-this
193
-  verification(e) {
194
-    console.log("asdasdasdasd", this.state.visibleData);
195
-    this.getVerCodeList({ groupActivityId: this.state.visibleData.groupActivityId, verifyCode: this.state.visibleData.verificationCode, recordId: this.state.visibleData.recordId })
196
-  }
197
-
198
-  render() {
199
-    return (
200
-      <>
201
-        <Modal
202
-          title="核销"
203
-          destroyOnClose="true"
204
-          width={300}
205
-          footer={null}
206
-          visible={this.state.visibleData.visible}
207
-          // onOk={() => this.handleOk()}
208
-          onCancel={(e) => this.handleCancel(e)}
209
-        >
210
-          <div><span>核销码:<input style={{ marginLeft: '10px' }} onChange={this.verify.bind(this)} /></span>
211
-            <Button name="admin.taShareRecord.verificate.put" noRight={null} style={{ marginLeft: '80px', marginTop: '10px', backgroundColor: 'red' }} onClick={() => this.verification()}><span style={{ color: 'white' }}>立即核销</span></Button>
212
-          </div>
213
-        </Modal>
214
-      </>
215
-    );
216
-  }
217
-}
218
-
219
-/**
220
- *主体列表
221
- *
222
- * @param {*} props
223
- * @returns
224
- */
225
-function body(props) {
226
-  const [gInviteData, setGInviteData] = useState({ visible: false, groupActivityId: '', recordId: '', groupStatus: '' })
227
-
228
-  const [gVerifierData, setVerifierData] = useState({ visible: false, groupActivityId: '', verificateCode: '', recordId: '' })
229
-
230
-  const { getFieldDecorator, getFieldsValue } = props.form
231
-
232
-  // eslint-disable-next-line react-hooks/rules-of-hooks
233
-  const [dataSource, setDataSource] = useState({ records: [] })
234
-  // eslint-disable-next-line react-hooks/rules-of-hooks
235
-  // const [columns, setColumns] = useState(privateColumns)
236
-
237
-  // 默认成功
238
-  // eslint-disable-next-line react-hooks/rules-of-hooks
239
-  const [groupStatus, setgroupStatus] = useState('0')
240
-
241
-  // 调整归属 ============  start
242
-  // eslint-disable-next-line react-hooks/rules-of-hooks
243
-  const [gVisibleData, setGVisibleData] = useState({ visible: false })
244
-
245
-
246
-  // 变更状态 ============= end
247
-
248
-  // eslint-disable-next-line react-hooks/rules-of-hooks
249
-  const { groupActivityId } = props.location.query
250
-  useEffect(() => {
251
-    getList({ pageNumber: 1, pageSize: 10, groupStatus: groupStatus, groupActivityId: groupActivityId })
252
-  }, [])
253
-
254
-
255
-  function getFailList(params) {
256
-    // 网路请求
257
-    request({ ...apis.groupActivity.shareFailList, params: { ...params } }).then(res => {
258
-      console.log(res);
259
-      setDataSource(res)
260
-    }).catch(err => {
261
-      // eslint-disable-next-line no-unused-expressions
262
-      <Alert
263
-        style={{
264
-          marginBottom: 24,
265
-        }}
266
-        message={err}
267
-        type="error"
268
-        showIcon
269
-      />
270
-    })
271
-  }
272
-
273
-  function getList(params) {
274
-    console.log(params);
275
-    // 网路请求
276
-    request({ ...apis.groupActivity.shareSuccList, params: { ...params } }).then(res => {
277
-      console.log("process");
278
-      setDataSource(res)
279
-    }).catch(err => {
280
-      // eslint-disable-next-line no-unused-expressions
281
-      <Alert
282
-        style={{
283
-          marginBottom: 24,
284
-        }}
285
-        message={err}
286
-        type="error"
287
-        showIcon
288
-      />
289
-    })
290
-  }
291
-
292
-  function displayNone() {
293
-    setGVisibleData({ visible: false })
294
-  }
295
-
296
-  // 提交事件
297
-  function handleSubmit(e) {
298
-    displayNone()
299
-
300
-
301
-    e.preventDefault();
302
-    props.form.validateFields((err, values) => {
303
-      if (!err) {
304
-        getList({ pageNum: 1, pageSize: 10, groupStatus, ...values, groupActivityId })
305
-      }
306
-    });
307
-  }
308
-
309
-  // Change 事件
310
-  function handleSelectChange(e) {
311
-    // eslint-disable-next-line no-console
312
-    console.log(e)
313
-  }
314
-
315
-  // 分页
316
-  function onChange(pageNum) {
317
-    // eslint-disable-next-line react-hooks/rules-of-hooks
318
-    getList({ pageNumber: pageNum, pageSize: 10, groupStatus, groupActivityId: groupActivityId, ...props.form.getFieldsValue() })
319
-  }
320
-
321
-  // 助力成功/进行中/助力失败
322
-  function radioButtonHandleSizeChange(e) {
323
-    setGInviteData({ visible: false })
324
-    displayNone()
325
-
326
-    const { value } = e.target
327
-    setgroupStatus(value)
328
-    if (value == 0) {
329
-      getList({ pageNumber: 1, pageSize: 10, groupStatus: value, groupActivityId: groupActivityId, ...props.form.getFieldsValue() })
330
-    }
331
-    if (value == 1 || value == 2) {
332
-      getFailList({ pageNumber: 1, pageSize: 10, groupStatus: value, groupActivityId: groupActivityId, ...props.form.getFieldsValue() })
333
-    }
334
-  }
335
-
336
-  function handleReset() {
337
-    props.form.resetFields();
338
-    getList({ pageNumber: 1, pageSize: 10, groupStatus, groupActivityId: groupActivityId })
339
-  }
340
-
341
-  function toCustomerDateil(record) {
342
-    router.push({
343
-      pathname: '/customer/customerlist/customerDetail',
344
-      query: {
345
-        id: record.customerId,
346
-      },
347
-    });
348
-  }
349
-
350
-  function download(data) {
351
-    if (!data) {
352
-      return
353
-    }
354
-    const url = window.URL.createObjectURL(new Blob([data]))
355
-    const link = document.createElement('a')
356
-    link.style.display = 'none'
357
-    link.href = url
358
-    link.setAttribute('download', '拼团列表.xlsx')
359
-    document.body.append(link)
360
-    link.click()
361
-  }
362
-
363
-  function exportRecord() {
364
-    request({ ...apis.groupActivity.exportShareRecord, responseType: 'blob', params: { groupActivityId: groupActivityId, groupStatus: groupStatus } })
365
-      .then(response => {
366
-        download(response)
367
-      }).catch(error => {
368
-
369
-      })
370
-  }
371
-
372
-  // 助力记录弹框
373
-  function helpRecord(row) {
374
-    // 关闭核销
375
-    // eslint-disable-next-line max-len
376
-    setVerifierData({ visible: false, groupActivityId: row.groupActivityId, groupStatus: 0 })
377
-    // eslint-disable-next-line max-len
378
-    setGInviteData({ visible: true, groupActivityId: row.groupActivityId, groupStatus: row.status, recordId: row.recordId })
379
-  }
380
-  // 打开核销
381
-  function shareRecordVerify(row) {
382
-    setVerifierData({ visible: true, groupActivityId: row.groupActivityId, groupStatus: 0, recordId: row.recordId })
383
-    setGInviteData({ visible: false, groupActivityId: row.groupActivityId })
384
-  }
385
-
386
-  function onSuccess(e) {
387
-    setVerifierData({ visible: false, groupActivityId: e.groupActivityId, groupStatus: 0 })
388
-    getList({ pageNumber: 1, pageSize: 10, ...e });
389
-  }
390
-
391
-  function returnList(params) {
392
-    router.push({
393
-      pathname: '/activity/groupActivity/list',
394
-    });
395
-  }
396
-
397
-  const publicColumns = [
398
-    {
399
-      title: '开团者',
400
-      dataIndex: 'nickname',
401
-      key: 'nickname',
402
-      align: 'center',
403
-      width: '15%',
404
-    },
405
-    {
406
-      title: '开团者手机号',
407
-      dataIndex: 'phone',
408
-      key: 'phone',
409
-      align: 'center',
410
-      width: '10%',
411
-    },
412
-    {
413
-      title: '开团时间',
414
-      dataIndex: 'createTime',
415
-      key: 'createTime',
416
-      align: 'center',
417
-      width: '15%',
418
-      render: (x, row) => <><span>{row.createTime ? `${moment(row.createTime).format('YYYY-MM-DD HH:mm:ss')}` : ''}</span></>,
419
-    },
420
-    {
421
-      title: '参团者',
422
-      dataIndex: 'helpCount',
423
-      key: 'helpCount',
424
-      align: 'center',
425
-      width: '15%',
426
-      render: (text, record) => <a style={{ color: '#66B3FF' }} onClick={() => helpRecord(record)}>{record.joinPeople === null ? 0 : record.joinPeople}/{record.groupBuyPeople}</a>,
427
-    },
428
-  ]
429
-
430
-  const privateColumns = [
431
-    {
432
-      title: '拼团者',
433
-      dataIndex: 'nickname',
434
-      key: 'nickname',
435
-      align: 'center',
436
-      width: '15%',
437
-    },
438
-    {
439
-      title: '拼团者手机号',
440
-      dataIndex: 'phone',
441
-      key: 'phone',
442
-      align: 'center',
443
-      width: '10%',
444
-    },
445
-    {
446
-      title: '拼团时间',
447
-      dataIndex: 'createTime',
448
-      key: 'createTime',
449
-      align: 'center',
450
-      width: '10%',
451
-      render: (x, row) => <><span>{row.createTime ? `${moment(row.createTime).format('YYYY-MM-DD HH:mm:ss')}` : ''}</span></>
452
-    },
453
-    {
454
-      title: '成团时间',
455
-      dataIndex: 'endTime',
456
-      key: 'endTime',
457
-      align: 'center',
458
-      width: '10%',
459
-      render: (x, row) => <><span>{row.endTime ? `${moment(row.endTime).format('YYYY-MM-DD HH:mm:ss')}` : ''}</span></>
460
-    },
461
-    {
462
-      title: '核销状态',
463
-      dataIndex: 'verificationStatus',
464
-      key: 'verificationStatus',
465
-      align: 'center',
466
-      width: '10%',
467
-      // eslint-disable-next-line no-nested-ternary
468
-      render: (text, records) => {
469
-        if (records.verificationStatus === 0) { return '未核销' }
470
-        if (records.verificationStatus === 1) { return '已核销' }
471
-      },
472
-    },
473
-    {
474
-      title: '操作',
475
-      dataIndex: 'customerId',
476
-      key: 'customerId',
477
-      align: 'center',
478
-      width: '25%',
479
-      render: (x, row) => (
480
-        <>
481
-          {row.verificationStatus === 0 &&
482
-            <AuthButton name="admin.taShare.writeOff" noRight={null}>
483
-              <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={(e) => shareRecordVerify(row)}>核销</span>
484
-            </AuthButton>
485
-          }
486
-        </>
487
-      ),
488
-    },
489
-  ]
490
-
491
-
492
-  const changePageNum = pageNumber => {
493
-    getList({ pageNum: pageNumber, pageSize: 10 })
494
-  }
495
-
496
-  return (
497
-    <>
498
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
499
-        <Form.Item>
500
-          {getFieldDecorator('phone')(
501
-            <Input
502
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
503
-              placeholder="电话"
504
-            />,
505
-          )}
506
-        </Form.Item>
507
-        <Form.Item>
508
-          <Button type="primary" htmlType="submit" >
509
-            搜索
510
-            </Button>
511
-          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
512
-            重置
513
-            </Button>
514
-        </Form.Item>
515
-        <Button style={{ float: 'right' }} onClick={returnList}>
516
-          返回
517
-        </Button>
518
-      </Form>
519
-      <Button name="admin.taShareRecord.export.get" noRight={null} type="primary" onClick={() => exportRecord()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
520
-        导出
521
-      </Button>
522
-
523
-      <div style={{ margin: '20px 0' }}>
524
-        <AuthButton name="admin.taShareSuccessRecord.get" noRight={null}>
525
-          <Radio.Group value={groupStatus} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
526
-            <Radio.Button value="0">拼团成功</Radio.Button>
527
-            <Radio.Button value="1">进行中</Radio.Button>
528
-            <Radio.Button value="2">拼团失败</Radio.Button>
529
-          </Radio.Group>
530
-        </AuthButton>
531
-      </div>
532
-
533
-      {groupStatus === '0' ?
534
-        <Table dataSource={dataSource.records} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
535
-        <Table dataSource={dataSource.records} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" />
536
-      }
537
-      <InviteTable visibleData={gInviteData} />
538
-      {/* 核销 */}
539
-      <Verifier visibleData={gVerifierData} onSuccess={(e) => onSuccess(e)} />
540
-    </>
541
-  );
542
-}
543
-
544
-const WrappedBody = Form.create({ name: 'body' })(body);
545
-
546
-export default WrappedBody

+ 0
- 377
src/pages/activity/groupActivity/list.jsx Parādīt failu

@@ -1,377 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Typography, Pagination, Modal } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import AuthButton from '@/components/AuthButton';
6
-import withActions from '@/components/ActionList';
7
-import EditIcon from '@/components/EditIcon';
8
-import Navigate from '@/components/Navigate';
9
-import Prompt from 'umi/prompt';
10
-import SelectCity from '../../../components/SelectButton/CitySelect'
11
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
12
-import apis from '../../../services/apis';
13
-import request from '../../../utils/request';
14
-import styles from '../../style/GoodsList.less';
15
-
16
-const { Option } = Select;
17
-
18
-const header = props => {
19
-  const [data, setData] = useState({})
20
-  //   const [page, changePage] = useState({})
21
-
22
-  useEffect(() => {
23
-    if (localStorage.getItem("groupActivePageParams")) {
24
-      props.form.setFieldsValue(JSON.parse(localStorage.getItem("groupActivePageParams")));
25
-      // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
26
-
27
-      getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
28
-    } else {
29
-      localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
30
-      getList({ pageNum: 1, pageSize: 10 });
31
-    }
32
-
33
-  }, [])
34
-
35
-  // 查询列表
36
-  const getList = (params) => {
37
-    console.log(params);
38
-    request({ ...apis.groupActivity.list, params: { ...params } }).then((data) => {
39
-      console.log(data)
40
-      setData(data)
41
-    })
42
-  }
43
-
44
-
45
-  // 跳转到拼团活动新增
46
-  const toEditActivity = (groupActivityId) => () => {
47
-    router.push({
48
-      pathname: '/activity/groupActivity/editGroupActivity',
49
-      query: {
50
-        groupActivityId
51
-      },
52
-    });
53
-  }
54
-
55
-  const getActivityDetail = (groupActivityId) => () => {
56
-    router.push({
57
-      pathname: '/activity/groupActivity/detailActivity',
58
-      query: {
59
-        groupActivityId,
60
-      },
61
-    });
62
-  }
63
-
64
-  const getJoinPeople = (groupActivityId) => () => {
65
-    router.push({
66
-      pathname: '/activity/groupActivity/helpRecord',
67
-      query: {
68
-        groupActivityId,
69
-      },
70
-    });
71
-  }
72
-
73
-  const toDataReacord = id => {
74
-    router.push({
75
-      pathname: '/activity/groupActivity/groupActivityRecord',
76
-      query: {
77
-        id,
78
-      },
79
-    });
80
-  }
81
-
82
-  /**
83
-   *
84
-   *
85
-   * @param {*} props
86
-   * @returns
87
-   */
88
-
89
-  const columns = [
90
-    {
91
-      title: '活动标题',
92
-      dataIndex: 'activityName',
93
-      key: 'activityName',
94
-      align: 'center',
95
-      render: (x, row) => <Navigate onClick={getActivityDetail(row.groupActivityId)}><Typography.Text ellipsis>{row.activityName}</Typography.Text></Navigate>,
96
-    },
97
-    {
98
-      title: '活动时间',
99
-      dataIndex: 'startTime',
100
-      key: 'startTime',
101
-      align: 'center',
102
-      render: (x, row) => <><span>{`${moment(row.startTime).format('YYYY-MM-DD HH:mm:ss')} —— ${moment(row.endTime).format('YYYY-MM-DD HH:mm:ss')}`}</span></>
103
-    },
104
-    {
105
-      title: '所需积分',
106
-      dataIndex: 'integral',
107
-      key: 'integral',
108
-      align: 'center',
109
-    },
110
-    {
111
-      title: '已参与人数',
112
-      dataIndex: 'participateNum',
113
-      key: 'participateNum',
114
-      align: 'center',
115
-      render: (x, row) => <><div style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: '201px', title: 'content' }}>
116
-        <Navigate onClick={getJoinPeople(row.groupActivityId)}>{row.participateNum}</Navigate>
117
-        </div></>,
118
-    },
119
-    {
120
-      title: '成团数',
121
-      dataIndex: 'groupBuyPeople',
122
-      key: 'groupBuyPeople',
123
-      align: 'center',
124
-    },
125
-    {
126
-      title: '状态',
127
-      dataIndex: 'activityStatus',
128
-      key: 'activityStatus',
129
-      align: 'center',
130
-      render: (text, records) => {
131
-        if (records.activityStatus === 0) { return '进行中' }
132
-        if (records.activityStatus === 1) { return '未开始' }
133
-        if (records.activityStatus === 2) { return '已结束' }
134
-      },
135
-    },
136
-    {
137
-      title: '权重',
138
-      dataIndex: 'heavy',
139
-      key: 'heavy',
140
-      align: 'center',
141
-    },
142
-    {
143
-      title: '操作',
144
-      dataIndex: 'handle',
145
-      key: 'handle',
146
-      align: 'center',
147
-      width: 400,
148
-      render: withActions((x, row) => [
149
-
150
-        <EditIcon type="look" text="查看详情" onClick={getActivityDetail(row.groupActivityId)} />,
151
-
152
-        row.activityStatus === 0 ?
153
-          <AuthButton name="admin.taShareActivity.finish.put" noRight={null}>
154
-            <EditIcon type="end" text="结束活动" onClick={endGroupActivity(row)} />
155
-          </AuthButton> : null,
156
-
157
-          <AuthButton name="admin.taShareActivity.publish" noRight={null}>
158
-            <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '取消发布' : '发布'} onClick={sendOrPublicDynamic.bind(this, row)} />
159
-          </AuthButton>,
160
-
161
-          <AuthButton name="admin.taShareActivity.tag" noRight={null}>
162
-            <EditIcon type={row.weight === 1 ? 'cancel' : 'add'} text={row.weight === 1 ? '取消标签' : '添加标签'} onClick={topGroupActivity(row, row.weight)} />
163
-          </AuthButton>,
164
-            
165
-          <AuthButton name="admin.taShareActivity.top" noRight={null}>
166
-            <EditIcon type={row.sort ? 'cancel' : 'top'} text={row.sort ? '取消推首页' : '推荐首页'} onClick={recommendGroupActivity(row)} />
167
-          </AuthButton>,
168
-
169
-          <AuthButton name="admin.groupActivity.dataRecord" noRight={null}>
170
-            <EditIcon type="record" text="数据记录" onClick={() => toDataReacord(row.groupActivityId)} />
171
-          </AuthButton>,
172
-
173
-          (row.activityStatus === 0 || row.activityStatus === 1) ?
174
-            <AuthButton name="admin.taShareActivity.update.put" noRight={null}>
175
-              <EditIcon type="edit" text="编辑" onClick={toEditActivity(row.groupActivityId)} />
176
-            </AuthButton> : null,
177
-      ]),
178
-    },
179
-  ];
180
-
181
-  const finishDynamic = (row) => {
182
-    Modal.confirm({
183
-      title: '结束以后将无法编辑, 是否继续?',
184
-      okText: '确定',
185
-      cancelText: '取消',
186
-      onOk() {
187
-        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: "" } }).then((data) => {
188
-          console.log(data)
189
-          message.info('操作成功!')
190
-          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
191
-        }).catch((err) => {
192
-          console.log(err)
193
-          message.info(err.msg || err.message)
194
-        })
195
-      },
196
-    });
197
-  }
198
-
199
-  //结束活动
200
-  const endGroupActivity = (row) => () => {
201
-    Modal.confirm({
202
-      title: '活动会被强制结束,小程序端无法再发起或参与此拼团,如果不想让客户看到活动,请再点击取消发布按钮',
203
-      okText: '确定',
204
-      cancelText: '取消',
205
-      onOk() {
206
-        request({ ...apis.groupActivity.finish, urlData: { id: row.groupActivityId } }).then((data) => {
207
-          console.log(data)
208
-          message.info('操作成功!')
209
-          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
210
-        }).catch((err) => {
211
-          console.log(err)
212
-          message.info(err.msg || err.message)
213
-        })
214
-      },
215
-    });
216
-  }
217
-
218
-  //置顶
219
-  const topGroupActivity = (row, weight) => () => {
220
-    request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, weight: weight } }).then((data) => {
221
-      console.log(data)
222
-      message.info('操作成功!')
223
-      getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
224
-    }).catch((err) => {
225
-      console.log(err)
226
-      message.info(err.msg || err.message)
227
-    })
228
-  }
229
-
230
-  const sendOrPublicDynamic = row => {
231
-    if (row.status === 1) {
232
-      cancelDynamic(row)
233
-    } else {
234
-      sendDynamic(row)
235
-    }
236
-  }
237
-
238
-  // 取消活动
239
-  const cancelDynamic = row => {
240
-    Modal.confirm({
241
-      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
242
-      okText: '确认',
243
-      cancelText: '取消',
244
-      onOk() {
245
-        request({ ...apis.groupActivity.cancel, urlData: { id: row.groupActivityId } }).then(data => {
246
-          message.info('操作成功!')
247
-          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
248
-        }).catch(err => {
249
-          console.log(err)
250
-          message.info(err.msg || err.message)
251
-        })
252
-      }
253
-    });
254
-  }
255
-
256
-  // 发布活动
257
-  const sendDynamic = row => {
258
-    Modal.confirm({
259
-      title: '确定发布吗?',
260
-      okText: '确认',
261
-      cancelText: '取消',
262
-      onOk() {
263
-        request({ ...apis.groupActivity.send, urlData: { id: row.groupActivityId } }).then(data => {
264
-          message.info('操作成功!')
265
-          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
266
-        }).catch(err => {
267
-          console.log(err)
268
-          message.info(err.msg || err.message)
269
-        })
270
-      }
271
-    });
272
-  }
273
-
274
-  //首页推荐
275
-  const recommendGroupActivity = (row, code) => () => {
276
-    request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, sort: row.sort } }).then((data) => {
277
-      console.log(data)
278
-      message.info('操作成功!')
279
-      getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
280
-    }).catch((err) => {
281
-      console.log(err)
282
-      message.info(err.msg || err.message)
283
-    })
284
-  }
285
-
286
-  const changePageNum = pageNumber => {
287
-    localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() }));
288
-
289
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
290
-  }
291
-
292
-  // 提交事件
293
-  const handleSubmit = (e, props) => {
294
-    e.preventDefault();
295
-    props.form.validateFields((err, values) => {
296
-      if (!err) {
297
-        console.log('提交数据: ', values)
298
-        localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10, ...values }));
299
-        getList({ pageNum: 1, pageSize: 10, ...values })
300
-      }
301
-    });
302
-  }
303
-
304
-  //重置搜索
305
-  function handleReset() {
306
-    props.form.resetFields();
307
-    localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
308
-    getList({ pageNum: 1, pageSize: 10 })
309
-  }
310
-
311
-
312
-  const { getFieldDecorator } = props.form
313
-  return (
314
-
315
-    <>
316
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
317
-        <Form.Item>
318
-          {getFieldDecorator('cityId')(
319
-            <SelectCity />,
320
-          )}
321
-        </Form.Item>
322
-        <Form.Item>
323
-          {getFieldDecorator('buildingId')(
324
-            <BuildSelect />,
325
-          )}
326
-        </Form.Item>
327
-        <Form.Item>
328
-          {getFieldDecorator('activityName')(
329
-            <Input
330
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
331
-              placeholder="请输入标题"
332
-            />,
333
-          )}
334
-        </Form.Item>
335
-        <Form.Item>
336
-          {getFieldDecorator('activityStatus')(
337
-            <Select style={{ width: '180px' }} placeholder="活动状态">
338
-              <Option value="0">进行中</Option>
339
-              <Option value="1">未开始</Option>
340
-              <Option value="2">已结束</Option>
341
-            </Select>,
342
-          )}
343
-        </Form.Item>
344
-        <Form.Item>
345
-          <AuthButton name="admin.taShareActivity.search" noRight={null}>
346
-            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
347
-              搜索
348
-          </Button>
349
-          </AuthButton>
350
-          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
351
-            重置
352
-            </Button>
353
-        </Form.Item>
354
-      </Form>
355
-      <AuthButton name="admin.taShareActivity.post" noRight={null}>
356
-        <Button type="danger" className={styles.addBtn} onClick={toEditActivity()}>新增</Button>
357
-      </AuthButton>
358
-      <Table
359
-        // onRow={record => {
360
-        //     return {
361
-        //       onClick: getActivityDetail(record.groupActivityId),
362
-        //     };
363
-        //   }}
364
-        style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
365
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
366
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
367
-      </div>
368
-      <Prompt message={location =>
369
-        location.pathname.startsWith("/activity/groupActivity")
370
-          ? true
371
-          : localStorage.removeItem("groupActivePageParams")} />
372
-    </>
373
-  )
374
-}
375
-const WrappedHeader = Form.create({ name: 'header' })(header);
376
-
377
-export default WrappedHeader

src/pages/activity/helpActivity/detailActivity.jsx → src/pages/activity/groupRoomActivity/detail.jsx Parādīt failu

@@ -1,21 +1,17 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../../style/GoodsList.less';
5
-import apis from '../../../services/apis';
2
+import { Form, Input, Button, Icon, Select, Card, Radio, DatePicker, message, Upload } from 'antd';
3
+
4
+import apis from '@/services/apis';
6 5
 import moment from 'moment';
7 6
 import router from 'umi/router';
8
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
-import XForm, { FieldTypes } from '../../../components/XForm';
10
-import Wangedit from '../../../components/Wangedit/Wangedit'
11
-import request from '../../../utils/request'
12
-import yinhao from '../../../assets/yinhao.png'
13
-import ImageUploader from '../../../components/XForm/ImageUpload';
14
-import logo from '../../../assets/logo.svg';
15
-import touxiang from '../../../assets/touxiang.jpg';
16
-import poster1 from '../../../assets/poster1.png';
17
-import poster2 from '../../../assets/poster2.png';
18
-import xiaochengxu from '../../../assets/xiaochengxu.png';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect'
8
+import request from '@/utils/request'
9
+import yinhao from '@/assets/yinhao.png'
10
+import logo from '@/assets/logo.svg';
11
+import touxiang from '@/assets/touxiang.jpg';
12
+import poster1 from '@/assets/poster1.png';
13
+import poster2 from '@/assets/poster2.png';
14
+import xiaochengxu from '@/assets/xiaochengxu.png';
19 15
 import AuthButton from '@/components/AuthButton';
20 16
 import Prompt from 'umi/prompt';
21 17
 
@@ -28,26 +24,42 @@ const formItemLayout = {
28 24
 };
29 25
 
30 26
 const cancelPage = () => {
31
-  router.push({
32
-    pathname: '/activity/helpActivity/list',
33
-  });
27
+  router.go('-1')
34 28
 }
35 29
 
36
-const getSignList = helpActivityId => {
30
+const getSignList = dynamicId => {
37 31
   router.push({
38
-    pathname: '/activity/helpActivity/signList',
32
+    pathname: '/activity/SignList',
39 33
     query: {
40
-      helpActivityId,
34
+      dynamicId,
41 35
     },
42 36
   });
43 37
 }
44 38
 
45
-const BasicForm = props => {
39
+const newQrcode = row => {
40
+  const x = new XMLHttpRequest();
41
+  const resourceUrl = row.qrCode
42
+  x.open('GET', resourceUrl, true);
43
+  x.responseType = 'blob';
44
+  x.onload = function (e) {
45
+    const url = window.URL.createObjectURL(x.response)
46
+    const a = document.createElement('a');
47
+    a.href = url;
48
+    a.style.display = 'none'
49
+    a.download = '活动二维码.png';
50
+    a.click();
51
+  }
52
+  x.send();
53
+}
46 54
 
55
+const BasicForm = props => {
47 56
   const detailData = props.detailData || {}
48 57
 
49
-  const { helpActivityId } = props
58
+  const radioOnChange = e => {
59
+    // setIsEnlist(e.target.value)
60
+  }
50 61
 
62
+  const { dynamicId } = props
51 63
   const handleSubmit = e => {
52 64
     e.preventDefault();
53 65
     props.form.validateFields((err, values) => {
@@ -62,23 +74,22 @@ const BasicForm = props => {
62 74
           values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
63 75
           values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
64 76
         }
65
-
66 77
         console.log('submit data --->', values)
67
-        if (helpActivityId) {
68
-          values.helpActivityId = helpActivityId
69
-          request({ ...apis.helpActivity.update, data: values }).then(data => {
78
+        if (dynamicId) {
79
+          values.dynamicId = dynamicId
80
+          request({ ...apis.activity.update, data: values }).then(data => {
70 81
             message.info('保存成功')
71 82
             // router.go(-1)
72 83
           }).catch((err) => {
73 84
             message.info(err.msg || err.message)
74 85
           })
75 86
         } else {
76
-          request({ ...apis.helpActivity.add, data: { ...values } }).then((data) => {
87
+          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
77 88
             message.info('保存成功')
78 89
             router.push({
79
-              pathname: '/activity/helpActivity/edithelpActivity',
90
+              pathname: '/activity/editActivity',
80 91
               query: {
81
-                helpActivityId: data.helpActivityId,
92
+                dynamicId: data.dynamicId,
82 93
               },
83 94
             });
84 95
             // router.go(-1)
@@ -105,29 +116,44 @@ const BasicForm = props => {
105 116
             ],
106 117
           })(<BuildSelect disabled />)}
107 118
         </Form.Item>
119
+        <Form.Item label="活动封面图1">
120
+          <img src={detailData.listImgUrl} height="210px" width="375px" />
121
+        </Form.Item>
122
+        <Form.Item label="活动封面图2">
123
+          <img src={detailData.bannerListImg} height="125px" width="375px" />
124
+        </Form.Item>
125
+        <Form.Item label="活动详情主图">
126
+          <img src={detailData.imgUrl} height="300px" width="375px" />
127
+        </Form.Item>
108 128
         <Form.Item label="活动标题">
109 129
           <span>{detailData.title}</span>
110 130
         </Form.Item>
111
-        <Form.Item label="助力详情主图">
112
-          <img src={detailData.img} height="300px" width="375px" />
131
+        <Form.Item label="活动时间">
132
+          <span>{`${moment(detailData.startDate).format('YYYY-MM-DD HH:mm')} —— ${moment(detailData.endDate).format('YYYY-MM-DD HH:mm')}`}</span>
113 133
         </Form.Item>
114
-        <Form.Item label="助力封面图1">
115
-          <img src={detailData.listImg} height="210px" width="375px" />
134
+        <Form.Item label="活动地点">
135
+          <span>{detailData.address}</span>
116 136
         </Form.Item>
117
-        <Form.Item label="助力封面图2">
118
-          <img src={detailData.bannerListImg} height="125px" width="375px" />
119
-        </Form.Item>
120
-        <Form.Item label="助力邀请人数">
137
+        <Form.Item label="活动人数">
121 138
           <span>{detailData.personNum}</span>
122 139
         </Form.Item>
123
-        <Form.Item label="助力次数">
124
-          <span>{detailData.helpNum === 0 ? '不限' : detailData.helpNum}</span>
140
+        <Form.Item label="阅读量">
141
+          <span>{detailData.pvNum}</span>
125 142
         </Form.Item>
126
-        <Form.Item label="活动时间">
127
-          <span>{`${moment(detailData.startDate).format('YYYY-MM-DD HH:mm:ss')} —— ${moment(detailData.endDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>
143
+        <Form.Item label="转发量">
144
+          <span>{detailData.shareNum}</span>
145
+        </Form.Item>
146
+        <Form.Item label="收藏数">
147
+          <span>{detailData.saveNum}</span>
148
+        </Form.Item>
149
+        <Form.Item label="最大报名人数">
150
+          <span>{detailData.maxEnlistByPerson}</span>
128 151
         </Form.Item>
129
-        <Form.Item label="活动说明">
130
-          <img src={detailData.activityInstructions} height="300px" width="375px" />
152
+        <Form.Item label="活动详情">
153
+          <div style={{ maxHeight: '500px', overflowY: 'auto' }} dangerouslySetInnerHTML={{ __html: detailData.desc }}></div>
154
+        </Form.Item>
155
+        <Form.Item label="报名时间">
156
+          <span>{`${moment(detailData.enlistStart).format('YYYY-MM-DD HH:mm')} —— ${moment(detailData.enlistEnd).format('YYYY-MM-DD HH:mm')}`}</span>
131 157
         </Form.Item>
132 158
         <Form.Item label="权重">
133 159
           <span>{detailData.heavy}</span>
@@ -139,18 +165,17 @@ const BasicForm = props => {
139 165
 
140 166
 const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
141 167
 
142
-
143 168
 const Poster = (props) => {
144
-  const { helpActivityId } = props
169
+  const { dynamicId } = props
145 170
   const [inputValue, changeInput] = useState('')
146 171
   const [textAreaValue, changeTextArea] = useState('')
147 172
   const [imgValue, changeImg] = useState('')
148 173
   const [posterId, setPosterId] = useState('')
149 174
 
150
-  if (helpActivityId) {
151
-    console.log(helpActivityId, 'helpActivityId')
175
+  if (dynamicId) {
176
+    console.log(dynamicId, 'dynamicId')
152 177
     useEffect(() => {
153
-      request({ ...apis.activity.poster, params: { targetId: helpActivityId, targetType: 'helpActivity' } }).then((data) => {
178
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
154 179
         console.log(data, "2222")
155 180
         if (data.length > 0) {
156 181
           setPosterId(data[0].posterId)
@@ -176,15 +201,15 @@ const Poster = (props) => {
176 201
   }
177 202
 
178 203
   const submitPoster = () => {
179
-    if (helpActivityId) {
204
+    if (dynamicId) {
180 205
       if (posterId) {
181
-        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: helpActivityId, targetType: 'helpActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
206
+        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
182 207
           message.info("保存成功")
183 208
         }).catch((err) => {
184 209
           message.info(err.msg || err.message)
185 210
         })
186 211
       } else {
187
-        request({ ...apis.activity.addPoster, data: { targetId: helpActivityId, targetType: 'helpActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
212
+        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
188 213
           setPosterId(data.posterId)
189 214
           message.info("保存成功")
190 215
         }).catch((err) => {
@@ -271,15 +296,16 @@ const Poster = (props) => {
271 296
 
272 297
 
273 298
 const Share = (props) => {
274
-  const { helpActivityId } = props
299
+  const { dynamicId } = props
300
+
275 301
   const [inputValue, changeInput] = useState('')
276 302
   const [imgValue, changeImg] = useState('')
277 303
   const [shareContentId, setShareContentId] = useState('')
278 304
 
279
-  if (helpActivityId) {
280
-    useEffect(() => {
281
-      request({ ...apis.activity.shareContent, params: { targetId: helpActivityId, targetType: 'helpActivity' }, }).then((data) => {
282
-        console.log(data, "2222")
305
+
306
+  useEffect(() => {
307
+    if (dynamicId) {
308
+      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' }, }).then((data) => {
283 309
         if (data.length > 0) {
284 310
           setShareContentId(data[0].shareContentId)
285 311
           changeImg(data[0].shareContentImg)
@@ -288,19 +314,20 @@ const Share = (props) => {
288 314
       }).catch((err) => {
289 315
         message.info(err.msg || err.message)
290 316
       })
291
-    }, [])
292
-  }
317
+    }
318
+  }, [])
319
+
293 320
 
294 321
   const submitShare = () => {
295
-    if (helpActivityId) {
322
+    if (dynamicId) {
296 323
       if (shareContentId) {
297
-        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: helpActivityId, shareContentType: 'helpActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
324
+        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
298 325
           message.info("保存成功")
299 326
         }).catch((err) => {
300 327
           message.info(err.msg || err.message)
301 328
         })
302 329
       } else {
303
-        request({ ...apis.activity.addShareContent, data: { targetId: helpActivityId, shareContentType: 'helpActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
330
+        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
304 331
           setShareContentId(data.shareContentId)
305 332
           message.info("保存成功")
306 333
         }).catch(err => {
@@ -344,12 +371,11 @@ const Share = (props) => {
344 371
  */
345 372
 const Edit = props => {
346 373
   const [tab, changeTab] = useState('basic')
347
-  const { helpActivityId } = props.location.query
374
+  const { dynamicId } = props.location.query
348 375
   const [detailData, setDetailData] = useState(false)
349 376
 
350
-  const getDynamicData = helpActivityId => {
351
-
352
-    request({ ...apis.helpActivity.details, params: { helpActivityId } }).then((data) => {
377
+  const getDynamicData = dynamicId => {
378
+    request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
353 379
       console.log(data)
354 380
       data.activityTime = [moment(data.startDate), moment(data.endDate)]
355 381
       data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
@@ -358,17 +384,18 @@ const Edit = props => {
358 384
     })
359 385
   }
360 386
 
361
-  useEffect(() => {
362
-
363
-    if (helpActivityId) {
364 387
 
365
-      getDynamicData(helpActivityId);
388
+  useEffect(() => {
389
+    if (dynamicId) {
390
+      getDynamicData(dynamicId);
366 391
     }
367 392
   }, [])
368 393
 
369 394
 
395
+  
396
+
370 397
   return (
371
-    <div>
398
+    <Card>
372 399
       <div>
373 400
         <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
374 401
           <Radio.Button value="basic">基本信息</Radio.Button>
@@ -377,28 +404,22 @@ const Edit = props => {
377 404
         </Radio.Group>
378 405
       </div>
379 406
       <div>
380
-        {tab === 'basic' && <Basic helpActivityId={helpActivityId} detailData={detailData} />}
381
-        {tab === 'poster' && <Poster helpActivityId={helpActivityId} />}
382
-        {tab === 'share' && <Share helpActivityId={helpActivityId} />}
407
+        {tab === 'basic' && <Basic dynamicId={dynamicId} detailData={detailData} />}
408
+        {tab === 'poster' && <Poster  dynamicId={dynamicId} />}
409
+        {tab === 'share' && <Share  dynamicId={dynamicId} />}
383 410
       </div>
384 411
       <div style={{ textAlign: 'center' }}>
385
-        <AuthButton name="admin.help.record" noRight={null}>
386
-          {(detailData.activityStatus === 0 || detailData.activityStatus === 2) &&
387
-            <span
388
-              style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }}
389
-              onClick={getSignList.bind(this, detailData.helpActivityId)}>
390
-              <Button>助力记录</Button>
391
-            </span>}
412
+        <AuthButton name="admin.SignList.get" noRight={null}>
413
+          {(detailData.activityStatus === 0 || detailData.activityStatus === 2) && <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, detailData.dynamicId)}><Button>报名记录</Button></span>}
414
+        </AuthButton>
415
+        <AuthButton name="admin.dymic.qrcode" noRight={null}>
416
+          {(detailData.activityStatus === 0 || detailData.activityStatus === 2) && <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={newQrcode.bind(this, detailData)}>{<Button>下载二维码</Button>}</span>}
392 417
         </AuthButton>
393 418
         <Button onClick={() => cancelPage()}>
394 419
           取消
395 420
           </Button>
396 421
       </div>
397
-      <Prompt message={location =>
398
-        location.pathname.startsWith("/activity/helpActivity")
399
-          ? true
400
-          : localStorage.removeItem("helpActivePageParams")} />
401
-    </div>
422
+    </Card>
402 423
   );
403 424
 }
404 425
 

+ 294
- 0
src/pages/activity/groupRoomActivity/edit/Basic.jsx Parādīt failu

@@ -0,0 +1,294 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, DatePicker, message } from 'antd';
3
+import router from 'umi/router';
4
+import apis from '@/services/apis';
5
+import moment from 'moment';
6
+import BuildSelect from '@/components/SelectButton/BuildSelect2';
7
+import Wangedit from '@/components/Wangedit/Wangedit';
8
+import request from '@/utils/request';
9
+import ImageUploader from '@/components/XForm/ImageUpload';
10
+
11
+const { RangePicker } = DatePicker;
12
+
13
+const formItemLayout = {
14
+  labelCol: { span: 6 },
15
+  wrapperCol: { span: 14 },
16
+};
17
+
18
+const cancelPage = () => {
19
+  router.go('-1');
20
+};
21
+
22
+const BasicForm = props => {
23
+  const [isEnlist, setIsEnlist] = useState(1);
24
+  const [activityStatus, setActivityStatus] = useState(1);
25
+  const [disable, setDisable] = useState(false);
26
+  const [data, setData] = useState(1);
27
+  const [showSignupTime, setShowSignupTime] = useState([]);
28
+
29
+  const radioOnChange = e => {
30
+    setIsEnlist(e.target.value);
31
+  };
32
+
33
+  const { dynamicId } = props;
34
+
35
+  // 查询详情
36
+  const getDynamicData = dynamicId => {
37
+    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
38
+      data.activityTime = [moment(data.startDate), moment(data.endDate)];
39
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)];
40
+      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
41
+      setData(data);
42
+      setIsEnlist(data.isEnlist);
43
+      setActivityStatus(data.activityStatus);
44
+      setDisable(data.activityStatus === 0);
45
+      props.form.setFieldsValue(data);
46
+    });
47
+  };
48
+
49
+  // eslint-disable-next-line react-hooks/rules-of-hooks
50
+  useEffect(() => {
51
+    props.form.setFieldsValue({ isEnlist });
52
+    if (dynamicId) {
53
+      getDynamicData(dynamicId);
54
+    }
55
+  }, []);
56
+  const checkTime = () => {
57
+    function compareDate(dateTime1, dateTime2) {
58
+      return new Date(dateTime1) > new Date(dateTime2);
59
+    }
60
+    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
61
+
62
+    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
63
+
64
+    // (3)修改后结束时间<当前时间:活动已结束
65
+    if (showSignupTime[0]) {
66
+      // const date = data.signupTime
67
+      const nowDate = new Date();
68
+      // console.log(compareDate(nowDate, showSignupTime[0]))
69
+      if (compareDate(nowDate, showSignupTime[0])) {
70
+        return true;
71
+      } else {
72
+        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)';
73
+      }
74
+    }
75
+    return true;
76
+  };
77
+
78
+  const handleSubmit = e => {
79
+    e.preventDefault();
80
+    props.form.validateFields((err, values) => {
81
+      if (!err) {
82
+        console.log('Received values of form: ', values);
83
+        const { activityTime, signupTime } = values;
84
+        const [startDate, endDate] = activityTime;
85
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
86
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
87
+        if (signupTime) {
88
+          const [enlistStart, enlistEnd] = signupTime;
89
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
90
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
91
+        }
92
+
93
+        console.log('submit data --->', values);
94
+        if (dynamicId) {
95
+          const checks = checkTime();
96
+          if (checks != true) {
97
+            message.info(checks);
98
+            return;
99
+          }
100
+          console.log(data.enlistNum, values.personNum, '143');
101
+
102
+          if (data.enlistNum > values.personNum) {
103
+            message.info('活动人数必须大于已报名人数');
104
+            return;
105
+          }
106
+
107
+          values.dynamicId = dynamicId;
108
+          request({ ...apis.activity.update, data: values })
109
+            .then(data => {
110
+              message.info('保存成功');
111
+              // router.go(-1)
112
+            })
113
+            .catch(err => {
114
+              message.info(err.msg || err.message);
115
+            });
116
+        } else {
117
+          request({ ...apis.activity.add, data: { ...values } })
118
+            .then(data => {
119
+              message.info('保存成功');
120
+              router.push({
121
+                pathname: '/activity/editActivity',
122
+                query: {
123
+                  dynamicId: data.dynamicId,
124
+                },
125
+              });
126
+              // router.go(-1)
127
+            })
128
+            .catch(err => {
129
+              message.info(err.msg || err.message);
130
+            });
131
+        }
132
+      }
133
+    });
134
+  };
135
+  const changeTime = (value, date) => {
136
+    // console.log(value, data, '-----checkTime---------')
137
+    // console.log(props.form.getFieldsValue(), '--------time1-----------')
138
+    // let datas = data
139
+    // console.log(value, date, datas)
140
+    // datas.signupTime = date
141
+
142
+    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
143
+
144
+    // console.log(datas,'-------datas--------')
145
+    //   props.form.setFieldsValue(data)
146
+    setShowSignupTime(date);
147
+    // props.form.setFieldsValue(datas)
148
+    // // form.setFieldsValue
149
+    // console.log('-------1--------')
150
+  };
151
+
152
+  const { getFieldDecorator } = props.form;
153
+  return (
154
+    <>
155
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
156
+        <Form.Item label="所属项目">
157
+          {getFieldDecorator('buildingId', {
158
+            rules: [
159
+              {
160
+                required: true,
161
+                message: '请选择所属项目',
162
+              },
163
+            ],
164
+          })(<BuildSelect disabled={disable} />)}
165
+        </Form.Item>
166
+        <Form.Item
167
+          label="活动封面图1"
168
+          help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表"
169
+        >
170
+          {getFieldDecorator('listImgUrl', {
171
+            rules: [
172
+              {
173
+                required: true,
174
+                message: '请选择活动封面图1',
175
+              },
176
+            ],
177
+          })(<ImageUploader />)}
178
+        </Form.Item>
179
+        <Form.Item
180
+          label="活动封面图2"
181
+          help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页"
182
+        >
183
+          {getFieldDecorator('bannerListImg', {
184
+            rules: [
185
+              {
186
+                required: true,
187
+                message: '请选择活动封面图2',
188
+              },
189
+            ],
190
+          })(<ImageUploader />)}
191
+        </Form.Item>
192
+        <Form.Item
193
+          label="活动详情主图"
194
+          help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情"
195
+        >
196
+          {getFieldDecorator('imgUrl', {
197
+            rules: [
198
+              {
199
+                required: true,
200
+                message: '请选择活动详情主图',
201
+              },
202
+            ],
203
+          })(<ImageUploader />)}
204
+        </Form.Item>
205
+        <Form.Item label="活动标题">
206
+          {getFieldDecorator('title', {
207
+            rules: [
208
+              {
209
+                required: true,
210
+                message: '请输入活动标题',
211
+              },
212
+            ],
213
+          })(<Input />)}
214
+        </Form.Item>
215
+        <Form.Item label="活动时间">
216
+          {getFieldDecorator('activityTime', {
217
+            rules: [
218
+              {
219
+                required: true,
220
+                message: '请选择活动时间',
221
+              },
222
+            ],
223
+          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
224
+        </Form.Item>
225
+        <Form.Item label="活动地点">
226
+          {getFieldDecorator('address', {
227
+            rules: [
228
+              {
229
+                required: true,
230
+                message: '请输入活动地点',
231
+              },
232
+            ],
233
+          })(<Input />)}
234
+        </Form.Item>
235
+        {/* disabled={activityStatus === 0 ? true : false} */}
236
+        <Form.Item label="活动人数" help="当前活动最多可报名人数">
237
+          {getFieldDecorator('personNum', {
238
+            rules: [
239
+              {
240
+                required: true,
241
+                message: '请输入活动人数',
242
+              },
243
+              // {
244
+              //   min: data.personNum,min={data.personNum || 0}
245
+              //   message: '活动人数必须大于已报名人数',
246
+              // },
247
+            ],
248
+          })(<Input type="number" />)}
249
+        </Form.Item>
250
+        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
251
+          {getFieldDecorator('maxEnlistByPerson', {
252
+            rules: [
253
+              {
254
+                required: true,
255
+                message: '请输入用户携带人数',
256
+              },
257
+            ],
258
+          })(<Input type="number" min={1} />)}
259
+        </Form.Item>
260
+        <Form.Item label="活动详情">{getFieldDecorator('desc')(<Wangedit />)}</Form.Item>
261
+        <Form.Item label="报名时间">
262
+          {getFieldDecorator('signupTime', {
263
+            rules: [
264
+              {
265
+                required: true,
266
+                message: '请选择报名时间',
267
+              },
268
+            ],
269
+          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
270
+        </Form.Item>
271
+        <Form.Item label="权重">
272
+          {getFieldDecorator('heavy', {
273
+            rules: [
274
+              {
275
+                required: true,
276
+                message: '请输入权重',
277
+              },
278
+            ],
279
+          })(<Input type="number" style={{ width: 80 }} />)}
280
+          <span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
281
+        </Form.Item>
282
+        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
283
+          <Button type="primary" htmlType="submit">
284
+            确认
285
+          </Button>
286
+          &nbsp;&nbsp;&nbsp;&nbsp;
287
+          <Button onClick={() => cancelPage()}>取消</Button>
288
+        </Form.Item>
289
+      </Form>
290
+    </>
291
+  );
292
+};
293
+
294
+export default Form.create({ name: 'BasicForm' })(BasicForm);

+ 255
- 0
src/pages/activity/groupRoomActivity/edit/Poster.jsx Parādīt failu

@@ -0,0 +1,255 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Button, message } from 'antd';
3
+import router from 'umi/router';
4
+import apis from '@/services/apis';
5
+import request from '@/utils/request';
6
+import yinhao from '@/assets/yinhao.png';
7
+import ImageUploader from '@/components/XForm/ImageUpload';
8
+import touxiang from '@/assets/touxiang.jpg';
9
+import poster1 from '@/assets/poster1.png';
10
+import xiaochengxu from '@/assets/xiaochengxu.png';
11
+
12
+const { TextArea } = Input;
13
+
14
+const cancelPage = () => {
15
+  router.go('-1');
16
+};
17
+
18
+const Poster = props => {
19
+  const { dynamicId } = props;
20
+  const [inputValue, changeInput] = useState('');
21
+  const [textAreaValue, changeTextArea] = useState('');
22
+  const [imgValue, changeImg] = useState('');
23
+  const [posterId, setPosterId] = useState('');
24
+
25
+  useEffect(() => {
26
+    if (dynamicId) {
27
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } })
28
+        .then(data => {
29
+          if (data.length > 0) {
30
+            setPosterId(data[0].posterId);
31
+            changeImg(data[0].posterImg);
32
+            changeTextArea(data[0].posterDescription);
33
+            changeInput(data[0].posterTitle);
34
+          }
35
+        })
36
+        .catch(err => {
37
+          message.info(err.msg || err.message);
38
+        });
39
+    }
40
+    // getMiniappName()
41
+  }, []);
42
+
43
+  // 获取小程序名称
44
+  // const [miniappName, setMiniappName] = useState('')
45
+  // function getMiniappName() {
46
+  //   request({ ...apis.building.getMiniappName }).then(res => {
47
+  //     console.log(res, "0000000000000")
48
+  //     setMiniappName(res)
49
+  //   })
50
+  // }
51
+
52
+  const submitPoster = () => {
53
+    if (dynamicId) {
54
+      if (posterId) {
55
+        request({
56
+          ...apis.activity.updatePoster,
57
+          urlData: { id: posterId },
58
+          data: {
59
+            targetId: dynamicId,
60
+            targetType: 'activity',
61
+            posterImg: imgValue,
62
+            posterTitle: inputValue,
63
+            posterDescription: textAreaValue,
64
+          },
65
+        })
66
+          .then(data => {
67
+            message.info('保存成功');
68
+          })
69
+          .catch(err => {
70
+            message.info(err.msg || err.message);
71
+          });
72
+      } else {
73
+        request({
74
+          ...apis.activity.addPoster,
75
+          data: {
76
+            targetId: dynamicId,
77
+            targetType: 'activity',
78
+            posterImg: imgValue,
79
+            posterTitle: inputValue,
80
+            posterDescription: textAreaValue,
81
+          },
82
+        })
83
+          .then(data => {
84
+            setPosterId(data.posterId);
85
+            message.info('保存成功');
86
+          })
87
+          .catch(err => {
88
+            message.info(err.msg || err.message);
89
+          });
90
+      }
91
+    } else {
92
+      message.warn('请先保存基本信息数据');
93
+    }
94
+  };
95
+
96
+  return (
97
+    <div>
98
+      <div style={{ display: 'flex' }}>
99
+        <div
100
+          style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}
101
+        >
102
+          <div
103
+            style={{
104
+              width: '375px',
105
+              height: '700px',
106
+              backgroundColor: '#fff',
107
+              boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)',
108
+              position: 'relative',
109
+              margin: '0 auto',
110
+            }}
111
+          >
112
+            <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
113
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
114
+              <img
115
+                style={{
116
+                  width: '70px',
117
+                  height: '70px',
118
+                  border: '4px solid #fff',
119
+                  borderRadius: '35px',
120
+                  marginLeft: '16px',
121
+                }}
122
+                src={touxiang}
123
+                alt=""
124
+              />
125
+              <span
126
+                style={{
127
+                  color: '#222',
128
+                  fontWeight: '600',
129
+                  margin: '24px 10px 0 14px',
130
+                  fontSize: '17px',
131
+                }}
132
+              >
133
+                喵喵
134
+              </span>
135
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
136
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>
137
+                2019.09.21
138
+              </span>
139
+            </div>
140
+            <p
141
+              style={{
142
+                margin: '10px 20px',
143
+                fontSize: '20px',
144
+                color: '#222',
145
+                fontWeight: '600',
146
+                display: '-webkit-box',
147
+                lineClamp: '3',
148
+                height: '60px',
149
+                WebkitLineClamp: '2',
150
+                WebkitBoxOrient: 'vertical',
151
+                overflow: 'hidden',
152
+                textOverflow: 'ellipsis',
153
+              }}
154
+            >
155
+              {inputValue || '海报标题'}
156
+            </p>
157
+
158
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
159
+            <p
160
+              style={{
161
+                margin: '16px 20px 28px 20px',
162
+                fontSize: '17px',
163
+                color: '#999',
164
+                display: '-webkit-box',
165
+                lineClamp: '3',
166
+                height: '72px',
167
+                WebkitLineClamp: '3',
168
+                WebkitBoxOrient: 'vertical',
169
+                overflow: 'hidden',
170
+                textOverflow: 'ellipsis',
171
+              }}
172
+            >
173
+              {textAreaValue || '海报描述'}
174
+            </p>
175
+            <div
176
+              style={{
177
+                backgroundColor: '#f1f1f1',
178
+                padding: '22px 30px',
179
+                boxShadow: '0px 6px 12px -4px #dcdcdc',
180
+                position: 'relative',
181
+              }}
182
+            >
183
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
184
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
185
+              <img
186
+                style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }}
187
+                src={xiaochengxu}
188
+                alt=""
189
+              />
190
+            </div>
191
+          </div>
192
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>
193
+            海报模板
194
+          </p>
195
+        </div>
196
+
197
+        <div>
198
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
199
+            <p
200
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
201
+            >
202
+              活动海报图
203
+            </p>
204
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
205
+          </div>
206
+          <p
207
+            style={{
208
+              fontSize: '0.5vw',
209
+              color: '#A9A9A9',
210
+              marginLeft: '230px',
211
+              marginBottom: '30px',
212
+            }}
213
+          >
214
+            建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报
215
+          </p>
216
+          <div
217
+            style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}
218
+          >
219
+            <p
220
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
221
+            >
222
+              海报标题
223
+            </p>
224
+            <Input
225
+              style={{ width: '20vw' }}
226
+              value={inputValue}
227
+              placeholder="请输入海报标题"
228
+              onChange={e => changeInput(e.target.value)}
229
+            />
230
+          </div>
231
+          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
232
+            <p
233
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
234
+            >
235
+              海报描述
236
+            </p>
237
+            <TextArea
238
+              rows={5}
239
+              maxLength={1024}
240
+              value={textAreaValue}
241
+              onChange={e => changeTextArea(e.target.value)}
242
+            />
243
+          </div>
244
+        </div>
245
+      </div>
246
+      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}>
247
+        {' '}
248
+        确定
249
+      </Button>
250
+      <Button onClick={() => cancelPage()}>取消</Button>
251
+    </div>
252
+  );
253
+};
254
+
255
+export default Poster;

+ 150
- 0
src/pages/activity/groupRoomActivity/edit/Share.jsx Parādīt failu

@@ -0,0 +1,150 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Card } from 'antd';
3
+
4
+import router from 'umi/router';
5
+import apis from '@/services/apis';
6
+import moment from 'moment';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect2';
8
+import Wangedit from '@/components/Wangedit/Wangedit';
9
+import request from '@/utils/request';
10
+import yinhao from '@/assets/yinhao.png';
11
+import ImageUploader from '@/components/XForm/ImageUpload';
12
+import logo from '@/assets/logo.png';
13
+import touxiang from '@/assets/touxiang.jpg';
14
+import poster1 from '@/assets/poster1.png';
15
+import poster2 from '@/assets/poster2.png';
16
+import xiaochengxu from '@/assets/xiaochengxu.png';
17
+
18
+const { TextArea } = Input;
19
+
20
+const cancelPage = () => {
21
+  router.go('-1');
22
+};
23
+
24
+const Share = props => {
25
+  const { dynamicId } = props;
26
+  const [inputValue, changeInput] = useState('');
27
+  const [imgValue, changeImg] = useState('');
28
+  const [shareContentId, setShareContentId] = useState('');
29
+
30
+  useEffect(() => {
31
+    if (dynamicId) {
32
+      request({
33
+        ...apis.activity.shareContent,
34
+        params: { targetId: dynamicId, targetType: 'activity' },
35
+      })
36
+        .then(data => {
37
+          if (data.length > 0) {
38
+            setShareContentId(data[0].shareContentId);
39
+            changeImg(data[0].shareContentImg);
40
+            changeInput(data[0].shareContentTitle);
41
+          }
42
+        })
43
+        .catch(err => {
44
+          message.info(err.msg || err.message);
45
+        });
46
+    }
47
+  }, [dynamicId]);
48
+
49
+  const submitShare = () => {
50
+    if (dynamicId) {
51
+      if (shareContentId) {
52
+        request({
53
+          ...apis.activity.updateShareContent,
54
+          urlData: { id: shareContentId },
55
+          data: {
56
+            targetId: dynamicId,
57
+            shareContentType: 'activity',
58
+            shareContentImg: imgValue,
59
+            shareContentTitle: inputValue,
60
+          },
61
+        })
62
+          .then(data => {
63
+            message.info('保存成功');
64
+          })
65
+          .catch(err => {
66
+            message.info(err.msg || err.message);
67
+          });
68
+      } else {
69
+        request({
70
+          ...apis.activity.addShareContent,
71
+          data: {
72
+            targetId: dynamicId,
73
+            shareContentType: 'activity',
74
+            shareContentImg: imgValue,
75
+            shareContentTitle: inputValue,
76
+          },
77
+        })
78
+          .then(data => {
79
+            setShareContentId(data.shareContentId);
80
+            message.info('保存成功');
81
+          })
82
+          .catch(err => {
83
+            message.info(err.msg || err.message);
84
+          });
85
+      }
86
+    } else {
87
+      message.warn('请先保存基本信息数据');
88
+    }
89
+  };
90
+
91
+  return (
92
+    <div style={{ padding: '20px' }}>
93
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
94
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
95
+          分享模板
96
+        </p>
97
+        <div>
98
+          <p
99
+            style={{
100
+              display: 'flex',
101
+              alignItems: 'center',
102
+              fontSize: '14px',
103
+              color: '#999',
104
+              margin: '0',
105
+              lineHeight: '0',
106
+            }}
107
+          >
108
+            <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt="" />
109
+            橙蕉互动
110
+          </p>
111
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>
112
+            {inputValue || '置业V客厅 精准获客平台'}
113
+          </p>
114
+          <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
115
+        </div>
116
+      </div>
117
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
118
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
119
+          分享标题
120
+        </p>
121
+        <Input
122
+          placeholder="请输入分享标题"
123
+          value={inputValue}
124
+          onChange={e => changeInput(e.target.value)}
125
+        />
126
+      </div>
127
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
128
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
129
+          活动分享图
130
+        </p>
131
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
132
+      </div>
133
+      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>
134
+        建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友
135
+      </p>
136
+      <Button
137
+        type="primary"
138
+        htmlType="submit"
139
+        onClick={submitShare}
140
+        style={{ margin: '40px 40px 40px 220px' }}
141
+      >
142
+        {' '}
143
+        确定
144
+      </Button>
145
+      <Button onClick={() => cancelPage()}>取消</Button>
146
+    </div>
147
+  );
148
+};
149
+
150
+export default Share;

src/pages/activity/helpActivity/edithelpActivity.jsx → src/pages/activity/groupRoomActivity/edit/ind.jsx Parādīt failu

@@ -1,168 +1,168 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../../style/GoodsList.less';
5
-import apis from '../../../services/apis';
6
-import moment from 'moment';
3
+
7 4
 import router from 'umi/router';
8
-import BuildSelect from '../../../components/SelectButton/BuildSelect2'
9
-import XForm, { FieldTypes } from '../../../components/XForm';
10
-import Wangedit from '../../../components/Wangedit/Wangedit'
11
-import request from '../../../utils/request'
12
-import yinhao from '../../../assets/yinhao.png'
13
-import ImageUploader from '../../../components/XForm/ImageUpload';
14
-import logo from '../../../assets/logo.svg';
15
-import touxiang from '../../../assets/touxiang.jpg';
16
-import poster1 from '../../../assets/poster1.png';
17
-import poster2 from '../../../assets/poster2.png';
18
-import xiaochengxu from '../../../assets/xiaochengxu.png'
19
-import Prompt from 'umi/prompt';
5
+import apis from '@/services/apis';
6
+import moment from 'moment';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect2'
8
+import Wangedit from '@/components/Wangedit/Wangedit'
9
+import request from '@/utils/request'
10
+import yinhao from '@/assets/yinhao.png'
11
+import ImageUploader from '@/components/XForm/ImageUpload';
12
+import logo from '@/assets/logo.svg';
13
+import touxiang from '@/assets/touxiang.jpg';
14
+import poster1 from '@/assets/poster1.png';
15
+import poster2 from '@/assets/poster2.png';
16
+import xiaochengxu from '@/assets/xiaochengxu.png'
20 17
 
21 18
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22 19
 const { TextArea } = Input;
23 20
 
21
+const formItemLayout = {
22
+  labelCol: { span: 6 },
23
+  wrapperCol: { span: 14 },
24
+};
25
+
24 26
 const cancelPage = () => {
25 27
   router.push({
26
-    pathname: '/activity/helpActivity/list',
28
+    pathname: '/activity/ActivityList',
27 29
   });
28 30
 }
29 31
 
30
-const header = props => {
32
+const BasicForm = props => {
31 33
   const [isEnlist, setIsEnlist] = useState(1)
32
-  // 新增成功后拿到返回的ID
33
-  const [helpId, setHelpId] = useState()
34 34
   const [activityStatus, setActivityStatus] = useState(1)
35 35
   const [disable, setDisable] = useState(false)
36
+  const [data, setData] = useState(1)
37
+  const [showSignupTime, setShowSignupTime] = useState([])
38
+
36 39
 
37 40
   const radioOnChange = e => {
38
-    // console.log(e.target.value)
39 41
     setIsEnlist(e.target.value)
40 42
   }
41 43
 
44
+  const { dynamicId } = props
42 45
 
43
-  // eslint-disable-next-line react-hooks/rules-of-hooks
44
-  const [data, setData] = useState({ channelNmae: [], result: [] })
45
-  // eslint-disable-next-line react-hooks/rules-of-hooks
46
-  const { helpActivityId } = props
47
-  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
48
-
49
-
50
-  // 详情
51
-  const getDynamicData = helpActivityId => {
52
-    request({ ...apis.helpActivity.details, params: { helpActivityId } }).then((data) => {
46
+  // 查询详情
47
+  const getDynamicData = dynamicId => {
48
+    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
49
+ 
53 50
       data.activityTime = [moment(data.startDate), moment(data.endDate)]
54
-      const num = data.helpNum > 0 ? 1 : 0
55
-      setIsEnlist(num)
51
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
52
+      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
53
+      setData(data)
54
+      setIsEnlist(data.isEnlist)
56 55
       setActivityStatus(data.activityStatus)
57
-      setDisable(data.activityStatus === 0 ? true : false)
58
-      data.isEnlist = num
56
+      setDisable(data.activityStatus === 0)
59 57
       props.form.setFieldsValue(data)
60
-      setDynamicData(data)
61 58
     })
62 59
   }
63 60
 
64 61
   // eslint-disable-next-line react-hooks/rules-of-hooks
65 62
   useEffect(() => {
66
-    // eslint-disable-next-line no-use-before-define
67
-    if (helpActivityId) {
68
-      getDynamicData(helpActivityId)
63
+    props.form.setFieldsValue({ isEnlist })
64
+    if (dynamicId) {
65
+      getDynamicData(dynamicId);
69 66
     }
70 67
   }, [])
68
+  const checkTime = () => {
69
+    function compareDate(dateTime1, dateTime2) {
70
+      return new Date(dateTime1) > new Date(dateTime2)
71
+    }
72
+    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
71 73
 
72
-  // function addChannel(params) {
73
-  //   request({ ...apis.channelList.addChannel, data: { ...params } }).then((data) => {
74
-  //     setData(data)
75
-  // }).catch((err) => {
76
-  //     console.log(err)
77
-  //     message.info(err.msg || err.message)
78
-  // })
79
-  // }
74
+    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
80 75
 
81
-  function compareDate(dateTime1, dateTime2) {
82
-    var formatDate1 = new Date(dateTime1)
83
-    var formatDate2 = new Date(dateTime2)
84
-    if (formatDate1 > formatDate2) {
85
-      return true;
86
-    }
87
-    else {
88
-      return false;
76
+    // (3)修改后结束时间<当前时间:活动已结束
77
+    if (showSignupTime[0]) {
78
+      // const date = data.signupTime
79
+      const nowDate = new Date()
80
+      // console.log(compareDate(nowDate, showSignupTime[0]))
81
+      if (compareDate(nowDate, showSignupTime[0])) {
82
+        return true
83
+      } else {
84
+        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)'
85
+      }
89 86
     }
87
+    return true
90 88
   }
91 89
 
92
-  function handleSubmit(e) {
90
+
91
+  const handleSubmit = e => {
93 92
     e.preventDefault();
94 93
     props.form.validateFields((err, values) => {
95
-      if (!err) {
96
-        if (values.isEnlist === 0) {
97
-          values.helpNum = 0
98
-        }
99 94
 
100
-        // 判断助力人数不得超过200
101
-        if (values.personNum > 200) {
102
-          message.error('助力邀请人数不能超过200')
103
-          return
104
-        }
105
-        // 助力邀请人数>0
106
-        if (values.personNum <= 0) {
107
-          message.error('助力邀请人数大于0')
108
-          return
95
+      if (!err) {
96
+        console.log('Received values of form: ', values);
97
+        const { activityTime, signupTime } = values
98
+        const [startDate, endDate] = activityTime
99
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
100
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
101
+        if (signupTime) {
102
+          const [enlistStart, enlistEnd] = signupTime
103
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
104
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
109 105
         }
110 106
 
111
-        // 判断助力人数必须大于0
112
-        if (values.isEnlist === 1) {
113
-          if (values.helpNum <= 0) {
114
-            message.error('限制助力次数必须大于0')
107
+        console.log('submit data --->', values)
108
+        if (dynamicId) {
109
+          const checks = checkTime()
110
+          if (checks != true) {
111
+            message.info(checks)
115 112
             return
116 113
           }
117
-        }
118
-        const { activityTime, signupTime, ...submitValue } = values
119
-        const [startDate, endDate] = activityTime
120
-        console.log('startDate', activityTime)
121
-        submitValue.startDate = moment(startDate).format('YYYY-MM-DD HH:mm:ss');
122
-        submitValue.endDate = moment(endDate).format('YYYY-MM-DD HH:mm:ss');
123
-        // const [enlistStart, enlistEnd] = signupTime
124
-        // submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
125
-        // submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
126
-        console.log('submit data --->', submitValue)
127
-        if (helpActivityId) {
128
-
129
-          const nowDate = new Date()
130
-          if (!compareDate(nowDate, startDate)) {
131
-
132
-            message.info("修改后的开始时间不得大于当前时间(会存在已经成功助力或者发起助力的用户)")
114
+          console.log(data.enlistNum,values.personNum,'143')
115
+
116
+          if (data.enlistNum > values.personNum) {
117
+            message.info('活动人数必须大于已报名人数')
133 118
             return
134 119
           }
135 120
 
136
-          submitValue.helpActivityId = helpActivityId
137
-          request({ ...apis.helpActivity.update, data: submitValue }).then((data) => {
138
-            message.info("保存成功")
139
-            // cancelPage()
121
+          values.dynamicId = dynamicId
122
+          request({ ...apis.activity.update, data: values }).then(data => {
123
+            message.info('保存成功')
124
+            // router.go(-1)
140 125
           }).catch((err) => {
141
-            // message.info(err.msg || err.message)
126
+            message.info(err.msg || err.message)
142 127
           })
143 128
         } else {
144
-          request({ ...apis.helpActivity.add, data: submitValue }).then((data) => {
129
+          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
130
+            message.info('保存成功')
145 131
             router.push({
146
-              pathname: '/activity/helpActivity/edithelpActivity',
132
+              pathname: '/activity/editActivity',
147 133
               query: {
148
-                helpActivityId: data,
134
+                dynamicId: data.dynamicId,
149 135
               },
150 136
             });
151
-            message.info("保存成功")
152
-            // cancelPage()
137
+            // router.go(-1)
153 138
           }).catch((err) => {
154
-            // message.info(err.msg || err.message)
139
+            message.info(err.msg || err.message)
155 140
           })
156 141
         }
157 142
       }
158 143
     });
159 144
   }
145
+  const changeTime = (value, date) => {
146
+    // console.log(value, data, '-----checkTime---------')
147
+    // console.log(props.form.getFieldsValue(), '--------time1-----------')
148
+    // let datas = data
149
+    // console.log(value, date, datas)
150
+    // datas.signupTime = date
151
+
152
+    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
153
+
154
+    // console.log(datas,'-------datas--------')
155
+    //   props.form.setFieldsValue(data)
156
+    setShowSignupTime(date)
157
+    // props.form.setFieldsValue(datas)
158
+    // // form.setFieldsValue
159
+    // console.log('-------1--------')
160
+  }
160 161
 
161 162
   const { getFieldDecorator } = props.form;
162
-
163 163
   return (
164 164
     <>
165
-      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
165
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
166 166
         <Form.Item label="所属项目">
167 167
           {getFieldDecorator('buildingId', {
168 168
             rules: [
@@ -173,51 +173,46 @@ const header = props => {
173 173
             ],
174 174
           })(<BuildSelect disabled={disable} />)}
175 175
         </Form.Item>
176
-
177
-        <Form.Item label="活动标题">
178
-          {getFieldDecorator('title', {
176
+        <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表">
177
+          {getFieldDecorator('listImgUrl', {
179 178
             rules: [
180 179
               {
181 180
                 required: true,
182
-                message: '请输入活动标题',
181
+                message: '请选择活动封面图1',
183 182
               },
184 183
             ],
185
-          })(<Input />)}
184
+          })(<ImageUploader />)}
186 185
         </Form.Item>
187
-
188
-        <Form.Item label="助力详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:助力活动详情">
189
-          {getFieldDecorator('img', {
186
+        <Form.Item label="活动封面图2" help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页">
187
+          {getFieldDecorator('bannerListImg', {
190 188
             rules: [
191 189
               {
192 190
                 required: true,
193
-                message: '助力详情主图不能为空',
191
+                message: '请选择活动封面图2',
194 192
               },
195 193
             ],
196 194
           })(<ImageUploader />)}
197 195
         </Form.Item>
198
-
199
-        <Form.Item label="助力封面图1" help="建议图片尺寸:750*420px,比例16:9,格式:jpg,用于:活动列表/首页推荐">
200
-          {getFieldDecorator('listImg', {
196
+        <Form.Item label="活动详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情">
197
+          {getFieldDecorator('imgUrl', {
201 198
             rules: [
202 199
               {
203 200
                 required: true,
204
-                message: '助力封面图1不能为空',
201
+                message: '请选择活动详情主图',
205 202
               },
206 203
             ],
207 204
           })(<ImageUploader />)}
208 205
         </Form.Item>
209
-
210
-        <Form.Item label="助力封面图2" help="建议图片尺寸:750*250px,比例3:1,格式:jpg,用于:项目详情页">
211
-          {getFieldDecorator('bannerListImg', {
206
+        <Form.Item label="活动标题">
207
+          {getFieldDecorator('title', {
212 208
             rules: [
213 209
               {
214 210
                 required: true,
215
-                message: '助力封面图2不能为空',
211
+                message: '请输入活动标题',
216 212
               },
217 213
             ],
218
-          })(<ImageUploader />)}
214
+          })(<Input />)}
219 215
         </Form.Item>
220
-
221 216
         <Form.Item label="活动时间">
222 217
           {getFieldDecorator('activityTime', {
223 218
             rules: [
@@ -226,60 +221,59 @@ const header = props => {
226 221
                 message: '请选择活动时间',
227 222
               },
228 223
             ],
229
-          })(<RangePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} />)}
224
+          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
230 225
         </Form.Item>
231
-
232
-        <Form.Item label="助力邀请人数" min={1} max={10}>
226
+        <Form.Item label="活动地点">
227
+          {getFieldDecorator('address', {
228
+            rules: [
229
+              {
230
+                required: true,
231
+                message: '请输入活动地点',
232
+              },
233
+            ],
234
+          })(<Input />)}
235
+        </Form.Item>
236
+        {/* disabled={activityStatus === 0 ? true : false} */}
237
+        <Form.Item label="活动人数" help="当前活动最多可报名人数">
233 238
           {getFieldDecorator('personNum', {
234 239
             rules: [
235 240
               {
236 241
                 required: true,
237 242
                 message: '请输入活动人数',
238 243
               },
244
+              // {
245
+              //   min: data.personNum,min={data.personNum || 0}
246
+              //   message: '活动人数必须大于已报名人数',
247
+              // },
239 248
             ],
240
-          })(<Input type="number" disabled={activityStatus === 0 ? true : false} />)}
249
+          })(<Input type="number" />)}
241 250
         </Form.Item>
242
-
243
-        <Form.Item label="助力次数">
244
-          {getFieldDecorator('isEnlist', {
251
+        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
252
+          {getFieldDecorator('maxEnlistByPerson', {
245 253
             rules: [
246 254
               {
247 255
                 required: true,
248
-                message: '请选择助力次数',
256
+                message: '请输入用户携带人数',
249 257
               },
250 258
             ],
251
-          })(
252
-            <Radio.Group onChange={(e) => radioOnChange(e)} disabled={activityStatus === 0 ? true : false}>
253
-              <Radio value={0}>不限制</Radio>
254
-              <Radio value={1}>限制</Radio>
255
-            </Radio.Group>,
256
-          )}
259
+          })(<Input type="number" min={1} />)}
257 260
         </Form.Item>
258
-        {
259
-          isEnlist === 1 && <Form.Item label=" " min={1} max={10}>
260
-            {getFieldDecorator('helpNum', {
261
-              rules: [
262
-                {
263
-                  required: true,
264
-                  message: '请输入助力人数',
265
-                },
266
-              ],
267
-            })(<Input type="number" placeholder="助力人数限制" />)}
268
-          </Form.Item>
269
-        }
270
-
271
-        <Form.Item label="活动说明" help="建议宽度:750px,高度不限,格式:jpg,用于活动详情">
272
-          {getFieldDecorator('activityInstructions', {
261
+        <Form.Item label="活动详情">
262
+          {getFieldDecorator('desc')(<Wangedit />)}
263
+        </Form.Item>
264
+        <Form.Item label="报名时间">
265
+          {getFieldDecorator('signupTime', {
273 266
             rules: [
274 267
               {
275 268
                 required: true,
276
-                message: '活动说明不能为空',
269
+                message: '请选择报名时间',
277 270
               },
278 271
             ],
279
-          })(<ImageUploader />)}
272
+          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
280 273
         </Form.Item>
281 274
         <Form.Item label="权重">
282 275
           {getFieldDecorator('heavy', {
276
+
283 277
             rules: [
284 278
               {
285 279
                 required: true,
@@ -302,19 +296,18 @@ const header = props => {
302 296
   )
303 297
 }
304 298
 
305
-const Basic = Form.create({ name: 'header' })(header);
306
-
299
+const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
307 300
 
308 301
 const Poster = props => {
309
-  const { helpActivityId } = props
302
+  const { dynamicId } = props
310 303
   const [inputValue, changeInput] = useState('')
311 304
   const [textAreaValue, changeTextArea] = useState('')
312 305
   const [imgValue, changeImg] = useState('')
313 306
   const [posterId, setPosterId] = useState('')
314 307
 
315 308
   useEffect(() => {
316
-    if (helpActivityId) {
317
-      request({ ...apis.activity.poster, params: { targetId: helpActivityId, targetType: 'helpActivity' } }).then(data => {
309
+    if (dynamicId) {
310
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
318 311
 
319 312
         if (data.length > 0) {
320 313
           setPosterId(data[0].posterId)
@@ -328,8 +321,8 @@ const Poster = props => {
328 321
     }
329 322
     // getMiniappName()
330 323
   }, [])
331
-
332
-  // // 获取小程序名称
324
+  
325
+  // 获取小程序名称
333 326
   // const [miniappName, setMiniappName] = useState('')
334 327
   // function getMiniappName() {
335 328
   //   request({ ...apis.building.getMiniappName }).then(res => {
@@ -339,17 +332,17 @@ const Poster = props => {
339 332
   // }
340 333
 
341 334
   const submitPoster = () => {
342
-    if (helpActivityId) {
335
+    if (dynamicId) {
343 336
       if (posterId) {
344
-        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: helpActivityId, targetType: 'helpActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then(data => {
337
+        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
345 338
           message.info('保存成功')
346 339
         }).catch(err => {
347 340
           message.info(err.msg || err.message)
348 341
         })
349 342
       } else {
350
-        request({ ...apis.activity.addPoster, data: { targetId: helpActivityId, targetType: 'helpActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then(data => {
343
+        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
351 344
           setPosterId(data.posterId)
352
-          message.info("保存成功")
345
+          message.info('保存成功')
353 346
         }).catch(err => {
354 347
           message.info(err.msg || err.message)
355 348
         })
@@ -381,7 +374,7 @@ const Poster = props => {
381 374
             WebkitLineClamp: '2',
382 375
             WebkitBoxOrient: 'vertical',
383 376
             overflow: 'hidden',
384
-            textOverflow: 'ellipsis'
377
+            textOverflow: 'ellipsis',
385 378
           }}>{inputValue || '海报标题'}</p>
386 379
 
387 380
           <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
@@ -395,7 +388,7 @@ const Poster = props => {
395 388
             WebkitLineClamp: '3',
396 389
             WebkitBoxOrient: 'vertical',
397 390
             overflow: 'hidden',
398
-            textOverflow: 'ellipsis'
391
+            textOverflow: 'ellipsis',
399 392
           }}>{textAreaValue || '海报描述'}</p>
400 393
           <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
401 394
             <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
@@ -408,10 +401,10 @@ const Poster = props => {
408 401
 
409 402
       <div >
410 403
         <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
411
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>助力海报图</p>
404
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动海报图</p>
412 405
           <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
413 406
         </div>
414
-        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动海报</p>
407
+        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报</p>
415 408
         <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
416 409
           <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
417 410
           <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
@@ -424,20 +417,22 @@ const Poster = props => {
424 417
       </div>
425 418
     </div>
426 419
     <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
427
-    <Button onClick={() => cancelPage()}>取消</Button>
420
+    <Button onClick={() => cancelPage()}>
421
+      取消
422
+    </Button>
428 423
   </div>
429 424
 }
430 425
 
431
-
432 426
 const Share = props => {
433
-  const { helpActivityId } = props
427
+  const { dynamicId } = props
434 428
   const [inputValue, changeInput] = useState('')
435 429
   const [imgValue, changeImg] = useState('')
436 430
   const [shareContentId, setShareContentId] = useState('')
437 431
 
438 432
   useEffect(() => {
439
-    if (helpActivityId) {
440
-      request({ ...apis.activity.shareContent, params: { targetId: helpActivityId, targetType: 'helpActivity' } }).then(data => {
433
+    if (dynamicId) {
434
+      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
435
+
441 436
         if (data.length > 0) {
442 437
           setShareContentId(data[0].shareContentId)
443 438
           changeImg(data[0].shareContentImg)
@@ -447,18 +442,18 @@ const Share = props => {
447 442
         message.info(err.msg || err.message)
448 443
       })
449 444
     }
450
-  }, [])
445
+  }, [dynamicId])
451 446
 
452 447
   const submitShare = () => {
453
-    if (helpActivityId) {
448
+    if (dynamicId) {
454 449
       if (shareContentId) {
455
-        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: helpActivityId, shareContentType: 'helpActivity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
450
+        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
456 451
           message.info('保存成功')
457 452
         }).catch(err => {
458 453
           message.info(err.msg || err.message)
459 454
         })
460 455
       } else {
461
-        request({ ...apis.activity.addShareContent, data: { targetId: helpActivityId, shareContentType: 'helpActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then(data => {
456
+        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
462 457
           setShareContentId(data.shareContentId)
463 458
           message.info('保存成功')
464 459
         }).catch(err => {
@@ -475,8 +470,7 @@ const Share = props => {
475 470
       <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
476 471
       <div>
477 472
         <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
478
-          <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt="" />橙蕉互动
479
-        </p>
473
+          <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt=""/>橙蕉互动</p>
480 474
         <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue || '置业V客厅 精准获客平台'}</p>
481 475
         <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
482 476
       </div>
@@ -486,12 +480,14 @@ const Share = props => {
486 480
       <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
487 481
     </div>
488 482
     <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
489
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>助力分享图</p>
483
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
490 484
       <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
491 485
     </div>
492
-    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动分享好友</p>
486
+    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友</p>
493 487
     <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
494
-    <Button onClick={() => cancelPage()}>取消</Button>
488
+    <Button onClick={() => cancelPage()}>
489
+      取消
490
+    </Button>
495 491
   </div>
496 492
 }
497 493
 
@@ -504,26 +500,7 @@ const Share = props => {
504 500
  */
505 501
 const Edit = props => {
506 502
   const [tab, changeTab] = useState('basic')
507
-  // 判断是否展示助力次数的输入框
508
-  // const [help, helpTab] = useState('1')
509
-  const { helpActivityId } = props.location.query
510
-  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
511
-  
512
-  // 详情
513
-  const getDynamicData = id => {
514
-    request({ ...apis.helpActivity.details, params: { helpActivityId: id } }).then(data => {
515
-      setDynamicData(data)
516
-    })
517
-  }
518
-
519
-  // eslint-disable-next-line react-hooks/rules-of-hooks
520
-  useEffect(() => {
521
-    // eslint-disable-next-line no-use-before-define
522
-    if (helpActivityId) {
523
-      getDynamicData(helpActivityId);
524
-    }
525
-  }, [])
526
-
503
+  const { dynamicId } = props.location.query
527 504
 
528 505
   return (
529 506
     <div>
@@ -535,15 +512,13 @@ const Edit = props => {
535 512
         </Radio.Group>
536 513
       </div>
537 514
       <div>
538
-        {tab === 'basic' && <Basic helpActivityId={helpActivityId} />}
539
-        {tab === 'poster' && <Poster helpActivityId={helpActivityId} />}
540
-        {tab === 'share' && <Share helpActivityId={helpActivityId} />}
515
+        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
516
+        {tab === 'poster' && <Poster dynamicId={dynamicId}/>}
517
+        {tab === 'share' && <Share dynamicId={dynamicId}/>}
541 518
       </div>
542
-      <Prompt message={location =>
543
-        (location.pathname.startsWith('/activity/helpActivity')
544
-          ? true
545
-          : localStorage.removeItem('activePageParams'))} />
519
+    
546 520
     </div>
547 521
   );
548 522
 }
523
+
549 524
 export default Edit

+ 34
- 0
src/pages/activity/groupRoomActivity/edit/index.jsx Parādīt failu

@@ -0,0 +1,34 @@
1
+import React, { useState } from 'react';
2
+import { Radio, Card } from 'antd';
3
+import Basic from './Basic';
4
+import Poster from './Poster';
5
+import Share from './Share';
6
+/**
7
+ *
8
+ *
9
+ * @param {*} props
10
+ * @returns
11
+ */
12
+const Edit = props => {
13
+  const [tab, changeTab] = useState('basic');
14
+  const { dynamicId } = props.location.query;
15
+
16
+  return (
17
+    <Card>
18
+      <div>
19
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
20
+          <Radio.Button value="basic">基本信息</Radio.Button>
21
+          <Radio.Button value="poster">海报图片</Radio.Button>
22
+          <Radio.Button value="share">分享设置</Radio.Button>
23
+        </Radio.Group>
24
+      </div>
25
+      <div>
26
+        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
27
+        {tab === 'poster' && <Poster dynamicId={dynamicId} />}
28
+        {tab === 'share' && <Share dynamicId={dynamicId} />}
29
+      </div>
30
+    </Card>
31
+  );
32
+};
33
+
34
+export default Edit;

+ 331
- 0
src/pages/activity/groupRoomActivity/index.jsx Parādīt failu

@@ -0,0 +1,331 @@
1
+import React, { useState, useEffect, useRef } from 'react';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  Icon,
7
+  Typography,
8
+  message,
9
+  Table,
10
+  Pagination,
11
+  Modal,
12
+  DatePicker,
13
+  Card,
14
+} from 'antd';
15
+import router from 'umi/router';
16
+import moment from 'moment';
17
+import AuthButton from '@/components/AuthButton';
18
+import withActions from '@/components/ActionList';
19
+import EditIcon from '@/components/EditIcon';
20
+import Navigate from '@/components/Navigate';
21
+import SelectCity from '@/components/SelectButton/CitySelect';
22
+import BuildSelect from '@/components/SelectButton/BuildSelect';
23
+import apis from '@/services/apis';
24
+import request from '@/utils/request';
25
+import QueryTable from '@/components/QueryTable';
26
+
27
+const GroupRoomActivity = props => {
28
+  const ref = useRef();
29
+
30
+  const searchFields = [
31
+    {
32
+      name: 'cityId',
33
+      label: '城市',
34
+      placeholder: '请选择城市',
35
+      render: () => <SelectCity style={{ width: 160 }} />,
36
+    },
37
+    {
38
+      name: 'buildingId',
39
+      label: '项目',
40
+      placeholder: '请选择项目',
41
+      render: () => <BuildSelect style={{ width: 160 }} />,
42
+    },
43
+
44
+    {
45
+      name: 'title',
46
+      label: '标题',
47
+      placeholder: '请输入标题',
48
+    },
49
+    {
50
+      name: 'time',
51
+      label: '时间',
52
+      placeholder: '请选择时间',
53
+      type: 'datepicker',
54
+    },
55
+  ];
56
+
57
+  const toGroupRoomActivityDetail = dynamicId => () => {
58
+    router.push({
59
+      pathname: '/activity/groupRoomActivity/detail',
60
+      query: {
61
+        dynamicId,
62
+      },
63
+    });
64
+  };
65
+
66
+  // 跳转到编辑
67
+  const toGroupRoomActivityEdit = dynamicId => {
68
+    router.push({
69
+      pathname: '/activity/groupRoomActivity/edit',
70
+      query: {
71
+        dynamicId,
72
+      },
73
+    });
74
+  };
75
+
76
+  //   置顶
77
+  const topDynamic = row => () => {
78
+    const weight = Math.abs(row.weight - 1);
79
+    request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } })
80
+      .then(data => {
81
+        message.info('操作成功!');
82
+        ref.current.reload();
83
+      })
84
+      .catch(err => {
85
+        console.log(err);
86
+        message.info(err.msg || err.message);
87
+      });
88
+  };
89
+
90
+  //   推首页
91
+  const homeDynamic = row => () => {
92
+    const home = Math.abs(row.home - 1);
93
+    request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } })
94
+      .then(data => {
95
+        message.info('操作成功!');
96
+        ref.current.reload();
97
+      })
98
+      .catch(err => {
99
+        console.log(err);
100
+        message.info(err.msg || err.message);
101
+      });
102
+  };
103
+
104
+  //结束活动
105
+  const finishDynamic = row => {
106
+    Modal.confirm({
107
+      title:
108
+        '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
109
+      okText: '确定',
110
+      cancelText: '取消',
111
+      onOk() {
112
+        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } })
113
+          .then(data => {
114
+            message.info('操作成功!');
115
+            ref.current.reload();
116
+          })
117
+          .catch(err => {
118
+            console.log(err);
119
+            message.info(err.msg || err.message);
120
+          });
121
+      },
122
+    });
123
+  };
124
+
125
+  // 发布活动
126
+  const sendDynamic = row => {
127
+    Modal.confirm({
128
+      title: '确定发布吗?',
129
+      okText: '确认',
130
+      cancelText: '取消',
131
+      onOk() {
132
+        request({ ...apis.activity.send, urlData: { id: row.dynamicId } })
133
+          .then(data => {
134
+            message.info('操作成功!');
135
+            ref.current.reload();
136
+          })
137
+          .catch(err => {
138
+            console.log(err);
139
+            message.info(err.msg || err.message);
140
+          });
141
+      },
142
+    });
143
+  };
144
+
145
+  // 取消活动
146
+  const cancelDynamic = row => {
147
+    Modal.confirm({
148
+      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
149
+      okText: '确认',
150
+      cancelText: '取消',
151
+      onOk() {
152
+        request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } })
153
+          .then(data => {
154
+            message.info('操作成功!');
155
+            ref.current.reload();
156
+          })
157
+          .catch(err => {
158
+            console.log(err);
159
+            message.info(err.msg || err.message);
160
+          });
161
+      },
162
+    });
163
+  };
164
+
165
+  //   发布or取消发布
166
+  const sendOrPublicDynamic = row => {
167
+    if (row.status === 1) {
168
+      cancelDynamic(row);
169
+    } else {
170
+      sendDynamic(row);
171
+    }
172
+  };
173
+
174
+  const getJoinPeople = dynamicId => () => {
175
+    router.push({
176
+      pathname: '/activity/groupRoomActivity/registrationRecord',
177
+      query: {
178
+        dynamicId,
179
+      },
180
+    });
181
+  };
182
+
183
+  const columns = [
184
+    {
185
+      title: '活动标题',
186
+      dataIndex: 'title',
187
+      key: 'title',
188
+      align: 'center',
189
+      width: '20%',
190
+      render: (x, row) => (
191
+        <Navigate onClick={toGroupRoomActivityDetail(row.dynamicId)}>
192
+          <Typography.Text ellipsis>{row.title}</Typography.Text>
193
+        </Navigate>
194
+      ),
195
+    },
196
+    {
197
+      title: '活动时间',
198
+      dataIndex: 'startDate',
199
+      key: 'startDate',
200
+      align: 'center',
201
+      width: '15%',
202
+      // width: '20%',
203
+      render: (x, row) => (
204
+        <>
205
+          <span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format(
206
+            'YYYY-MM-DD',
207
+          )}`}</span>
208
+        </>
209
+      ),
210
+    },
211
+    {
212
+      title: '已参与人数',
213
+      dataIndex: 'count',
214
+      key: 'count',
215
+      align: 'center',
216
+      render: (x, row) => <Navigate onClick={getJoinPeople(row.dynamicId)}>{row.count}</Navigate>,
217
+    },
218
+    // {
219
+    //   title: '阅读量',
220
+    //   dataIndex: 'pvNum',
221
+    //   key: 'pvNum',
222
+    //   align: 'center',
223
+    //   // width: '10%',
224
+    // },
225
+    // {
226
+    //   title: '转发量',
227
+    //   dataIndex: 'shareNum',
228
+    //   key: 'shareNum',
229
+    //   align: 'center',
230
+    //   // width: '10%',
231
+    // },
232
+    // {
233
+    //   title: '收藏数',
234
+    //   dataIndex: 'saveNum',
235
+    //   key: 'saveNum',
236
+    //   align: 'center',
237
+    //   // width: '10%',
238
+    // },
239
+    {
240
+      title: '报名状态',
241
+      dataIndex: 'activityStatus',
242
+      key: 'activityStatus',
243
+      align: 'center',
244
+      render: activityStatus =>
245
+        activityStatus == 0 ? '进行中' : activityStatus == 1 ? '未开始' : '已结束',
246
+    },
247
+    {
248
+      title: '权重',
249
+      dataIndex: 'heavy',
250
+      key: 'heavy',
251
+      align: 'center',
252
+    },
253
+    {
254
+      title: '操作',
255
+      dataIndex: 'handle',
256
+      key: 'handle',
257
+      align: 'center',
258
+      render: withActions((x, row) => [
259
+        <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
260
+          <EditIcon
261
+            type={row.status === 1 ? 'cancel' : 'publish'}
262
+            text={row.status === 1 ? '取消发布' : '发布'}
263
+            onClick={() => sendOrPublicDynamic(row)}
264
+          />
265
+        </AuthButton>,
266
+
267
+        // //   <EditIcon type="look" text="查看详情" onClick={toGroupRoomActivityDetail(row.dynamicId)} />,
268
+
269
+        row.activityStatus === 0 ? (
270
+          <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
271
+            <EditIcon type="end" text="结束活动" onClick={finishDynamic.bind(this, row)} />
272
+          </AuthButton>
273
+        ) : null,
274
+
275
+        <AuthButton name="admin.buildingDynamic.tag" noRight={null}>
276
+          <EditIcon
277
+            type={row.weight === 1 ? 'cancel' : 'add'}
278
+            text={row.weight === 1 ? '取消标签' : '添加标签'}
279
+            onClick={topDynamic(row)}
280
+          />
281
+        </AuthButton>,
282
+
283
+        <EditIcon
284
+          type={row.home === 1 ? 'cancel' : 'top'}
285
+          text={row.home === 1 ? '取消推首页' : '推荐首页'}
286
+          onClick={homeDynamic(row)}
287
+        />,
288
+
289
+        //   <AuthButton name="admin.buildingDynamic.dataRecord" noRight={null}>
290
+        //     <EditIcon type="record" text="数据记录" onClick={toDataReacord(row.dynamicId)} />
291
+        //   </AuthButton>,
292
+
293
+        row.activityStatus === 0 || row.activityStatus === 1 ? (
294
+          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
295
+            <EditIcon
296
+              type="edit"
297
+              text="编辑"
298
+              onClick={() => toGroupRoomActivityEdit(row.dynamicId, row.count)}
299
+            />
300
+          </AuthButton>
301
+        ) : null,
302
+      ]),
303
+    },
304
+  ];
305
+
306
+  const actionRender = () => {
307
+    return (
308
+      <Button type="primary" icon="plus" onClick={() => toGroupRoomActivityEdit()}>
309
+        新增
310
+      </Button>
311
+    );
312
+  };
313
+
314
+  return (
315
+    <QueryTable
316
+      ref={ref}
317
+      rowKey="dynamicId"
318
+      api={apis.activity.list}
319
+      searchFields={searchFields}
320
+      columns={columns}
321
+      postData={data => {
322
+        data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
323
+        return data;
324
+      }}
325
+      actionRender={actionRender}
326
+      // onPageChange={(pg) => setPage(pg)}
327
+    />
328
+  );
329
+};
330
+
331
+export default GroupRoomActivity;

+ 213
- 0
src/pages/activity/groupRoomActivity/registrationRecord.jsx Parādīt failu

@@ -0,0 +1,213 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Table, Card } from 'antd';
3
+
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import apis from '@/services/apis';
7
+import request from '@/utils/request';
8
+
9
+const { Option } = Select;
10
+
11
+/**
12
+ *
13
+ *
14
+ * @param {*} props
15
+ * @returns
16
+ */
17
+
18
+const columns = [
19
+  {
20
+    title: '用户姓名',
21
+    dataIndex: 'name',
22
+    key: 'name',
23
+    align: 'center',
24
+  },
25
+  {
26
+    title: '手机号',
27
+    dataIndex: 'phone',
28
+    key: 'phone',
29
+    align: 'center',
30
+  },
31
+  {
32
+    title: '参与人数',
33
+    dataIndex: 'attendNum',
34
+    key: 'attendNum',
35
+    align: 'center',
36
+  },
37
+  {
38
+    title: '报名时间',
39
+    dataIndex: 'createDate',
40
+    key: 'createDate',
41
+    align: 'center',
42
+    render: (x, row) => (
43
+      <>
44
+        <span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span>
45
+      </>
46
+    ),
47
+  },
48
+  {
49
+    title: '推广人员',
50
+    dataIndex: 'sharePersonName',
51
+    key: 'sharePersonName',
52
+    align: 'center',
53
+  },
54
+  {
55
+    title: '公司',
56
+    dataIndex: 'orgName',
57
+    key: 'orgName',
58
+    align: 'center',
59
+  },
60
+  {
61
+    title: '状态',
62
+    dataIndex: 'isCheckin',
63
+    key: 'isCheckin',
64
+    align: 'center',
65
+    render: (x, row) => (
66
+      <>
67
+        <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
+      </>
69
+    ),
70
+  },
71
+];
72
+
73
+const header = props => {
74
+  const [data, setData] = useState({ list: {} });
75
+  const [loading, setLoading] = useState(false);
76
+  
77
+  //   const [page, changePage] = useState({})
78
+  // 存入导入数据的值
79
+  const { getFieldDecorator, getFieldsValue } = props.form;
80
+  // eslint-disable-next-line react-hooks/rules-of-hooks
81
+  useEffect(() => {
82
+    // eslint-disable-next-line no-use-before-define
83
+    getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId });
84
+  }, []);
85
+
86
+  // 查询列表
87
+  const getSignList = params => {
88
+    // eslint-disable-next-line no-shadow
89
+    setLoading(true)
90
+    request({ ...apis.activity.signList, params: { ...params } }).then(data => {
91
+     
92
+      setData(data);
93
+      setLoading(false)
94
+    });
95
+  };
96
+
97
+  const changePageNum = pageNumber => {
98
+    getSignList({ pageNum: pageNumber, pageSize: 10, dynamicId: props.location.query.dynamicId });
99
+  };
100
+
101
+  const toActivityList = () => {
102
+    router.go('-1')
103
+  };
104
+  // 提交事件
105
+  // eslint-disable-next-line no-shadow
106
+  const handleSubmit = (e, props) => {
107
+    e.preventDefault();
108
+    props.form.validateFields((err, values) => {
109
+      getSignList({
110
+        pageNum: 1,
111
+        pageSize: 10,
112
+        dynamicId: props.location.query.dynamicId,
113
+        isCheckin: values.isCheckin,
114
+        name: values.name,
115
+        phone: values.phone,
116
+      });
117
+    });
118
+  };
119
+  // 重置搜索
120
+  function handleReset() {
121
+    props.form.resetFields();
122
+    getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId });
123
+  }
124
+  // eslint-disable-next-line class-methods-use-this
125
+  function exportHelp() {
126
+    const fieldsValue = getFieldsValue();
127
+    console.log('fieldsValue', fieldsValue);
128
+    request({
129
+      ...apis.activity.getTaActivityDynamicEnlistExport,
130
+      params: { ...fieldsValue, dynamicId: props.location.query.dynamicId },
131
+    })
132
+      .then(data => {
133
+        if (!data) {
134
+          return;
135
+        }
136
+        const url = window.URL.createObjectURL(new Blob([data]));
137
+        const link = document.createElement('a');
138
+        link.style.display = 'none';
139
+        link.href = url;
140
+        link.setAttribute('download', '报名列表.xlsx');
141
+        document.body.append(link);
142
+        link.click();
143
+      })
144
+      .catch(() => {});
145
+  }
146
+
147
+  return (
148
+    <Card>
149
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
150
+        <Form.Item>
151
+          {getFieldDecorator('isCheckin')(
152
+            <Select style={{ width: '180px' }} placeholder="签到状态">
153
+              <Option value="0">未签到</Option>
154
+              <Option value="1">已签到</Option>
155
+            </Select>,
156
+          )}
157
+        </Form.Item>
158
+        <Form.Item>
159
+          {getFieldDecorator('name')(
160
+            <Input
161
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
162
+              placeholder="用户姓名"
163
+            />,
164
+          )}
165
+        </Form.Item>
166
+        <Form.Item>
167
+          {getFieldDecorator('phone')(
168
+            <Input
169
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
170
+              placeholder="手机号"
171
+            />,
172
+          )}
173
+        </Form.Item>
174
+        <Form.Item>
175
+          <Button type="primary" htmlType="submit">
176
+            搜索
177
+          </Button>
178
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
179
+            重置
180
+          </Button>
181
+        </Form.Item>
182
+        <Button style={{ position: 'absolute', right: '30px' }} onClick={toActivityList}>
183
+          返回
184
+        </Button>
185
+      </Form>
186
+
187
+      <div style={{ textAlign: 'right', margin: '6px 0 10px 0' }}>
188
+        {' '}
189
+        <Button
190
+          name="admin.activityDynamicEnlist.export.get"
191
+          noRight={null}
192
+          type="primary"
193
+          onClick={exportHelp}
194
+        >
195
+          导出
196
+        </Button>
197
+      </div>
198
+      <Table
199
+        dataSource={data.list.data}
200
+        columns={columns}
201
+        pagination={{ total: data.total, onChange: changePageNum }}
202
+        loading={loading}
203
+        rowKey="activity"
204
+      />
205
+      {/* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
206
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
207
+      </div> */}
208
+    </Card>
209
+  );
210
+};
211
+const WrappedHeader = Form.create({ name: 'header' })(header);
212
+
213
+export default WrappedHeader;

+ 0
- 15
src/pages/activity/helpActivity/helpActivityRecord.jsx Parādīt failu

@@ -1,15 +0,0 @@
1
-import React from 'react';
2
-import DataRecord from '../dataRecord/index'
3
-import Prompt from 'umi/prompt';
4
-
5
-const header = props =>{
6
-    const id = props.location.query.id
7
-    // type:'help;',
8
-    return <><DataRecord  id = {id} activeType = "help"/>
9
-    <Prompt message={location =>
10
-        location.pathname.startsWith("/activity/helpActivity")
11
-          ? true
12
-          : localStorage.removeItem("helpActivePageParams")} /></>
13
-}
14
-
15
-export default header

+ 0
- 547
src/pages/activity/helpActivity/helpRecord.jsx Parādīt failu

@@ -1,547 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, message } from 'antd';
3
-import moment from 'moment';
4
-import request from '../../../utils/request';
5
-import apis from '../../../services/apis';
6
-import router from 'umi/router';
7
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
8
-import AuthButton from '@/components/AuthButton';
9
-
10
-
11
-const { Option } = Select;
12
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
13
-const { Meta } = Card;
14
-
15
-/**
16
- * 助力者弹框
17
- */
18
-class InviteTable extends React.Component {
19
-  constructor(props) {
20
-    super(props);
21
-    this.state = {
22
-      dataSource: { records: [] },
23
-      visibleData: { visible: false, helpId: '', realtyConsultant: '' },
24
-    }
25
-  }
26
-
27
-  // 挂载之后
28
-  componentDidMount() {
29
-    const { helpId } = this.state.visibleData
30
-    this.getList({ helpRecordInitiateId: helpId, pageNum: 1, pageSize: 5 })
31
-  }
32
-
33
-  componentDidUpdate(preProps, preState) {
34
-    const { helpId } = this.state.visibleData
35
-    if (this.props.visibleData.visible !== preState.visibleData.visible) {
36
-      this.getList({ helpRecordInitiateId: helpId, pageNum: 1, pageSize: 5 })
37
-      this.setState({ visibleData: this.props.visibleData });
38
-    }
39
-  }
40
-
41
-  // 弹框确定按钮
42
-  // eslint-disable-next-line react/sort-comp
43
-  handleOk() {
44
-    this.setState({ visibleData: { visible: false, helpId: '', realtyConsultant: '' } })
45
-    this.props.onCancel()
46
-  }
47
-
48
-  // 弹框取消按钮
49
-  handleCancel() {
50
-    this.setState({ visibleData: { visible: false, helpId: '', realtyConsultant: '' } })
51
-    this.props.onCancel()
52
-  }
53
-
54
-  getList(params) {
55
-    if (params.helpRecordInitiateId === '') {
56
-      return
57
-    }
58
-    request({ ...apis.helpActivity.helpPeopleDetails, params: { ...params } }).then(res => {
59
-      this.setState({ dataSource: res })
60
-    }).catch(err => {
61
-      // eslint-disable-next-line no-unused-expressions
62
-      <Alert
63
-        style={{
64
-          marginBottom: 24,
65
-        }}
66
-        message={err}
67
-        type="error"
68
-        showIcon
69
-      />
70
-    })
71
-  }
72
-
73
-  // eslint-disable-next-line class-methods-use-this
74
-  exportHelp() {
75
-    request({ ...apis.helpActivity.gethelpRecordExport, responseType: 'blob', params: { helpRecordInitiateId: this.state.visibleData.helpId } })
76
-      .then(data => {
77
-        if (!data) {
78
-          return
79
-        }
80
-        const url = window.URL.createObjectURL(new Blob([data]))
81
-        const link = document.createElement('a')
82
-        link.style.display = 'none'
83
-        link.href = url
84
-        link.setAttribute('download', '助力者记录.xlsx')
85
-        document.body.append(link)
86
-        link.click()
87
-      }).catch(() => {
88
-
89
-      })
90
-  }
91
-
92
-
93
-  // 分页
94
-  // eslint-disable-next-line react/sort-comp
95
-  onChange(pageNum) {
96
-    const { helpId } = this.state.visibleData
97
-    this.getList({ helpRecordInitiateId: helpId, pageNum: pageNum, pageSize: 5 })
98
-  }
99
-
100
-  render() {
101
-    const columns = [
102
-      {
103
-        title: '用户姓名',
104
-        dataIndex: 'name',
105
-        key: 'name',
106
-        align: 'center',
107
-      },
108
-      {
109
-        title: '手机号',
110
-        dataIndex: 'phone',
111
-        key: 'phone',
112
-        align: 'center',
113
-        render: text => <a>{text}</a>,
114
-      },
115
-      {
116
-        title: '助力时间',
117
-        dataIndex: 'createDate',
118
-        key: 'createDate',
119
-        align: 'center',
120
-        render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
121
-      },
122
-    ]
123
-    return (
124
-      <>
125
-        <Modal
126
-          title="助力者"
127
-          destroyOnClose="true"
128
-          width={900}
129
-          footer={null}
130
-          visible={this.state.visibleData.visible}
131
-          // onOk={() => this.handleOk()}
132
-          onCancel={e => this.handleCancel(e)}
133
-        >
134
-
135
-          <Button name="admin.HelpInitiateRecordSucceed.export.get" noRight={null} type="primary" onClick={() => this.exportHelp()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
136
-            导出
137
-      </Button>
138
-          <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
139
-        </Modal>
140
-      </>
141
-    );
142
-  }
143
-}
144
-
145
-
146
-/**
147
- * 核销弹框
148
- */
149
-class Verifier extends React.Component {
150
-  constructor(props) {
151
-    super(props);
152
-    this.state = {
153
-      verification: { verificationCode: '' },
154
-      visibleData: { visible: false, helpId: '', helpActivityId: '', helpRecordInitiateId: '', verificationCode: '' },
155
-    }
156
-  }
157
-
158
-  // 挂载之后
159
-  componentDidMount() {
160
-    const { helpId } = this.state.visibleData
161
-  }
162
-
163
-  componentDidUpdate(preProps, preState) {
164
-    const { helpId } = this.state.visibleData
165
-    if (this.props.visibleData.visible !== preState.visibleData.visible) {
166
-      // eslint-disable-next-line react/no-did-update-set-state
167
-      this.setState({ visibleData: { ...this.props.visibleData } })
168
-    }
169
-  }
170
-
171
-  // 弹框确定按钮
172
-  // eslint-disable-next-line react/sort-comp
173
-  handleOk() {
174
-    this.setState({ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' } })
175
-  }
176
-
177
-  // 弹框取消按钮
178
-  handleCancel() {
179
-    console.log('核销关闭');
180
-    // this.setState({ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' } })
181
-    this.props.onCancel()
182
-  }
183
-
184
-  // eslint-disable-next-line class-methods-use-this
185
-  audit(params) {
186
-    request({ ...apis.helpActivity.verification, params: { ...params } }).then(res => {
187
-      // eslint-disable-next-line no-undef
188
-      message.info('核销成功')
189
-      this.props.onSuccess({ pageNumber: 1, pageSize: 10, helpActivityId: this.props.visibleData.helpActivityId, status: 'helpSucceed' })
190
-    }).catch(err => {
191
-      // eslint-disable-next-line no-unused-expressions
192
-      <Alert
193
-        style={{
194
-          marginBottom: 24,
195
-        }}
196
-        message={err}
197
-        type="error"
198
-        showIcon
199
-      />
200
-    })
201
-  }
202
-
203
-  // eslint-disable-next-line class-methods-use-this
204
-  verify(e) {
205
-    this.setState({ visibleData: { visible: true, helpId: this.props.visibleData.helpId, verificationCode: e.target.value } })
206
-  }
207
-
208
-  // eslint-disable-next-line class-methods-use-this
209
-  verification(e) {
210
-    this.audit({ helpRecordInitiateId: this.state.visibleData.helpId, verifyCode: this.state.visibleData.verificationCode })
211
-  }
212
-
213
-  render() {
214
-    return (
215
-      <>
216
-        <Modal
217
-          title="核销"
218
-          destroyOnClose="true"
219
-          width={300}
220
-          footer={null}
221
-          visible={this.state.visibleData.visible}
222
-          // onOk={() => this.handleOk()}
223
-          onCancel={e => this.handleCancel(e)}
224
-        >
225
-          <div><span>核销码:<input style={{ marginLeft: '10px' }} onChange={this.verify.bind(this)} /></span>
226
-            <Button name="admin.helpInitiateRecordVerify.post" noRight={null} onClick={e => this.verification(e)} style={{ marginLeft: '80px', marginTop: '10px', backgroundColor: 'red' }}><span style={{ color: 'white' }}>立即核销</span></Button>
227
-          </div>
228
-        </Modal>
229
-      </>
230
-    );
231
-  }
232
-}
233
-
234
-/**
235
- *主体列表
236
- *
237
- * @param {*} props
238
- * @returns
239
- */
240
-function body(props) {
241
-  // eslint-disable-next-line react-hooks/rules-of-hooks
242
-  const [gInviteData, setGInviteData] = useState({ visible: false, helpId: '', realtyConsultant: '' })
243
-
244
-  // 核销码弹框
245
-  // eslint-disable-next-line react-hooks/rules-of-hooks
246
-  const [gVerifierData, setVerifierData] = useState({ visible: false, helpId: '', helpActivityId: '', helpRecordInitiateId: '', verificationCode: '' })
247
-
248
-  const { getFieldDecorator, getFieldsValue } = props.form
249
-
250
-  // eslint-disable-next-line react-hooks/rules-of-hooks
251
-  const [dataSource, setDataSource] = useState({ records: [] })
252
-  // eslint-disable-next-line react-hooks/rules-of-hooks
253
-  // const [columns, setColumns] = useState(privateColumns)
254
-
255
-  // 默认成功
256
-  // eslint-disable-next-line react-hooks/rules-of-hooks
257
-  const [customerType, setCustomerType] = useState('helpSucceed')
258
-
259
-  // 调整归属 ============  start
260
-  // eslint-disable-next-line react-hooks/rules-of-hooks
261
-  const [gVisibleData, setGVisibleData] = useState({ visible: false, helpId: '', realtyConsultant: '' })
262
-
263
-
264
-  // 变更状态 ============= end
265
-
266
-  // eslint-disable-next-line react-hooks/rules-of-hooks
267
-  const { helpActivityId } = props.location.query
268
-  useEffect(() => {
269
-    console.log('customerType', customerType)
270
-    getList({ pageNum: 1, pageSize: 10, status: customerType, helpActivityId })
271
-  }, [])
272
-
273
-  function getList(params) {
274
-    // 网路请求
275
-    request({ ...apis.helpActivity.record, params: { ...params } }).then(res => {
276
-      setDataSource(res)
277
-    }).catch(err => {
278
-      // eslint-disable-next-line no-unused-expressions
279
-      <Alert
280
-        style={{
281
-          marginBottom: 24,
282
-        }}
283
-        message={err}
284
-        type="error"
285
-        showIcon
286
-      />
287
-    })
288
-  }
289
-
290
-  function displayNone() {
291
-    setGVisibleData({ visible: false, helpId: '', realtyConsultant: '' })
292
-  }
293
-
294
-  // 提交事件
295
-  function handleSubmit(e) {
296
-    // displayNone()
297
-
298
-
299
-    e.preventDefault();
300
-    props.form.validateFields((err, values) => {
301
-      if (!err) {
302
-        getList({ pageNum: 1, pageSize: 10, status: customerType, ...values, helpActivityId })
303
-      }
304
-    });
305
-  }
306
-
307
-  // Change 事件
308
-  function handleSelectChange(e) {
309
-    // eslint-disable-next-line no-console
310
-    console.log(e)
311
-  }
312
-
313
-  // 分页
314
-  function onChange(pageNum) {
315
-    // eslint-disable-next-line react-hooks/rules-of-hooks
316
-    getList({ pageNum: pageNum, pageSize: 10, status: customerType, helpActivityId })
317
-  }
318
-
319
-  // 助力成功/进行中/助力失败
320
-  function radioButtonHandleSizeChange(e) {
321
-    setGInviteData({ visible: false, helpId: '', realtyConsultant: '' })
322
-    setVerifierData({ visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' })
323
-    // displayNone()
324
-
325
-    const { value } = e.target
326
-    setCustomerType(value)
327
-    // setColumns(value === 'helpSucceed' ? privateColumns : publicColumns)
328
-    getList({ pageNum: 1, pageSize: 10, status: value, helpActivityId })
329
-  }
330
-
331
-  function handleReset() {
332
-    props.form.resetFields();
333
-    getList({ pageNum: 1, pageSize: 10, status: customerType, helpActivityId })
334
-  }
335
-
336
-  function toCustomerDateil(record) {
337
-    router.push({
338
-      pathname: '/customer/customerlist/customerDetail',
339
-      query: {
340
-        id: record.customerId,
341
-      },
342
-    });
343
-  }
344
-
345
-  function exportCustomer() {
346
-    const fieldsValue = getFieldsValue()
347
-    request({ ...apis.helpActivity.HelpInitiateRecordSucceed, responseType: 'blob', params: { ...fieldsValue, customerType, helpActivityId, condition: customerType } })
348
-      .then(response => {
349
-        download(response)
350
-      }).catch(error => {
351
-
352
-      })
353
-  }
354
-
355
-  function download(data) {
356
-    if (!data) {
357
-      return
358
-    }
359
-    const url = window.URL.createObjectURL(new Blob([data]))
360
-    const link = document.createElement('a')
361
-    link.style.display = 'none'
362
-    link.href = url
363
-    link.setAttribute('download', '助力记录.xlsx')
364
-    document.body.append(link)
365
-    link.click()
366
-  }
367
-
368
-  // 助力记录弹框
369
-  function helpRecord(row) {
370
-    setVerifierData({ visible: false, helpId: row.helpRecordInitiateId, elpRecordInitiateId: '', verificationCode: '' })
371
-    setGInviteData({ visible: true, helpId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
372
-  }
373
-  // 核销
374
-  function helpInitiateRecordVerify(row) {
375
-    // 关闭助力记录弹框
376
-    setGInviteData({ visible: false, helpId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
377
-
378
-    // 核销
379
-    setVerifierData({ visible: true, helpId: row.helpRecordInitiateId, helpActivityId: row.helpActivityId, elpRecordInitiateId: '', verificationCode: '' })
380
-  }
381
-  // 核销回调
382
-  function onSuccess(e) {
383
-    console.log('回调:', e)
384
-    getList(e)
385
-
386
-    // 关闭
387
-    onCancel()
388
-  }
389
-
390
-  function onCancel(e) {
391
-    // 核销
392
-    setVerifierData({ visible: false, helpId: '', helpActivityId: '', elpRecordInitiateId: '', verificationCode: '' })
393
-    // 助力者
394
-    setGInviteData({ visible: false, helpId: '', realtyConsultant: '' })
395
-  }
396
-
397
-  // 返回到首页
398
-  function returList(params) {
399
-    router.push({
400
-      pathname: '/activity/helpActivity/list',
401
-    });
402
-  }
403
-
404
-  const publicColumns = [
405
-    {
406
-      title: '发起者',
407
-      dataIndex: 'name',
408
-      key: 'name',
409
-      align: 'center',
410
-      width: '15%',
411
-    },
412
-    {
413
-      title: '发起者手机号',
414
-      dataIndex: 'phone',
415
-      key: 'phone',
416
-      align: 'center',
417
-      width: '10%',
418
-    },
419
-    {
420
-      title: '发起时间',
421
-      dataIndex: 'createDate',
422
-      key: 'createDate',
423
-      align: 'center',
424
-      width: '15%',
425
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
426
-    },
427
-    {
428
-      title: '助力者',
429
-      dataIndex: 'helpCount',
430
-      key: 'helpCount',
431
-      align: 'center',
432
-      width: '15%',
433
-      render: (text, record) => <a style={{ color: '#66B3FF' }} onClick={() => helpRecord(record)}>{record.helpCount}/{record.persionNumCount}</a>,
434
-    },
435
-  ]
436
-
437
-  const privateColumns = [
438
-    {
439
-      title: '发起者',
440
-      dataIndex: 'name',
441
-      key: 'name',
442
-      align: 'center',
443
-      width: '15%',
444
-      // render: (_, record) => <Avatar shape="square" src={customerType === 'helpSucceed' ? record.picture : record.avatarurl} size={64} icon="user" />,
445
-    },
446
-    {
447
-      title: '手机号',
448
-      dataIndex: 'phone',
449
-      key: 'phone',
450
-      align: 'center',
451
-      width: '10%',
452
-      // eslint-disable-next-line no-nested-ternary
453
-      // render: (_, record) => <><span>{customerType === 'helpSucceed' ? record.name : record.nickname}</span></>,
454
-    },
455
-    {
456
-      title: '发起时间',
457
-      dataIndex: 'createDate',
458
-      key: 'createDate',
459
-      align: 'center',
460
-      width: '10%',
461
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
462
-      // eslint-disable-next-line no-nested-ternary
463
-    },
464
-    {
465
-      title: '助力者',
466
-      dataIndex: 'helpCount',
467
-      key: 'helpCount',
468
-      align: 'center',
469
-      width: '15%',
470
-      render: (text, record) => <a style={{ color: '#66B3FF' }} onClick={() => helpRecord(record)}>{record.helpCount}人</a>,
471
-    },
472
-    {
473
-      title: '核销状态',
474
-      dataIndex: 'reportRecommendStatus',
475
-      key: 'reportRecommendStatus',
476
-      align: 'center',
477
-      width: '10%',
478
-      // eslint-disable-next-line no-nested-ternary
479
-      render: (text, records) => {
480
-        if (records.verificationStatus === 0 || records.verificationStatus === null) { return '未核销' }
481
-        if (records.verificationStatus === 1) { return '已核销' }
482
-      },
483
-    },
484
-    {
485
-      title: '操作',
486
-      align: 'center',
487
-      width: '25%',
488
-      render: (x, row) => (
489
-        <>
490
-          {row.verificationStatus === 0 &&
491
-            <AuthButton name="admin.SignList.get" noRight={null}>
492
-              <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={() => helpInitiateRecordVerify(row)}>核销</span>
493
-            </AuthButton>
494
-          }
495
-        </>
496
-      ),
497
-    },
498
-  ]
499
-
500
-  return (
501
-    <>
502
-      {console.log('customerType', customerType)}
503
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
504
-        <Form.Item>
505
-          {getFieldDecorator('tel')(
506
-            <Input
507
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
508
-              placeholder="电话"
509
-            />,
510
-          )}
511
-        </Form.Item>
512
-        <Form.Item>
513
-          <Button type="primary" htmlType="submit" >
514
-            搜索
515
-            </Button>
516
-          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
517
-            重置
518
-            </Button>
519
-        </Form.Item>
520
-        <Button style={{ float: 'right' }} onClick={returList}>
521
-          返回
522
-        </Button>
523
-      </Form>
524
-      <Button name="admin.helpRecord.export.get" noRight={null} type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
525
-        导出
526
-      </Button>
527
-
528
-      <div style={{ margin: '20px 0' }}>
529
-        <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
530
-          <Radio.Button value="helpSucceed">助力成功</Radio.Button>
531
-          <Radio.Button value="helpUnderway">进行中</Radio.Button>
532
-          <Radio.Button value="helpUnfinished">助力失败</Radio.Button>
533
-        </Radio.Group>
534
-      </div>
535
-      {customerType === 'helpSucceed' ?
536
-        <Table dataSource={dataSource.list} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
537
-        <Table dataSource={dataSource.list} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" />
538
-      }
539
-      <Verifier visibleData={gVerifierData} onSuccess={e => onSuccess(e)} onCancel={(e) => onCancel(e)} />
540
-      <InviteTable visibleData={gInviteData} onSuccess={e => onSuccess(e)} onCancel={(e) => onCancel(e)} />
541
-    </>
542
-  );
543
-}
544
-
545
-const WrappedBody = Form.create({ name: 'body' })(body);
546
-
547
-export default WrappedBody

+ 0
- 372
src/pages/activity/helpActivity/list.jsx Parādīt failu

@@ -1,372 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Pagination, Typography, Modal, DatePicker } from 'antd';
3
-import router from 'umi/router';
4
-import moment from 'moment';
5
-import AuthButton from '@/components/AuthButton';
6
-import withActions from '@/components/ActionList';
7
-import EditIcon from '@/components/EditIcon';
8
-import Navigate from '@/components/Navigate';
9
-import Prompt from 'umi/prompt';
10
-import SelectCity from '../../../components/SelectButton/CitySelect'
11
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
12
-import apis from '../../../services/apis';
13
-import request from '../../../utils/request';
14
-import styles from '../../style/GoodsList.less';
15
-
16
-const { Option } = Select;
17
-
18
-const header = props => {
19
-  const [data, setData] = useState({})
20
-  //   const [page, changePage] = useState({})
21
-
22
-  useEffect(() => {
23
-    if (localStorage.getItem("helpActivePageParams")) {
24
-      // props.form.setFieldsValue(JSON.parse(localStorage.getItem("helpActivePageParams")));
25
-      // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
26
-      const localStorageValue = JSON.parse(localStorage.getItem("helpActivePageParams"))
27
-      localStorageValue.startTime = localStorageValue.startTime ? moment(localStorageValue.startTime) : ''
28
-      localStorageValue.endTime = localStorageValue.endTime ? moment(localStorageValue.endTime) : ''
29
-
30
-      props.form.setFieldsValue(localStorageValue);
31
-      getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
32
-    } else {
33
-      localStorage.setItem("helpActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
34
-      getList({ pageNum: 1, pageSize: 10 });
35
-    }
36
-  }, [])
37
-
38
-  // 查询列表
39
-  const getList = (params) => {
40
-    request({ ...apis.helpActivity.list, params: { ...params } }).then((data) => {
41
-      console.log(data)
42
-      setData(data)
43
-    })
44
-  }
45
-
46
-
47
-  // 跳转到助力新增
48
-  const toEditGoods = (helpActivityId) => () => {
49
-    router.push({
50
-      pathname: '/activity/helpActivity/edithelpActivity',
51
-      query: {
52
-        helpActivityId
53
-      },
54
-    });
55
-  }
56
-
57
-  const getActivityDetail = (helpActivityId) => () => {
58
-    router.push({
59
-      pathname: '/activity/helpActivity/detailActivity',
60
-      query: {
61
-        helpActivityId,
62
-      },
63
-    });
64
-  }
65
-
66
-  const getJoinPeople = (helpActivityId) => () => {
67
-    router.push({
68
-      pathname: '/activity/helpActivity/helpRecord',
69
-      query: {
70
-        helpActivityId,
71
-      },
72
-    });
73
-  }
74
-
75
-
76
-  /**
77
-   *
78
-   *
79
-   * @param {*} props
80
-   * @returns
81
-   */
82
-
83
-  const columns = [
84
-    {
85
-      title: '活动标题',
86
-      dataIndex: 'title',
87
-      key: 'title',
88
-      align: 'center',
89
-      render: (x, row) => <Navigate onClick={getActivityDetail(row.helpActivityId)}><Typography.Text ellipsis>{row.title}</Typography.Text></Navigate>,
90
-    },
91
-    {
92
-      title: '活动时间',
93
-      dataIndex: 'startDate',
94
-      key: 'startDate',
95
-      align: 'center',
96
-      render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD HH:mm:ss')} —— ${moment(row.endDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
97
-    },
98
-    {
99
-      title: '已参与人数',
100
-      dataIndex: 'enlistNum',
101
-      key: 'enlistNum',
102
-      align: 'center',
103
-      render: (x, row) => <><div style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: '201px', title: 'content' }}>
104
-        <Navigate onClick={getJoinPeople(row.helpActivityId)}>{row.enlistNum}</Navigate>
105
-      </div></>,
106
-    },
107
-    {
108
-      title: '助力成功数',
109
-      dataIndex: 'succeedCount',
110
-      key: 'succeedCount',
111
-      align: 'center',
112
-    },
113
-    {
114
-      title: '状态',
115
-      dataIndex: 'isEnlist',
116
-      key: 'isEnlist',
117
-      align: 'center',
118
-      render: (text, records) => {
119
-        if (records.activityStatus === 1) { return '未开始' }
120
-        if (records.activityStatus === 0) { return '进行中' }
121
-        if (records.activityStatus === 2) { return '已结束' }
122
-      },
123
-    },
124
-    {
125
-      title: '权重',
126
-      dataIndex: 'heavy',
127
-      key: 'heavy',
128
-      align: 'center',
129
-    },
130
-    {
131
-      title: '操作',
132
-      dataIndex: 'handle',
133
-      key: 'handle',
134
-      align: 'center',
135
-      render: withActions((x, row) => [
136
-        <AuthButton name="admin.help.publish" noRight={null}>
137
-          <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '取消发布' : '发布'} onClick={sendOrPublicDynamic.bind(this, row)} />
138
-        </AuthButton>,
139
-
140
-        row.activityStatus === 0 ?
141
-          <AuthButton name="admin.help.finish" noRight={null}>
142
-            <EditIcon type="end" text="结束活动" onClick={topDynamic(row, 2)} />
143
-          </AuthButton> : null,
144
-
145
-        <EditIcon type="look" text="查看详情" onClick={getActivityDetail(row.helpActivityId)} />,
146
-
147
-        <AuthButton name="admin.help.tag" noRight={null}>
148
-          <EditIcon type={row.weight === 1 ? 'cancel' : 'add'} text={row.weight === 1 ? '取消标签' : '添加标签'} onClick={topDynamic(row, 0)} />
149
-        </AuthButton>,
150
-
151
-        <AuthButton name="admin.help.top" noRight={null}>
152
-          <EditIcon type={row.isMain ? 'cancel' : 'top'} text={row.isMain ? '取消推首页' : '推荐首页'} onClick={topDynamic(row, 1)} />
153
-        </AuthButton>,
154
-
155
-        <AuthButton name="admin.helpActivity.dataRecord" noRight={null}>
156
-          <EditIcon type="record" text="数据记录" onClick={() => toDataReacord(row.helpActivityId)} />
157
-        </AuthButton>,
158
-
159
-        (row.activityStatus === 1 || row.activityStatus === 0) ?
160
-          <AuthButton name="admin.helpActivity.update.put" noRight={null}>
161
-            <EditIcon type="edit" text="编辑" onClick={toEditGoods(row.helpActivityId)} />
162
-          </AuthButton> : null,
163
-      ]),
164
-    },
165
-  ];
166
-
167
-  const toDataReacord = id => {
168
-    router.push({
169
-      pathname: '/activity/helpActivity/helpActivityRecord',
170
-      query: {
171
-        id,
172
-      },
173
-    });
174
-  }
175
-
176
-  const getSignList = helpActivityId => {
177
-    router.push({
178
-      pathname: '/activity/helpActivity/helpRecord',
179
-      query: {
180
-        helpActivityId,
181
-      },
182
-    });
183
-  }
184
-
185
-  const finishDynamic = (row) => {
186
-    Modal.confirm({
187
-      title: '结束以后将无法编辑, 是否继续?',
188
-      okText: '确定',
189
-      cancelText: '取消',
190
-      onOk() {
191
-        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: "" } }).then((data) => {
192
-          console.log(data)
193
-          message.info('操作成功!')
194
-          getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
195
-        }).catch((err) => {
196
-          console.log(err)
197
-          message.info(err.msg || err.message)
198
-        })
199
-      },
200
-    });
201
-  }
202
-
203
-  //   置顶
204
-  const topDynamic = (row, code) => () => {
205
-    const title = code === 2 ? '活动会被强制结束,小程序端无法再发起或参与此拼团,如果不想让客户看到活动,请再点击取消发布按钮' : '是否进行该操作'
206
-
207
-    Modal.confirm({
208
-      title: title,
209
-      okText: '确定',
210
-      cancelText: '取消',
211
-      onOk() {
212
-        request({ ...apis.helpActivity.top, data: { helpActivityId: row.helpActivityId, status: code } }).then((data) => {
213
-          console.log(data)
214
-          message.info('操作成功!')
215
-          getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
216
-        }).catch((err) => {
217
-          console.log(err)
218
-          message.info(err.msg || err.message)
219
-        })
220
-      },
221
-    });
222
-  }
223
-
224
-  const sendOrPublicDynamic = (row) => {
225
-    if (row.status === 1) {
226
-      cancelDynamic(row)
227
-    } else {
228
-      sendDynamic(row)
229
-    }
230
-  }
231
-
232
-  // 取消活动
233
-  const cancelDynamic = (row) => {
234
-    Modal.confirm({
235
-      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
236
-      okText: '确认',
237
-      cancelText: '取消',
238
-      onOk() {
239
-        request({ ...apis.helpActivity.cancel, urlData: { id: row.helpActivityId } }).then((data) => {
240
-          message.info('操作成功!')
241
-          getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
242
-        }).catch((err) => {
243
-          console.log(err)
244
-          message.info(err.msg || err.message)
245
-        })
246
-      }
247
-    });
248
-  }
249
-
250
-  //发布活动
251
-  const sendDynamic = (row) => {
252
-    Modal.confirm({
253
-      title: '确定发布吗?',
254
-      okText: '确认',
255
-      cancelText: '取消',
256
-      onOk() {
257
-        request({ ...apis.helpActivity.send, urlData: { id: row.helpActivityId } }).then((data) => {
258
-          message.info('操作成功!')
259
-          getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
260
-        }).catch(err => {
261
-          console.log(err)
262
-          message.info(err.msg || err.message)
263
-        })
264
-      }
265
-    });
266
-  }
267
-
268
-  const changePageNum = pageNumber => {
269
-    localStorage.setItem("helpActivePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() }));
270
-    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
271
-  }
272
-
273
-  // 提交事件
274
-  const handleSubmit = (e, props) => {
275
-    e.preventDefault();
276
-    props.form.validateFields((err, values) => {
277
-      const startDate = values.startTime === undefined ? null : moment(values.startTime).format('YYYY-MM-DD')
278
-      const endDate = values.endTime === undefined ? null : moment(values.endTime).format('YYYY-MM-DD')
279
-      // 删除时间会传默认值 Invalid date
280
-
281
-      if (!err) {
282
-        console.log('提交数据: ', values)
283
-        localStorage.setItem("helpActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10, ...values, endDate, startDate }));
284
-
285
-        getList({ pageNum: 1, pageSize: 10, ...values, endDate, startDate })
286
-      }
287
-    });
288
-  }
289
-  // 重置搜索
290
-  function handleReset() {
291
-    props.form.resetFields();
292
-    localStorage.setItem("helpActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
293
-    getList({ pageNum: 1, pageSize: 10 })
294
-  }
295
-
296
-
297
-  const { getFieldDecorator } = props.form
298
-  return (
299
-
300
-    <>
301
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
302
-        <Form.Item>
303
-          {getFieldDecorator('cityId')(
304
-            <SelectCity />,
305
-          )}
306
-        </Form.Item>
307
-        <Form.Item>
308
-          {getFieldDecorator('buildingId')(
309
-            <BuildSelect />,
310
-          )}
311
-        </Form.Item>
312
-        <Form.Item>
313
-          {getFieldDecorator('title')(
314
-            <Input
315
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
316
-              placeholder="请输入标题"
317
-            />,
318
-          )}
319
-        </Form.Item>
320
-        <Form.Item>
321
-          {getFieldDecorator('startTime')(
322
-            <DatePicker placeholder="活动开始时间" />,
323
-          )}
324
-        </Form.Item>
325
-        <Form.Item>
326
-          {getFieldDecorator('endTime')(
327
-            <DatePicker placeholder="活动结束时间" />,
328
-          )}
329
-        </Form.Item>
330
-        <Form.Item>
331
-          {getFieldDecorator('activityStatus')(
332
-            <Select style={{ width: '180px' }} placeholder="活动状态">
333
-              <Option value="1">未开始</Option>
334
-              <Option value="0">进行中</Option>
335
-              <Option value="2">已结束</Option>
336
-            </Select>,
337
-          )}
338
-        </Form.Item>
339
-        <Form.Item>
340
-          <AuthButton name="admin.help.search" noRight={null}>
341
-            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
342
-              搜索
343
-          </Button>
344
-          </AuthButton>
345
-          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
346
-            重置
347
-            </Button>
348
-        </Form.Item>
349
-      </Form>
350
-      <AuthButton name="admin.help.add.post" noRight={null}>
351
-        <Button name="admin.helpActivity.add.post" noRight={null} type="danger" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
352
-      </AuthButton>
353
-      <Table
354
-        // onRow={record => {
355
-        //   return {
356
-        //     onClick: getActivityDetail(record.helpActivityId),
357
-        //   };
358
-        // }}
359
-        dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
360
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
361
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
362
-      </div>
363
-      <Prompt message={location =>
364
-        location.pathname.startsWith("/activity/helpActivity")
365
-          ? true
366
-          : localStorage.removeItem("helpActivePageParams")} />
367
-    </>
368
-  )
369
-}
370
-const WrappedHeader = Form.create({ name: 'header' })(header);
371
-
372
-export default WrappedHeader

+ 0
- 546
src/pages/activity/helpActivity/signList.jsx Parādīt failu

@@ -1,546 +0,0 @@
1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, message } from 'antd';
3
-import moment from 'moment';
4
-import request from '../../../utils/request';
5
-import apis from '../../../services/apis';
6
-import router from 'umi/router';
7
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
8
-import AuthButton from '@/components/AuthButton';
9
-
10
-
11
-const { Option } = Select;
12
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
13
-const { Meta } = Card;
14
-
15
-/**
16
- * 助力者弹框
17
- */
18
-class InviteTable extends React.Component {
19
-  constructor(props) {
20
-    super(props);
21
-    this.state = {
22
-      dataSource: { records: [] },
23
-      visibleData: { visible: false, helpId: '', realtyConsultant: '' },
24
-    }
25
-  }
26
-
27
-  // 挂载之后
28
-  componentDidMount () {
29
-    const { helpId } = this.state.visibleData
30
-    this.getList({ helpRecordInitiateId: helpId, pageNumber: 1, pageSize: 5 })
31
-  }
32
-
33
-  componentDidUpdate (preProps, preState) {
34
-    const { helpId } = this.state.visibleData
35
-    if (this.props.visibleData.visible !== preState.visibleData.visible) {
36
-      this.getList({ helpRecordInitiateId: helpId, pageNumber: 1, pageSize: 5 })
37
-      this.setState({ visibleData: this.props.visibleData });
38
-    }
39
-  }
40
-
41
-  // 弹框确定按钮
42
-  // eslint-disable-next-line react/sort-comp
43
-  handleOk () {
44
-    this.setState({ visibleData: { visible: false, helpId: '', realtyConsultant: '' } })
45
-    this.props.onCancel()
46
-  }
47
-
48
-  // 弹框取消按钮
49
-  handleCancel () {
50
-    this.setState({ visibleData: { visible: false, helpId: '', realtyConsultant: '' } })
51
-    this.props.onCancel()
52
-  }
53
-
54
-  getList (params) {
55
-    if (params.helpRecordInitiateId === '') {
56
-      return
57
-    }
58
-    request({ ...apis.helpActivity.helpPeopleDetails, params: { ...params } }).then(res => {
59
-      this.setState({ dataSource: res })
60
-    }).catch(err => {
61
-      // eslint-disable-next-line no-unused-expressions
62
-      <Alert
63
-        style={{
64
-          marginBottom: 24,
65
-        }}
66
-        message={err}
67
-        type="error"
68
-        showIcon
69
-      />
70
-    })
71
-  }
72
-
73
-  // eslint-disable-next-line class-methods-use-this
74
-  exportHelp() {
75
-    request({ ...apis.helpActivity.gethelpRecordExport, responseType: 'blob', params: { helpRecordInitiateId: this.state.visibleData.helpId } })
76
-      .then(data => {
77
-        if (!data) {
78
-          return
79
-        }
80
-        const url = window.URL.createObjectURL(new Blob([data]))
81
-        const link = document.createElement('a')
82
-        link.style.display = 'none'
83
-        link.href = url
84
-        link.setAttribute('download', '助力者记录.xlsx')
85
-        document.body.append(link)
86
-        link.click()
87
-      }).catch(() => {
88
-
89
-      })
90
-  }
91
-
92
-
93
-  // 分页
94
-  // eslint-disable-next-line react/sort-comp
95
-  onChange (pageNum) {
96
-    this.getList({ pageNumber: pageNum, pageSize: 5 })
97
-  }
98
-
99
-  render () {
100
-    const columns = [
101
-      {
102
-        title: '用户姓名',
103
-        dataIndex: 'name',
104
-        key: 'name',
105
-        align: 'center',
106
-      },
107
-      {
108
-        title: '手机号',
109
-        dataIndex: 'phone',
110
-        key: 'phone',
111
-        align: 'center',
112
-        render: text => <a>{text}</a>,
113
-      },
114
-      {
115
-        title: '助力时间',
116
-        dataIndex: 'createDate',
117
-        key: 'createDate',
118
-        align: 'center',
119
-        render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
120
-      },
121
-    ]
122
-    return (
123
-      <>
124
-        <Modal
125
-          title="助力者"
126
-          destroyOnClose="true"
127
-          width={900}
128
-          footer={null}
129
-          visible={this.state.visibleData.visible}
130
-          // onOk={() => this.handleOk()}
131
-          onCancel={e => this.handleCancel(e)}
132
-        >
133
-
134
-      <Button name="admin.HelpInitiateRecordSucceed.export.get" noRight={null} type="primary" onClick={() => this.exportHelp()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
135
-        导出
136
-      </Button>
137
-          <Table rowKey="independent" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
138
-        </Modal>
139
-      </>
140
-    );
141
-  }
142
-}
143
-
144
-
145
-/**
146
- * 核销弹框
147
- */
148
-class Verifier extends React.Component {
149
-  constructor(props) {
150
-    super(props);
151
-    this.state = {
152
-      verification: { verificationCode: '' },
153
-      visibleData: { visible: false, helpId: '', helpActivityId: '', helpRecordInitiateId: '', verificationCode: '' },
154
-    }
155
-  }
156
-
157
-  // 挂载之后
158
-  componentDidMount () {
159
-    const { helpId } = this.state.visibleData
160
-  }
161
-
162
-  componentDidUpdate (preProps, preState) {
163
-    const { helpId } = this.state.visibleData
164
-    if (this.props.visibleData.visible !== preState.visibleData.visible) {
165
-      // eslint-disable-next-line react/no-did-update-set-state
166
-      this.setState({ visibleData: { ...this.props.visibleData } })
167
-    }
168
-  }
169
-
170
-  // 弹框确定按钮
171
-  // eslint-disable-next-line react/sort-comp
172
-  handleOk () {
173
-    this.setState({ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' } })
174
-  }
175
-
176
-  // 弹框取消按钮
177
-  handleCancel () {
178
-    console.log('核销关闭');
179
-    // this.setState({ visibleData: { visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' } })
180
-    this.props.onCancel()
181
-  }
182
-
183
-  // eslint-disable-next-line class-methods-use-this
184
-  audit (params) {
185
-    request({ ...apis.helpActivity.verification, params: { ...params } }).then(res => {
186
-      // eslint-disable-next-line no-undef
187
-      message.info('核销成功')
188
-      this.props.onSuccess({ pageNumber: 1, pageSize: 10, helpActivityId: this.props.visibleData.helpActivityId, status: 'helpSucceed' })
189
-    }).catch(err => {
190
-      // eslint-disable-next-line no-unused-expressions
191
-      <Alert
192
-        style={{
193
-          marginBottom: 24,
194
-        }}
195
-        message={err}
196
-        type="error"
197
-        showIcon
198
-      />
199
-    })
200
-  }
201
-
202
-  // eslint-disable-next-line class-methods-use-this
203
-  verify(e) {
204
-    this.setState({ visibleData: { visible: true, helpId: this.props.visibleData.helpId, verificationCode: e.target.value } })
205
-  }
206
-
207
-  // eslint-disable-next-line class-methods-use-this
208
-  verification(e) {
209
-    this.audit({ helpRecordInitiateId: this.state.visibleData.helpId, verifyCode: this.state.visibleData.verificationCode })
210
-  }
211
-
212
-  render () {
213
-    return (
214
-      <>
215
-        <Modal
216
-          title="核销"
217
-          destroyOnClose="true"
218
-          width={300}
219
-          footer={null}
220
-          visible={this.state.visibleData.visible}
221
-          // onOk={() => this.handleOk()}
222
-          onCancel={e => this.handleCancel(e)}
223
-        >
224
-          <div><span>核销码:<input style={{marginLeft: '10px'}} onChange={this.verify.bind(this)}/></span>
225
-           <Button name="admin.helpInitiateRecordVerify.post" noRight={null} onClick={e => this.verification(e)} style={{ marginLeft: '80px', marginTop:'10px', backgroundColor:'red' }}><span style={{color:'white'}}>立即核销</span></Button>
226
-          </div>
227
-        </Modal>
228
-      </>
229
-    );
230
-  }
231
-}
232
-
233
-/**
234
- *主体列表
235
- *
236
- * @param {*} props
237
- * @returns
238
- */
239
-function body(props) {
240
-  // eslint-disable-next-line react-hooks/rules-of-hooks
241
-  const [gInviteData, setGInviteData] = useState({ visible: false, helpId: '', realtyConsultant: '' })
242
-
243
-  // 核销码弹框
244
-  // eslint-disable-next-line react-hooks/rules-of-hooks
245
-  const [gVerifierData, setVerifierData] = useState({ visible: false, helpId: '', helpActivityId: '', helpRecordInitiateId: '', verificationCode: '' })
246
-
247
-  const { getFieldDecorator, getFieldsValue } = props.form
248
-
249
-  // eslint-disable-next-line react-hooks/rules-of-hooks
250
-  const [dataSource, setDataSource] = useState({ records: [] })
251
-  // eslint-disable-next-line react-hooks/rules-of-hooks
252
-  // const [columns, setColumns] = useState(privateColumns)
253
-
254
-  // 默认成功
255
-  // eslint-disable-next-line react-hooks/rules-of-hooks
256
-  const [customerType, setCustomerType] = useState('helpSucceed')
257
-
258
-  // 调整归属 ============  start
259
-  // eslint-disable-next-line react-hooks/rules-of-hooks
260
-  const [gVisibleData, setGVisibleData] = useState({ visible: false, helpId: '', realtyConsultant: '' })
261
-
262
-
263
-  // 变更状态 ============= end
264
-
265
-  // eslint-disable-next-line react-hooks/rules-of-hooks
266
-  const { helpActivityId } = props.location.query
267
-  useEffect(() => {
268
-    console.log('customerType', customerType)
269
-    getList({ pageNumber: 1, pageSize: 10, status: customerType, helpActivityId })
270
-  }, [])
271
-
272
-  function getList(params) {
273
-    // 网路请求
274
-    request({ ...apis.helpActivity.record, params: { ...params } }).then(res => {
275
-      setDataSource(res)
276
-    }).catch(err => {
277
-      // eslint-disable-next-line no-unused-expressions
278
-      <Alert
279
-        style={{
280
-          marginBottom: 24,
281
-        }}
282
-        message={err}
283
-        type="error"
284
-        showIcon
285
-      />
286
-    })
287
-  }
288
-
289
-  function displayNone() {
290
-    setGVisibleData({ visible: false, helpId: '', realtyConsultant: '' })
291
-  }
292
-
293
-  // 提交事件
294
-  function handleSubmit(e) {
295
-    // displayNone()
296
-
297
-
298
-    e.preventDefault();
299
-    props.form.validateFields((err, values) => {
300
-      if (!err) {
301
-        getList({ pageNum: 1, pageSize: 10, status: customerType, ...values, helpActivityId })
302
-      }
303
-    });
304
-  }
305
-
306
-  // Change 事件
307
-  function handleSelectChange(e) {
308
-    // eslint-disable-next-line no-console
309
-    console.log(e)
310
-  }
311
-
312
-  // 分页
313
-  function onChange(pageNum) {
314
-    // eslint-disable-next-line react-hooks/rules-of-hooks
315
-    getList({ pageNumber: pageNum, pageSize: 10, customerType })
316
-  }
317
-
318
-  // 助力成功/进行中/助力失败
319
-  function radioButtonHandleSizeChange(e) {
320
-    setGInviteData({ visible: false, helpId: '', realtyConsultant: '' })
321
-    setVerifierData({ visible: false, helpId: '', helpRecordInitiateId: '', verificationCode: '' })
322
-    // displayNone()
323
-
324
-    const { value } = e.target
325
-    setCustomerType(value)
326
-    // setColumns(value === 'helpSucceed' ? privateColumns : publicColumns)
327
-    getList({ pageNumber: 1, pageSize: 10, status: value, helpActivityId })
328
-  }
329
-
330
-  function handleReset() {
331
-    props.form.resetFields();
332
-    getList({ pageNum: 1, pageSize: 10, status: customerType, helpActivityId })
333
-  }
334
-
335
-  function toCustomerDateil(record) {
336
-    router.push({
337
-      pathname: '/customer/customerlist/customerDetail',
338
-      query: {
339
-        id: record.customerId,
340
-      },
341
-    });
342
-  }
343
-
344
-  function exportCustomer () {
345
-    const fieldsValue = getFieldsValue()
346
-    request({ ...apis.helpActivity.HelpInitiateRecordSucceed, responseType: 'blob', params: { ...fieldsValue, customerType, helpActivityId, condition: customerType } })
347
-      .then(response => {
348
-        download(response)
349
-      }).catch(error => {
350
-
351
-      })
352
-  }
353
-
354
-  function download (data) {
355
-    if (!data) {
356
-      return
357
-    }
358
-    const url = window.URL.createObjectURL(new Blob([data]))
359
-    const link = document.createElement('a')
360
-    link.style.display = 'none'
361
-    link.href = url
362
-    link.setAttribute('download', '助力记录.xlsx')
363
-    document.body.append(link)
364
-    link.click()
365
-  }
366
-
367
-// 助力记录弹框
368
-function helpRecord(row) {
369
-  setVerifierData({ visible: false, helpId: row.helpRecordInitiateId, elpRecordInitiateId: '', verificationCode: '' })
370
-  setGInviteData({ visible: true, helpId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
371
-}
372
- // 核销
373
- function helpInitiateRecordVerify(row) {
374
-// 关闭助力记录弹框
375
-  setGInviteData({ visible: false, helpId: row.helpRecordInitiateId, realtyConsultant: row.realtyConsultant })
376
-
377
-  // 核销
378
-  setVerifierData({ visible: true, helpId: row.helpRecordInitiateId, helpActivityId: row.helpActivityId, elpRecordInitiateId: '', verificationCode: '' })
379
- }
380
- // 核销回调
381
- function onSuccess(e) {
382
-   console.log('回调:', e)
383
-   getList(e)
384
-    
385
-   // 关闭
386
-   onCancel()
387
- }
388
-
389
- function onCancel(e) {
390
-  // 核销
391
-  setVerifierData({ visible: false, helpId: '', helpActivityId: '', elpRecordInitiateId: '', verificationCode: '' })
392
-  // 助力者
393
-  setGInviteData({ visible: false, helpId: '', realtyConsultant: '' })
394
- }
395
-
396
- // 返回到首页
397
- function returList(params) {
398
-  router.push({
399
-      pathname: '/activity/helpActivity/list',
400
-    });
401
-}
402
-
403
-  const publicColumns = [
404
-    {
405
-      title: '发起者',
406
-      dataIndex: 'name',
407
-      key: 'name',
408
-      align: 'center',
409
-      width: '15%',
410
-    },
411
-    {
412
-      title: '发起者手机号',
413
-      dataIndex: 'phone',
414
-      key: 'phone',
415
-      align: 'center',
416
-      width: '10%',
417
-    },
418
-    {
419
-      title: '发起时间',
420
-      dataIndex: 'createDate',
421
-      key: 'createDate',
422
-      align: 'center',
423
-      width: '15%',
424
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
425
-    },
426
-    {
427
-      title: '助力者',
428
-      dataIndex: 'helpCount',
429
-      key: 'helpCount',
430
-      align: 'center',
431
-      width: '15%',
432
-      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick={() => helpRecord(record)}>{record.helpCount}/{record.persionNumCount}</a>,
433
-    },
434
-  ]
435
-
436
-  const privateColumns = [
437
-    {
438
-      title: '发起者',
439
-      dataIndex: 'name',
440
-      key: 'name',
441
-      align: 'center',
442
-      width: '15%',
443
-      // render: (_, record) => <Avatar shape="square" src={customerType === 'helpSucceed' ? record.picture : record.avatarurl} size={64} icon="user" />,
444
-    },
445
-    {
446
-      title: '手机号',
447
-      dataIndex: 'phone',
448
-      key: 'phone',
449
-      align: 'center',
450
-      width: '10%',
451
-      // eslint-disable-next-line no-nested-ternary
452
-      // render: (_, record) => <><span>{customerType === 'helpSucceed' ? record.name : record.nickname}</span></>,
453
-    },
454
-    {
455
-      title: '发起时间',
456
-      dataIndex: 'createDate',
457
-      key: 'createDate',
458
-      align: 'center',
459
-      width: '10%',
460
-      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
461
-      // eslint-disable-next-line no-nested-ternary
462
-    },
463
-    {
464
-      title: '助力者',
465
-      dataIndex: 'helpCount',
466
-      key: 'helpCount',
467
-      align: 'center',
468
-      width: '15%',
469
-      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick={() => helpRecord(record)}>{record.helpCount}人</a>,
470
-    },
471
-    {
472
-      title: '核销状态',
473
-      dataIndex: 'reportRecommendStatus',
474
-      key: 'reportRecommendStatus',
475
-      align: 'center',
476
-      width: '10%',
477
-      // eslint-disable-next-line no-nested-ternary
478
-      render: (text, records) => {
479
-        if (records.verificationStatus === 0 || records.verificationStatus === null) { return '未核销' }
480
-        if (records.verificationStatus === 1) { return '已核销' }
481
-      },
482
-    },
483
-    {
484
-      title: '操作',
485
-      align: 'center',
486
-      width: '25%',
487
-      render: (x, row) => (
488
-        <>
489
-          {row.verificationStatus === 0 &&
490
-          <AuthButton name="admin.help.writeOff" noRight={null}>
491
-           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={() => helpInitiateRecordVerify(row)}>核销</span>
492
-          </AuthButton>
493
-        }
494
-        </>
495
-      ),
496
-    },
497
-  ]
498
-
499
-  return (
500
-    <>
501
-    {console.log('customerType', customerType)}
502
-      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
503
-        <Form.Item>
504
-          {getFieldDecorator('tel')(
505
-            <Input
506
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
507
-              placeholder="电话"
508
-            />,
509
-          )}
510
-        </Form.Item>
511
-        <Form.Item>
512
-            <Button type="primary" htmlType="submit" >
513
-              搜索
514
-            </Button>
515
-            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
516
-              重置
517
-            </Button>
518
-        </Form.Item>
519
-        <Button style={{ float: 'right' }} onClick={returList}>
520
-          返回
521
-        </Button>
522
-      </Form>
523
-      <Button name="admin.helpRecord.export.get" noRight={null} type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
524
-        导出
525
-      </Button>
526
-
527
-      <div style={{ margin: '20px 0' }}>
528
-          <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
529
-            <Radio.Button value="helpSucceed">助力成功</Radio.Button>
530
-            <Radio.Button value="helpUnderway">进行中</Radio.Button>
531
-            <Radio.Button value="helpUnfinished">助力失败</Radio.Button>
532
-          </Radio.Group>
533
-      </div>
534
-      {customerType === 'helpSucceed' ?
535
-        <Table dataSource={dataSource.list} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
536
-        <Table dataSource={dataSource.list} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" />
537
-      }
538
-        <Verifier visibleData={gVerifierData} onSuccess={e => onSuccess(e)} onCancel={(e) => onCancel(e)} />
539
-       <InviteTable visibleData={gInviteData} onSuccess={e => onSuccess(e)} onCancel={(e) => onCancel(e)}/>
540
-    </>
541
-  );
542
-}
543
-
544
-const WrappedBody = Form.create({ name: 'body' })(body);
545
-
546
-export default WrappedBody

src/pages/activity/groupActivity/detailActivity.jsx → src/pages/activity/lookHouseActivity/detail.jsx Parādīt failu

@@ -1,21 +1,17 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../../style/GoodsList.less';
5
-import apis from '../../../services/apis';
2
+import { Form, Input, Button, Icon, Select, Card, Radio, DatePicker, message, Upload } from 'antd';
3
+
4
+import apis from '@/services/apis';
6 5
 import moment from 'moment';
7 6
 import router from 'umi/router';
8
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
-import XForm, { FieldTypes } from '../../../components/XForm';
10
-import Wangedit from '../../../components/Wangedit/Wangedit'
11
-import request from '../../../utils/request'
12
-import yinhao from '../../../assets/yinhao.png'
13
-import ImageUploader from '../../../components/XForm/ImageUpload';
14
-import logo from '../../../assets/logo.svg';
15
-import touxiang from '../../../assets/touxiang.jpg';
16
-import poster1 from '../../../assets/poster1.png';
17
-import poster2 from '../../../assets/poster2.png';
18
-import xiaochengxu from '../../../assets/xiaochengxu.png';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect'
8
+import request from '@/utils/request'
9
+import yinhao from '@/assets/yinhao.png'
10
+import logo from '@/assets/logo.svg';
11
+import touxiang from '@/assets/touxiang.jpg';
12
+import poster1 from '@/assets/poster1.png';
13
+import poster2 from '@/assets/poster2.png';
14
+import xiaochengxu from '@/assets/xiaochengxu.png';
19 15
 import AuthButton from '@/components/AuthButton';
20 16
 import Prompt from 'umi/prompt';
21 17
 
@@ -28,29 +24,42 @@ const formItemLayout = {
28 24
 };
29 25
 
30 26
 const cancelPage = () => {
27
+  router.go('-1')
28
+}
29
+
30
+const getSignList = dynamicId => {
31 31
   router.push({
32
-    pathname: '/activity/groupActivity/list',
32
+    pathname: '/activity/SignList',
33
+    query: {
34
+      dynamicId,
35
+    },
33 36
   });
34 37
 }
35 38
 
36
-const getSignList = groupActivityId => {
37
-    router.push({
38
-        pathname: '/activity/groupActivity/helpRecord',
39
-        query: {
40
-            groupActivityId,
41
-        },
42
-      });
39
+const newQrcode = row => {
40
+  const x = new XMLHttpRequest();
41
+  const resourceUrl = row.qrCode
42
+  x.open('GET', resourceUrl, true);
43
+  x.responseType = 'blob';
44
+  x.onload = function (e) {
45
+    const url = window.URL.createObjectURL(x.response)
46
+    const a = document.createElement('a');
47
+    a.href = url;
48
+    a.style.display = 'none'
49
+    a.download = '活动二维码.png';
50
+    a.click();
51
+  }
52
+  x.send();
43 53
 }
44 54
 
45 55
 const BasicForm = props => {
46
-  // const [activityStatus, setActivityStatus] = useState(1)
47
-  // const [disable, setDisable] = useState(false)
48
-  // const [detailData, setDetailData] = useState(false)
56
+  const detailData = props.detailData || {}
49 57
 
50
-  const { groupActivityId } = props
58
+  const radioOnChange = e => {
59
+    // setIsEnlist(e.target.value)
60
+  }
51 61
 
52
-  const detailData = props.detailData || {}
53
- 
62
+  const { dynamicId } = props
54 63
   const handleSubmit = e => {
55 64
     e.preventDefault();
56 65
     props.form.validateFields((err, values) => {
@@ -65,23 +74,22 @@ const BasicForm = props => {
65 74
           values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
66 75
           values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
67 76
         }
68
-        
69 77
         console.log('submit data --->', values)
70
-        if (groupActivityId) {
71
-          values.groupActivityId = groupActivityId
72
-          request({ ...apis.groupActivity.update, data: values }).then(data => {
78
+        if (dynamicId) {
79
+          values.dynamicId = dynamicId
80
+          request({ ...apis.activity.update, data: values }).then(data => {
73 81
             message.info('保存成功')
74 82
             // router.go(-1)
75 83
           }).catch((err) => {
76 84
             message.info(err.msg || err.message)
77 85
           })
78 86
         } else {
79
-          request({ ...apis.groupActivity.add, data: { ...values } }).then((data) => {
87
+          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
80 88
             message.info('保存成功')
81 89
             router.push({
82
-              pathname: '/activity/groupActivity/edithelpActivity',
90
+              pathname: '/activity/editActivity',
83 91
               query: {
84
-                groupActivityId: data.groupActivityId,
92
+                dynamicId: data.dynamicId,
85 93
               },
86 94
             });
87 95
             // router.go(-1)
@@ -98,39 +106,54 @@ const BasicForm = props => {
98 106
     <>
99 107
       <Form {...formItemLayout} onSubmit={handleSubmit}>
100 108
         <Form.Item label="所属项目">
101
-        {getFieldDecorator('buildingId', {
102
-          initialValue: detailData.buildingId,
103
-          rules: [
104
-            {
105
-              required: true,
106
-              message: '请选择所属项目',
107
-            },
108
-          ],
109
-        })(<BuildSelect disabled/>)}
109
+          {getFieldDecorator('buildingId', {
110
+            initialValue: detailData.buildingId,
111
+            rules: [
112
+              {
113
+                required: true,
114
+                message: '请选择所属项目',
115
+              },
116
+            ],
117
+          })(<BuildSelect disabled />)}
110 118
         </Form.Item>
111
-        <Form.Item label="活动标题">
112
-          <span>{detailData.activityName}</span>
119
+        <Form.Item label="活动封面图1">
120
+          <img src={detailData.listImgUrl} height="210px" width="375px" />
113 121
         </Form.Item>
114
-        <Form.Item label="拼团详情主图">
115
-          <img src={detailData.mainImg} height="300px" width="375px" />
122
+        <Form.Item label="活动封面图2">
123
+          <img src={detailData.bannerListImg} height="125px" width="375px" />
116 124
         </Form.Item>
117
-        <Form.Item label="拼团封面图1">
118
-           <img src={detailData.listImg} height="210px" width="375px" />
125
+        <Form.Item label="活动详情主图">
126
+          <img src={detailData.imgUrl} height="300px" width="375px" />
119 127
         </Form.Item>
120
-        <Form.Item label="拼团封面图2">
121
-          <img src={detailData.bannerListImg} height="125px" width="375px" />
128
+        <Form.Item label="活动标题">
129
+          <span>{detailData.title}</span>
122 130
         </Form.Item>
123 131
         <Form.Item label="活动时间">
124
-      <span>{`${moment(detailData.startTime).format('YYYY-MM-DD HH:mm:ss')} —— ${moment(detailData.endTime).format('YYYY-MM-DD HH:mm:ss')}`}</span>
132
+          <span>{`${moment(detailData.startDate).format('YYYY-MM-DD HH:mm')} —— ${moment(detailData.endDate).format('YYYY-MM-DD HH:mm')}`}</span>
133
+        </Form.Item>
134
+        <Form.Item label="活动地点">
135
+          <span>{detailData.address}</span>
136
+        </Form.Item>
137
+        <Form.Item label="活动人数">
138
+          <span>{detailData.personNum}</span>
139
+        </Form.Item>
140
+        <Form.Item label="阅读量">
141
+          <span>{detailData.pvNum}</span>
125 142
         </Form.Item>
126
-        <Form.Item label="成团人数">
127
-            <span>{detailData.groupBuyPeople}</span>
143
+        <Form.Item label="转发量">
144
+          <span>{detailData.shareNum}</span>
128 145
         </Form.Item>
129
-        <Form.Item label="所需积分">
130
-            <span>{detailData.integral}</span>
146
+        <Form.Item label="收藏数">
147
+          <span>{detailData.saveNum}</span>
131 148
         </Form.Item>
132
-        <Form.Item label="活动说明">
133
-          <img src={detailData.descImg} height="300px" width="375px" />
149
+        <Form.Item label="最大报名人数">
150
+          <span>{detailData.maxEnlistByPerson}</span>
151
+        </Form.Item>
152
+        <Form.Item label="活动详情">
153
+          <div style={{ maxHeight: '500px', overflowY: 'auto' }} dangerouslySetInnerHTML={{ __html: detailData.desc }}></div>
154
+        </Form.Item>
155
+        <Form.Item label="报名时间">
156
+          <span>{`${moment(detailData.enlistStart).format('YYYY-MM-DD HH:mm')} —— ${moment(detailData.enlistEnd).format('YYYY-MM-DD HH:mm')}`}</span>
134 157
         </Form.Item>
135 158
         <Form.Item label="权重">
136 159
           <span>{detailData.heavy}</span>
@@ -143,16 +166,17 @@ const BasicForm = props => {
143 166
 const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
144 167
 
145 168
 const Poster = (props) => {
146
-  const { groupActivityId } = props
169
+  const { dynamicId } = props
147 170
   const [inputValue, changeInput] = useState('')
148 171
   const [textAreaValue, changeTextArea] = useState('')
149 172
   const [imgValue, changeImg] = useState('')
150 173
   const [posterId, setPosterId] = useState('')
151 174
 
152
-  if (groupActivityId) {
153
-    console.log(groupActivityId, 'groupActivityId')
175
+  if (dynamicId) {
176
+    console.log(dynamicId, 'dynamicId')
154 177
     useEffect(() => {
155
-      request({ ...apis.activity.poster, params: { targetId: groupActivityId, targetType: 'groupActivity' } }).then((data) => {
178
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
179
+        console.log(data, "2222")
156 180
         if (data.length > 0) {
157 181
           setPosterId(data[0].posterId)
158 182
           changeImg(data[0].posterImg)
@@ -164,7 +188,7 @@ const Poster = (props) => {
164 188
       })
165 189
       getMiniappName()
166 190
     }, [])
167
-  }else{
191
+  } else {
168 192
     getMiniappName()
169 193
   }
170 194
   // 获取小程序名称
@@ -177,15 +201,15 @@ const Poster = (props) => {
177 201
   }
178 202
 
179 203
   const submitPoster = () => {
180
-    if (helpActivityId) {
204
+    if (dynamicId) {
181 205
       if (posterId) {
182
-        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: groupActivityId, targetType: 'groupActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
206
+        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
183 207
           message.info("保存成功")
184 208
         }).catch((err) => {
185 209
           message.info(err.msg || err.message)
186 210
         })
187 211
       } else {
188
-        request({ ...apis.activity.addPoster, data: { targetId: groupActivityId, targetType: 'groupActivity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
212
+        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
189 213
           setPosterId(data.posterId)
190 214
           message.info("保存成功")
191 215
         }).catch((err) => {
@@ -272,14 +296,16 @@ const Poster = (props) => {
272 296
 
273 297
 
274 298
 const Share = (props) => {
275
-  const { groupActivityId } = props
299
+  const { dynamicId } = props
300
+
276 301
   const [inputValue, changeInput] = useState('')
277 302
   const [imgValue, changeImg] = useState('')
278 303
   const [shareContentId, setShareContentId] = useState('')
279 304
 
280
-  if (groupActivityId) {
281
-    useEffect(() => {
282
-      request({ ...apis.activity.shareContent, params: { targetId: groupActivityId, targetType: 'groupActivity' }, }).then((data) => {
305
+
306
+  useEffect(() => {
307
+    if (dynamicId) {
308
+      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' }, }).then((data) => {
283 309
         if (data.length > 0) {
284 310
           setShareContentId(data[0].shareContentId)
285 311
           changeImg(data[0].shareContentImg)
@@ -288,19 +314,20 @@ const Share = (props) => {
288 314
       }).catch((err) => {
289 315
         message.info(err.msg || err.message)
290 316
       })
291
-    }, [])
292
-  }
317
+    }
318
+  }, [])
319
+
293 320
 
294 321
   const submitShare = () => {
295
-    if (groupActivityId) {
322
+    if (dynamicId) {
296 323
       if (shareContentId) {
297
-        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
324
+        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
298 325
           message.info("保存成功")
299 326
         }).catch((err) => {
300 327
           message.info(err.msg || err.message)
301 328
         })
302 329
       } else {
303
-        request({ ...apis.activity.addShareContent, data: { targetId: groupActivityId, shareContentType: 'groupActivity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
330
+        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
304 331
           setShareContentId(data.shareContentId)
305 332
           message.info("保存成功")
306 333
         }).catch(err => {
@@ -327,7 +354,7 @@ const Share = (props) => {
327 354
     </div>
328 355
     <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
329 356
       <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
330
-      {imgValue === '' ? '无':<img src={imgValue} height="120px" height="150px" />}
357
+      {imgValue === '' ? '无' : <img src={imgValue} height="120px" height="150px" />}
331 358
     </div>
332 359
     {/* <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
333 360
     <Button onClick={() => cancelPage()}>
@@ -344,32 +371,31 @@ const Share = (props) => {
344 371
  */
345 372
 const Edit = props => {
346 373
   const [tab, changeTab] = useState('basic')
347
-  const { groupActivityId } = props.location.query
374
+  const { dynamicId } = props.location.query
348 375
   const [detailData, setDetailData] = useState(false)
349 376
 
350
-  useEffect(() => {
351
-    if (groupActivityId) {
352
-      getDynamicData(groupActivityId);
353
-    }
354
-  }, [])
355
-
356
-  // 查询详情
357
-  const getDynamicData = (groupActivityId) => {
358
-    request({ ...apis.groupActivity.details, urlData: {id: groupActivityId } }).then((data) => {
377
+  const getDynamicData = dynamicId => {
378
+    request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
359 379
       console.log(data)
360
-      data.activityTime = [moment(data.startTime), moment(data.endTime)]
380
+      data.activityTime = [moment(data.startDate), moment(data.endDate)]
381
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
361 382
 
362
-      // setActivityStatus(data.activityStatus)
363
-      // setDisable(data.activityStatus === 0 ? true : false)
364
-      // props.form.setFieldsValue(data)
365 383
       setDetailData(data)
366 384
     })
367 385
   }
368 386
 
387
+
388
+  useEffect(() => {
389
+    if (dynamicId) {
390
+      getDynamicData(dynamicId);
391
+    }
392
+  }, [])
393
+
394
+
369 395
   
370 396
 
371 397
   return (
372
-    <div>
398
+    <Card>
373 399
       <div>
374 400
         <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
375 401
           <Radio.Button value="basic">基本信息</Radio.Button>
@@ -378,29 +404,22 @@ const Edit = props => {
378 404
         </Radio.Group>
379 405
       </div>
380 406
       <div>
381
-        {tab === 'basic' && <Basic groupActivityId={groupActivityId} detailData={detailData}/>}
382
-        {tab === 'poster' && <Poster groupActivityId={groupActivityId} />}
383
-        {tab === 'share' && <Share groupActivityId={groupActivityId} />}
407
+        {tab === 'basic' && <Basic dynamicId={dynamicId} detailData={detailData} />}
408
+        {tab === 'poster' && <Poster  dynamicId={dynamicId} />}
409
+        {tab === 'share' && <Share  dynamicId={dynamicId} />}
384 410
       </div>
385
-      <div style={{textAlign: 'center'}}>
386
-        <AuthButton name="admin.share.record" noRight={null}>
387
-          {(detailData.activityStatus === 0 || detailData.activityStatus === 2) && 
388
-            <span 
389
-              style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} 
390
-              onClick={getSignList.bind(this, detailData.groupActivityId)}>
391
-              <Button>拼团记录</Button>
392
-            </span>}
393
-          </AuthButton>
394
-          <Button onClick={() => cancelPage()}>
395
-            取消
411
+      <div style={{ textAlign: 'center' }}>
412
+        <AuthButton name="admin.SignList.get" noRight={null}>
413
+          {(detailData.activityStatus === 0 || detailData.activityStatus === 2) && <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, detailData.dynamicId)}><Button>报名记录</Button></span>}
414
+        </AuthButton>
415
+        <AuthButton name="admin.dymic.qrcode" noRight={null}>
416
+          {(detailData.activityStatus === 0 || detailData.activityStatus === 2) && <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={newQrcode.bind(this, detailData)}>{<Button>下载二维码</Button>}</span>}
417
+        </AuthButton>
418
+        <Button onClick={() => cancelPage()}>
419
+          取消
396 420
           </Button>
397 421
       </div>
398
-      <Prompt message={location =>
399
-        location.pathname.startsWith("/activity/groupActivity")
400
-          ? true
401
-          : localStorage.removeItem("groupActivePageParams")} />
402
-    </div>
403
-    
422
+    </Card>
404 423
   );
405 424
 }
406 425
 

+ 294
- 0
src/pages/activity/lookHouseActivity/edit/Basic.jsx Parādīt failu

@@ -0,0 +1,294 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, DatePicker, message } from 'antd';
3
+import router from 'umi/router';
4
+import apis from '@/services/apis';
5
+import moment from 'moment';
6
+import BuildSelect from '@/components/SelectButton/BuildSelect2';
7
+import Wangedit from '@/components/Wangedit/Wangedit';
8
+import request from '@/utils/request';
9
+import ImageUploader from '@/components/XForm/ImageUpload';
10
+
11
+const { RangePicker } = DatePicker;
12
+
13
+const formItemLayout = {
14
+  labelCol: { span: 6 },
15
+  wrapperCol: { span: 14 },
16
+};
17
+
18
+const cancelPage = () => {
19
+  router.go('-1');
20
+};
21
+
22
+const BasicForm = props => {
23
+  const [isEnlist, setIsEnlist] = useState(1);
24
+  const [activityStatus, setActivityStatus] = useState(1);
25
+  const [disable, setDisable] = useState(false);
26
+  const [data, setData] = useState(1);
27
+  const [showSignupTime, setShowSignupTime] = useState([]);
28
+
29
+  const radioOnChange = e => {
30
+    setIsEnlist(e.target.value);
31
+  };
32
+
33
+  const { dynamicId } = props;
34
+
35
+  // 查询详情
36
+  const getDynamicData = dynamicId => {
37
+    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
38
+      data.activityTime = [moment(data.startDate), moment(data.endDate)];
39
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)];
40
+      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
41
+      setData(data);
42
+      setIsEnlist(data.isEnlist);
43
+      setActivityStatus(data.activityStatus);
44
+      setDisable(data.activityStatus === 0);
45
+      props.form.setFieldsValue(data);
46
+    });
47
+  };
48
+
49
+  // eslint-disable-next-line react-hooks/rules-of-hooks
50
+  useEffect(() => {
51
+    props.form.setFieldsValue({ isEnlist });
52
+    if (dynamicId) {
53
+      getDynamicData(dynamicId);
54
+    }
55
+  }, []);
56
+  const checkTime = () => {
57
+    function compareDate(dateTime1, dateTime2) {
58
+      return new Date(dateTime1) > new Date(dateTime2);
59
+    }
60
+    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
61
+
62
+    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
63
+
64
+    // (3)修改后结束时间<当前时间:活动已结束
65
+    if (showSignupTime[0]) {
66
+      // const date = data.signupTime
67
+      const nowDate = new Date();
68
+      // console.log(compareDate(nowDate, showSignupTime[0]))
69
+      if (compareDate(nowDate, showSignupTime[0])) {
70
+        return true;
71
+      } else {
72
+        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)';
73
+      }
74
+    }
75
+    return true;
76
+  };
77
+
78
+  const handleSubmit = e => {
79
+    e.preventDefault();
80
+    props.form.validateFields((err, values) => {
81
+      if (!err) {
82
+        console.log('Received values of form: ', values);
83
+        const { activityTime, signupTime } = values;
84
+        const [startDate, endDate] = activityTime;
85
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
86
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
87
+        if (signupTime) {
88
+          const [enlistStart, enlistEnd] = signupTime;
89
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
90
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
91
+        }
92
+
93
+        console.log('submit data --->', values);
94
+        if (dynamicId) {
95
+          const checks = checkTime();
96
+          if (checks != true) {
97
+            message.info(checks);
98
+            return;
99
+          }
100
+          console.log(data.enlistNum, values.personNum, '143');
101
+
102
+          if (data.enlistNum > values.personNum) {
103
+            message.info('活动人数必须大于已报名人数');
104
+            return;
105
+          }
106
+
107
+          values.dynamicId = dynamicId;
108
+          request({ ...apis.activity.update, data: values })
109
+            .then(data => {
110
+              message.info('保存成功');
111
+              // router.go(-1)
112
+            })
113
+            .catch(err => {
114
+              message.info(err.msg || err.message);
115
+            });
116
+        } else {
117
+          request({ ...apis.activity.add, data: { ...values } })
118
+            .then(data => {
119
+              message.info('保存成功');
120
+              router.push({
121
+                pathname: '/activity/editActivity',
122
+                query: {
123
+                  dynamicId: data.dynamicId,
124
+                },
125
+              });
126
+              // router.go(-1)
127
+            })
128
+            .catch(err => {
129
+              message.info(err.msg || err.message);
130
+            });
131
+        }
132
+      }
133
+    });
134
+  };
135
+  const changeTime = (value, date) => {
136
+    // console.log(value, data, '-----checkTime---------')
137
+    // console.log(props.form.getFieldsValue(), '--------time1-----------')
138
+    // let datas = data
139
+    // console.log(value, date, datas)
140
+    // datas.signupTime = date
141
+
142
+    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
143
+
144
+    // console.log(datas,'-------datas--------')
145
+    //   props.form.setFieldsValue(data)
146
+    setShowSignupTime(date);
147
+    // props.form.setFieldsValue(datas)
148
+    // // form.setFieldsValue
149
+    // console.log('-------1--------')
150
+  };
151
+
152
+  const { getFieldDecorator } = props.form;
153
+  return (
154
+    <>
155
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
156
+        <Form.Item label="所属项目">
157
+          {getFieldDecorator('buildingId', {
158
+            rules: [
159
+              {
160
+                required: true,
161
+                message: '请选择所属项目',
162
+              },
163
+            ],
164
+          })(<BuildSelect disabled={disable} />)}
165
+        </Form.Item>
166
+        <Form.Item
167
+          label="活动封面图1"
168
+          help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表"
169
+        >
170
+          {getFieldDecorator('listImgUrl', {
171
+            rules: [
172
+              {
173
+                required: true,
174
+                message: '请选择活动封面图1',
175
+              },
176
+            ],
177
+          })(<ImageUploader />)}
178
+        </Form.Item>
179
+        <Form.Item
180
+          label="活动封面图2"
181
+          help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页"
182
+        >
183
+          {getFieldDecorator('bannerListImg', {
184
+            rules: [
185
+              {
186
+                required: true,
187
+                message: '请选择活动封面图2',
188
+              },
189
+            ],
190
+          })(<ImageUploader />)}
191
+        </Form.Item>
192
+        <Form.Item
193
+          label="活动详情主图"
194
+          help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情"
195
+        >
196
+          {getFieldDecorator('imgUrl', {
197
+            rules: [
198
+              {
199
+                required: true,
200
+                message: '请选择活动详情主图',
201
+              },
202
+            ],
203
+          })(<ImageUploader />)}
204
+        </Form.Item>
205
+        <Form.Item label="活动标题">
206
+          {getFieldDecorator('title', {
207
+            rules: [
208
+              {
209
+                required: true,
210
+                message: '请输入活动标题',
211
+              },
212
+            ],
213
+          })(<Input />)}
214
+        </Form.Item>
215
+        <Form.Item label="活动时间">
216
+          {getFieldDecorator('activityTime', {
217
+            rules: [
218
+              {
219
+                required: true,
220
+                message: '请选择活动时间',
221
+              },
222
+            ],
223
+          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
224
+        </Form.Item>
225
+        <Form.Item label="活动地点">
226
+          {getFieldDecorator('address', {
227
+            rules: [
228
+              {
229
+                required: true,
230
+                message: '请输入活动地点',
231
+              },
232
+            ],
233
+          })(<Input />)}
234
+        </Form.Item>
235
+        {/* disabled={activityStatus === 0 ? true : false} */}
236
+        <Form.Item label="活动人数" help="当前活动最多可报名人数">
237
+          {getFieldDecorator('personNum', {
238
+            rules: [
239
+              {
240
+                required: true,
241
+                message: '请输入活动人数',
242
+              },
243
+              // {
244
+              //   min: data.personNum,min={data.personNum || 0}
245
+              //   message: '活动人数必须大于已报名人数',
246
+              // },
247
+            ],
248
+          })(<Input type="number" />)}
249
+        </Form.Item>
250
+        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
251
+          {getFieldDecorator('maxEnlistByPerson', {
252
+            rules: [
253
+              {
254
+                required: true,
255
+                message: '请输入用户携带人数',
256
+              },
257
+            ],
258
+          })(<Input type="number" min={1} />)}
259
+        </Form.Item>
260
+        <Form.Item label="活动详情">{getFieldDecorator('desc')(<Wangedit />)}</Form.Item>
261
+        <Form.Item label="报名时间">
262
+          {getFieldDecorator('signupTime', {
263
+            rules: [
264
+              {
265
+                required: true,
266
+                message: '请选择报名时间',
267
+              },
268
+            ],
269
+          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
270
+        </Form.Item>
271
+        <Form.Item label="权重">
272
+          {getFieldDecorator('heavy', {
273
+            rules: [
274
+              {
275
+                required: true,
276
+                message: '请输入权重',
277
+              },
278
+            ],
279
+          })(<Input type="number" style={{ width: 80 }} />)}
280
+          <span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
281
+        </Form.Item>
282
+        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
283
+          <Button type="primary" htmlType="submit">
284
+            确认
285
+          </Button>
286
+          &nbsp;&nbsp;&nbsp;&nbsp;
287
+          <Button onClick={() => cancelPage()}>取消</Button>
288
+        </Form.Item>
289
+      </Form>
290
+    </>
291
+  );
292
+};
293
+
294
+export default Form.create({ name: 'BasicForm' })(BasicForm);

+ 255
- 0
src/pages/activity/lookHouseActivity/edit/Poster.jsx Parādīt failu

@@ -0,0 +1,255 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Button, message } from 'antd';
3
+import router from 'umi/router';
4
+import apis from '@/services/apis';
5
+import request from '@/utils/request';
6
+import yinhao from '@/assets/yinhao.png';
7
+import ImageUploader from '@/components/XForm/ImageUpload';
8
+import touxiang from '@/assets/touxiang.jpg';
9
+import poster1 from '@/assets/poster1.png';
10
+import xiaochengxu from '@/assets/xiaochengxu.png';
11
+
12
+const { TextArea } = Input;
13
+
14
+const cancelPage = () => {
15
+  router.go('-1');
16
+};
17
+
18
+const Poster = props => {
19
+  const { dynamicId } = props;
20
+  const [inputValue, changeInput] = useState('');
21
+  const [textAreaValue, changeTextArea] = useState('');
22
+  const [imgValue, changeImg] = useState('');
23
+  const [posterId, setPosterId] = useState('');
24
+
25
+  useEffect(() => {
26
+    if (dynamicId) {
27
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } })
28
+        .then(data => {
29
+          if (data.length > 0) {
30
+            setPosterId(data[0].posterId);
31
+            changeImg(data[0].posterImg);
32
+            changeTextArea(data[0].posterDescription);
33
+            changeInput(data[0].posterTitle);
34
+          }
35
+        })
36
+        .catch(err => {
37
+          message.info(err.msg || err.message);
38
+        });
39
+    }
40
+    // getMiniappName()
41
+  }, []);
42
+
43
+  // 获取小程序名称
44
+  // const [miniappName, setMiniappName] = useState('')
45
+  // function getMiniappName() {
46
+  //   request({ ...apis.building.getMiniappName }).then(res => {
47
+  //     console.log(res, "0000000000000")
48
+  //     setMiniappName(res)
49
+  //   })
50
+  // }
51
+
52
+  const submitPoster = () => {
53
+    if (dynamicId) {
54
+      if (posterId) {
55
+        request({
56
+          ...apis.activity.updatePoster,
57
+          urlData: { id: posterId },
58
+          data: {
59
+            targetId: dynamicId,
60
+            targetType: 'activity',
61
+            posterImg: imgValue,
62
+            posterTitle: inputValue,
63
+            posterDescription: textAreaValue,
64
+          },
65
+        })
66
+          .then(data => {
67
+            message.info('保存成功');
68
+          })
69
+          .catch(err => {
70
+            message.info(err.msg || err.message);
71
+          });
72
+      } else {
73
+        request({
74
+          ...apis.activity.addPoster,
75
+          data: {
76
+            targetId: dynamicId,
77
+            targetType: 'activity',
78
+            posterImg: imgValue,
79
+            posterTitle: inputValue,
80
+            posterDescription: textAreaValue,
81
+          },
82
+        })
83
+          .then(data => {
84
+            setPosterId(data.posterId);
85
+            message.info('保存成功');
86
+          })
87
+          .catch(err => {
88
+            message.info(err.msg || err.message);
89
+          });
90
+      }
91
+    } else {
92
+      message.warn('请先保存基本信息数据');
93
+    }
94
+  };
95
+
96
+  return (
97
+    <div>
98
+      <div style={{ display: 'flex' }}>
99
+        <div
100
+          style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}
101
+        >
102
+          <div
103
+            style={{
104
+              width: '375px',
105
+              height: '700px',
106
+              backgroundColor: '#fff',
107
+              boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)',
108
+              position: 'relative',
109
+              margin: '0 auto',
110
+            }}
111
+          >
112
+            <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
113
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
114
+              <img
115
+                style={{
116
+                  width: '70px',
117
+                  height: '70px',
118
+                  border: '4px solid #fff',
119
+                  borderRadius: '35px',
120
+                  marginLeft: '16px',
121
+                }}
122
+                src={touxiang}
123
+                alt=""
124
+              />
125
+              <span
126
+                style={{
127
+                  color: '#222',
128
+                  fontWeight: '600',
129
+                  margin: '24px 10px 0 14px',
130
+                  fontSize: '17px',
131
+                }}
132
+              >
133
+                喵喵
134
+              </span>
135
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
136
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>
137
+                2019.09.21
138
+              </span>
139
+            </div>
140
+            <p
141
+              style={{
142
+                margin: '10px 20px',
143
+                fontSize: '20px',
144
+                color: '#222',
145
+                fontWeight: '600',
146
+                display: '-webkit-box',
147
+                lineClamp: '3',
148
+                height: '60px',
149
+                WebkitLineClamp: '2',
150
+                WebkitBoxOrient: 'vertical',
151
+                overflow: 'hidden',
152
+                textOverflow: 'ellipsis',
153
+              }}
154
+            >
155
+              {inputValue || '海报标题'}
156
+            </p>
157
+
158
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
159
+            <p
160
+              style={{
161
+                margin: '16px 20px 28px 20px',
162
+                fontSize: '17px',
163
+                color: '#999',
164
+                display: '-webkit-box',
165
+                lineClamp: '3',
166
+                height: '72px',
167
+                WebkitLineClamp: '3',
168
+                WebkitBoxOrient: 'vertical',
169
+                overflow: 'hidden',
170
+                textOverflow: 'ellipsis',
171
+              }}
172
+            >
173
+              {textAreaValue || '海报描述'}
174
+            </p>
175
+            <div
176
+              style={{
177
+                backgroundColor: '#f1f1f1',
178
+                padding: '22px 30px',
179
+                boxShadow: '0px 6px 12px -4px #dcdcdc',
180
+                position: 'relative',
181
+              }}
182
+            >
183
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
184
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
185
+              <img
186
+                style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }}
187
+                src={xiaochengxu}
188
+                alt=""
189
+              />
190
+            </div>
191
+          </div>
192
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>
193
+            海报模板
194
+          </p>
195
+        </div>
196
+
197
+        <div>
198
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
199
+            <p
200
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
201
+            >
202
+              活动海报图
203
+            </p>
204
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
205
+          </div>
206
+          <p
207
+            style={{
208
+              fontSize: '0.5vw',
209
+              color: '#A9A9A9',
210
+              marginLeft: '230px',
211
+              marginBottom: '30px',
212
+            }}
213
+          >
214
+            建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报
215
+          </p>
216
+          <div
217
+            style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}
218
+          >
219
+            <p
220
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
221
+            >
222
+              海报标题
223
+            </p>
224
+            <Input
225
+              style={{ width: '20vw' }}
226
+              value={inputValue}
227
+              placeholder="请输入海报标题"
228
+              onChange={e => changeInput(e.target.value)}
229
+            />
230
+          </div>
231
+          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
232
+            <p
233
+              style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}
234
+            >
235
+              海报描述
236
+            </p>
237
+            <TextArea
238
+              rows={5}
239
+              maxLength={1024}
240
+              value={textAreaValue}
241
+              onChange={e => changeTextArea(e.target.value)}
242
+            />
243
+          </div>
244
+        </div>
245
+      </div>
246
+      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}>
247
+        {' '}
248
+        确定
249
+      </Button>
250
+      <Button onClick={() => cancelPage()}>取消</Button>
251
+    </div>
252
+  );
253
+};
254
+
255
+export default Poster;

+ 150
- 0
src/pages/activity/lookHouseActivity/edit/Share.jsx Parādīt failu

@@ -0,0 +1,150 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Card } from 'antd';
3
+
4
+import router from 'umi/router';
5
+import apis from '@/services/apis';
6
+import moment from 'moment';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect2';
8
+import Wangedit from '@/components/Wangedit/Wangedit';
9
+import request from '@/utils/request';
10
+import yinhao from '@/assets/yinhao.png';
11
+import ImageUploader from '@/components/XForm/ImageUpload';
12
+import logo from '@/assets/logo.png';
13
+import touxiang from '@/assets/touxiang.jpg';
14
+import poster1 from '@/assets/poster1.png';
15
+import poster2 from '@/assets/poster2.png';
16
+import xiaochengxu from '@/assets/xiaochengxu.png';
17
+
18
+const { TextArea } = Input;
19
+
20
+const cancelPage = () => {
21
+  router.go('-1');
22
+};
23
+
24
+const Share = props => {
25
+  const { dynamicId } = props;
26
+  const [inputValue, changeInput] = useState('');
27
+  const [imgValue, changeImg] = useState('');
28
+  const [shareContentId, setShareContentId] = useState('');
29
+
30
+  useEffect(() => {
31
+    if (dynamicId) {
32
+      request({
33
+        ...apis.activity.shareContent,
34
+        params: { targetId: dynamicId, targetType: 'activity' },
35
+      })
36
+        .then(data => {
37
+          if (data.length > 0) {
38
+            setShareContentId(data[0].shareContentId);
39
+            changeImg(data[0].shareContentImg);
40
+            changeInput(data[0].shareContentTitle);
41
+          }
42
+        })
43
+        .catch(err => {
44
+          message.info(err.msg || err.message);
45
+        });
46
+    }
47
+  }, [dynamicId]);
48
+
49
+  const submitShare = () => {
50
+    if (dynamicId) {
51
+      if (shareContentId) {
52
+        request({
53
+          ...apis.activity.updateShareContent,
54
+          urlData: { id: shareContentId },
55
+          data: {
56
+            targetId: dynamicId,
57
+            shareContentType: 'activity',
58
+            shareContentImg: imgValue,
59
+            shareContentTitle: inputValue,
60
+          },
61
+        })
62
+          .then(data => {
63
+            message.info('保存成功');
64
+          })
65
+          .catch(err => {
66
+            message.info(err.msg || err.message);
67
+          });
68
+      } else {
69
+        request({
70
+          ...apis.activity.addShareContent,
71
+          data: {
72
+            targetId: dynamicId,
73
+            shareContentType: 'activity',
74
+            shareContentImg: imgValue,
75
+            shareContentTitle: inputValue,
76
+          },
77
+        })
78
+          .then(data => {
79
+            setShareContentId(data.shareContentId);
80
+            message.info('保存成功');
81
+          })
82
+          .catch(err => {
83
+            message.info(err.msg || err.message);
84
+          });
85
+      }
86
+    } else {
87
+      message.warn('请先保存基本信息数据');
88
+    }
89
+  };
90
+
91
+  return (
92
+    <div style={{ padding: '20px' }}>
93
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
94
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
95
+          分享模板
96
+        </p>
97
+        <div>
98
+          <p
99
+            style={{
100
+              display: 'flex',
101
+              alignItems: 'center',
102
+              fontSize: '14px',
103
+              color: '#999',
104
+              margin: '0',
105
+              lineHeight: '0',
106
+            }}
107
+          >
108
+            <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt="" />
109
+            橙蕉互动
110
+          </p>
111
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>
112
+            {inputValue || '置业V客厅 精准获客平台'}
113
+          </p>
114
+          <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
115
+        </div>
116
+      </div>
117
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
118
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
119
+          分享标题
120
+        </p>
121
+        <Input
122
+          placeholder="请输入分享标题"
123
+          value={inputValue}
124
+          onChange={e => changeInput(e.target.value)}
125
+        />
126
+      </div>
127
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
128
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
129
+          活动分享图
130
+        </p>
131
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
132
+      </div>
133
+      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>
134
+        建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友
135
+      </p>
136
+      <Button
137
+        type="primary"
138
+        htmlType="submit"
139
+        onClick={submitShare}
140
+        style={{ margin: '40px 40px 40px 220px' }}
141
+      >
142
+        {' '}
143
+        确定
144
+      </Button>
145
+      <Button onClick={() => cancelPage()}>取消</Button>
146
+    </div>
147
+  );
148
+};
149
+
150
+export default Share;

+ 524
- 0
src/pages/activity/lookHouseActivity/edit/ind.jsx Parādīt failu

@@ -0,0 +1,524 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+
4
+import router from 'umi/router';
5
+import apis from '@/services/apis';
6
+import moment from 'moment';
7
+import BuildSelect from '@/components/SelectButton/BuildSelect2'
8
+import Wangedit from '@/components/Wangedit/Wangedit'
9
+import request from '@/utils/request'
10
+import yinhao from '@/assets/yinhao.png'
11
+import ImageUploader from '@/components/XForm/ImageUpload';
12
+import logo from '@/assets/logo.png';
13
+import touxiang from '@/assets/touxiang.jpg';
14
+import poster1 from '@/assets/poster1.png';
15
+import poster2 from '@/assets/poster2.png';
16
+import xiaochengxu from '@/assets/xiaochengxu.png'
17
+
18
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19
+const { TextArea } = Input;
20
+
21
+const formItemLayout = {
22
+  labelCol: { span: 6 },
23
+  wrapperCol: { span: 14 },
24
+};
25
+
26
+const cancelPage = () => {
27
+  router.push({
28
+    pathname: '/activity/ActivityList',
29
+  });
30
+}
31
+
32
+const BasicForm = props => {
33
+  const [isEnlist, setIsEnlist] = useState(1)
34
+  const [activityStatus, setActivityStatus] = useState(1)
35
+  const [disable, setDisable] = useState(false)
36
+  const [data, setData] = useState(1)
37
+  const [showSignupTime, setShowSignupTime] = useState([])
38
+
39
+
40
+  const radioOnChange = e => {
41
+    setIsEnlist(e.target.value)
42
+  }
43
+
44
+  const { dynamicId } = props
45
+
46
+  // 查询详情
47
+  const getDynamicData = dynamicId => {
48
+    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
49
+ 
50
+      data.activityTime = [moment(data.startDate), moment(data.endDate)]
51
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
52
+      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
53
+      setData(data)
54
+      setIsEnlist(data.isEnlist)
55
+      setActivityStatus(data.activityStatus)
56
+      setDisable(data.activityStatus === 0)
57
+      props.form.setFieldsValue(data)
58
+    })
59
+  }
60
+
61
+  // eslint-disable-next-line react-hooks/rules-of-hooks
62
+  useEffect(() => {
63
+    props.form.setFieldsValue({ isEnlist })
64
+    if (dynamicId) {
65
+      getDynamicData(dynamicId);
66
+    }
67
+  }, [])
68
+  const checkTime = () => {
69
+    function compareDate(dateTime1, dateTime2) {
70
+      return new Date(dateTime1) > new Date(dateTime2)
71
+    }
72
+    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
73
+
74
+    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
75
+
76
+    // (3)修改后结束时间<当前时间:活动已结束
77
+    if (showSignupTime[0]) {
78
+      // const date = data.signupTime
79
+      const nowDate = new Date()
80
+      // console.log(compareDate(nowDate, showSignupTime[0]))
81
+      if (compareDate(nowDate, showSignupTime[0])) {
82
+        return true
83
+      } else {
84
+        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)'
85
+      }
86
+    }
87
+    return true
88
+  }
89
+
90
+
91
+  const handleSubmit = e => {
92
+    e.preventDefault();
93
+    props.form.validateFields((err, values) => {
94
+
95
+      if (!err) {
96
+        console.log('Received values of form: ', values);
97
+        const { activityTime, signupTime } = values
98
+        const [startDate, endDate] = activityTime
99
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
100
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
101
+        if (signupTime) {
102
+          const [enlistStart, enlistEnd] = signupTime
103
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
104
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
105
+        }
106
+
107
+        console.log('submit data --->', values)
108
+        if (dynamicId) {
109
+          const checks = checkTime()
110
+          if (checks != true) {
111
+            message.info(checks)
112
+            return
113
+          }
114
+          console.log(data.enlistNum,values.personNum,'143')
115
+
116
+          if (data.enlistNum > values.personNum) {
117
+            message.info('活动人数必须大于已报名人数')
118
+            return
119
+          }
120
+
121
+          values.dynamicId = dynamicId
122
+          request({ ...apis.activity.update, data: values }).then(data => {
123
+            message.info('保存成功')
124
+            // router.go(-1)
125
+          }).catch((err) => {
126
+            message.info(err.msg || err.message)
127
+          })
128
+        } else {
129
+          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
130
+            message.info('保存成功')
131
+            router.push({
132
+              pathname: '/activity/editActivity',
133
+              query: {
134
+                dynamicId: data.dynamicId,
135
+              },
136
+            });
137
+            // router.go(-1)
138
+          }).catch((err) => {
139
+            message.info(err.msg || err.message)
140
+          })
141
+        }
142
+      }
143
+    });
144
+  }
145
+  const changeTime = (value, date) => {
146
+    // console.log(value, data, '-----checkTime---------')
147
+    // console.log(props.form.getFieldsValue(), '--------time1-----------')
148
+    // let datas = data
149
+    // console.log(value, date, datas)
150
+    // datas.signupTime = date
151
+
152
+    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
153
+
154
+    // console.log(datas,'-------datas--------')
155
+    //   props.form.setFieldsValue(data)
156
+    setShowSignupTime(date)
157
+    // props.form.setFieldsValue(datas)
158
+    // // form.setFieldsValue
159
+    // console.log('-------1--------')
160
+  }
161
+
162
+  const { getFieldDecorator } = props.form;
163
+  return (
164
+    <>
165
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
166
+        <Form.Item label="所属项目">
167
+          {getFieldDecorator('buildingId', {
168
+            rules: [
169
+              {
170
+                required: true,
171
+                message: '请选择所属项目',
172
+              },
173
+            ],
174
+          })(<BuildSelect disabled={disable} />)}
175
+        </Form.Item>
176
+        <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表">
177
+          {getFieldDecorator('listImgUrl', {
178
+            rules: [
179
+              {
180
+                required: true,
181
+                message: '请选择活动封面图1',
182
+              },
183
+            ],
184
+          })(<ImageUploader />)}
185
+        </Form.Item>
186
+        <Form.Item label="活动封面图2" help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页">
187
+          {getFieldDecorator('bannerListImg', {
188
+            rules: [
189
+              {
190
+                required: true,
191
+                message: '请选择活动封面图2',
192
+              },
193
+            ],
194
+          })(<ImageUploader />)}
195
+        </Form.Item>
196
+        <Form.Item label="活动详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情">
197
+          {getFieldDecorator('imgUrl', {
198
+            rules: [
199
+              {
200
+                required: true,
201
+                message: '请选择活动详情主图',
202
+              },
203
+            ],
204
+          })(<ImageUploader />)}
205
+        </Form.Item>
206
+        <Form.Item label="活动标题">
207
+          {getFieldDecorator('title', {
208
+            rules: [
209
+              {
210
+                required: true,
211
+                message: '请输入活动标题',
212
+              },
213
+            ],
214
+          })(<Input />)}
215
+        </Form.Item>
216
+        <Form.Item label="活动时间">
217
+          {getFieldDecorator('activityTime', {
218
+            rules: [
219
+              {
220
+                required: true,
221
+                message: '请选择活动时间',
222
+              },
223
+            ],
224
+          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
225
+        </Form.Item>
226
+        <Form.Item label="活动地点">
227
+          {getFieldDecorator('address', {
228
+            rules: [
229
+              {
230
+                required: true,
231
+                message: '请输入活动地点',
232
+              },
233
+            ],
234
+          })(<Input />)}
235
+        </Form.Item>
236
+        {/* disabled={activityStatus === 0 ? true : false} */}
237
+        <Form.Item label="活动人数" help="当前活动最多可报名人数">
238
+          {getFieldDecorator('personNum', {
239
+            rules: [
240
+              {
241
+                required: true,
242
+                message: '请输入活动人数',
243
+              },
244
+              // {
245
+              //   min: data.personNum,min={data.personNum || 0}
246
+              //   message: '活动人数必须大于已报名人数',
247
+              // },
248
+            ],
249
+          })(<Input type="number" />)}
250
+        </Form.Item>
251
+        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
252
+          {getFieldDecorator('maxEnlistByPerson', {
253
+            rules: [
254
+              {
255
+                required: true,
256
+                message: '请输入用户携带人数',
257
+              },
258
+            ],
259
+          })(<Input type="number" min={1} />)}
260
+        </Form.Item>
261
+        <Form.Item label="活动详情">
262
+          {getFieldDecorator('desc')(<Wangedit />)}
263
+        </Form.Item>
264
+        <Form.Item label="报名时间">
265
+          {getFieldDecorator('signupTime', {
266
+            rules: [
267
+              {
268
+                required: true,
269
+                message: '请选择报名时间',
270
+              },
271
+            ],
272
+          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
273
+        </Form.Item>
274
+        <Form.Item label="权重">
275
+          {getFieldDecorator('heavy', {
276
+
277
+            rules: [
278
+              {
279
+                required: true,
280
+                message: '请输入权重',
281
+              },
282
+            ],
283
+          })(<Input type="number" style={{ width: 80 }} />)}<span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
284
+        </Form.Item>
285
+        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
286
+          <Button type="primary" htmlType="submit">
287
+            确认
288
+          </Button>
289
+          &nbsp;&nbsp;&nbsp;&nbsp;
290
+          <Button onClick={() => cancelPage()}>
291
+            取消
292
+          </Button>
293
+        </Form.Item>
294
+      </Form>
295
+    </>
296
+  )
297
+}
298
+
299
+const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
300
+
301
+const Poster = props => {
302
+  const { dynamicId } = props
303
+  const [inputValue, changeInput] = useState('')
304
+  const [textAreaValue, changeTextArea] = useState('')
305
+  const [imgValue, changeImg] = useState('')
306
+  const [posterId, setPosterId] = useState('')
307
+
308
+  useEffect(() => {
309
+    if (dynamicId) {
310
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
311
+
312
+        if (data.length > 0) {
313
+          setPosterId(data[0].posterId)
314
+          changeImg(data[0].posterImg)
315
+          changeTextArea(data[0].posterDescription)
316
+          changeInput(data[0].posterTitle)
317
+        }
318
+      }).catch(err => {
319
+        message.info(err.msg || err.message)
320
+      })
321
+    }
322
+    // getMiniappName()
323
+  }, [])
324
+  
325
+  // 获取小程序名称
326
+  // const [miniappName, setMiniappName] = useState('')
327
+  // function getMiniappName() {
328
+  //   request({ ...apis.building.getMiniappName }).then(res => {
329
+  //     console.log(res, "0000000000000")
330
+  //     setMiniappName(res)
331
+  //   })
332
+  // }
333
+
334
+  const submitPoster = () => {
335
+    if (dynamicId) {
336
+      if (posterId) {
337
+        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
338
+          message.info('保存成功')
339
+        }).catch(err => {
340
+          message.info(err.msg || err.message)
341
+        })
342
+      } else {
343
+        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
344
+          setPosterId(data.posterId)
345
+          message.info('保存成功')
346
+        }).catch(err => {
347
+          message.info(err.msg || err.message)
348
+        })
349
+      }
350
+    } else {
351
+      message.warn('请先保存基本信息数据')
352
+    }
353
+  }
354
+
355
+  return <div>
356
+    <div style={{ display: 'flex' }}>
357
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
358
+        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
359
+          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
360
+          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
361
+            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
362
+            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
363
+            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
364
+            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
365
+          </div>
366
+          <p style={{
367
+            margin: '10px 20px',
368
+            fontSize: '20px',
369
+            color: '#222',
370
+            fontWeight: '600',
371
+            display: '-webkit-box',
372
+            lineClamp: '3',
373
+            height: '60px',
374
+            WebkitLineClamp: '2',
375
+            WebkitBoxOrient: 'vertical',
376
+            overflow: 'hidden',
377
+            textOverflow: 'ellipsis',
378
+          }}>{inputValue || '海报标题'}</p>
379
+
380
+          <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
381
+          <p style={{
382
+            margin: '16px 20px 28px 20px',
383
+            fontSize: '17px',
384
+            color: '#999',
385
+            display: '-webkit-box',
386
+            lineClamp: '3',
387
+            height: '72px',
388
+            WebkitLineClamp: '3',
389
+            WebkitBoxOrient: 'vertical',
390
+            overflow: 'hidden',
391
+            textOverflow: 'ellipsis',
392
+          }}>{textAreaValue || '海报描述'}</p>
393
+          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
394
+            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
395
+            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
396
+            <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
397
+          </div>
398
+        </div>
399
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
400
+      </div>
401
+
402
+      <div >
403
+        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
404
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动海报图</p>
405
+          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
406
+        </div>
407
+        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报</p>
408
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
409
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
410
+          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
411
+        </div>
412
+        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
413
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
414
+          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
415
+        </div>
416
+
417
+      </div>
418
+    </div>
419
+    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
420
+    <Button onClick={() => cancelPage()}>
421
+      取消
422
+    </Button>
423
+  </div>
424
+}
425
+
426
+const Share = props => {
427
+  const { dynamicId } = props
428
+  const [inputValue, changeInput] = useState('')
429
+  const [imgValue, changeImg] = useState('')
430
+  const [shareContentId, setShareContentId] = useState('')
431
+
432
+  useEffect(() => {
433
+    if (dynamicId) {
434
+      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
435
+
436
+        if (data.length > 0) {
437
+          setShareContentId(data[0].shareContentId)
438
+          changeImg(data[0].shareContentImg)
439
+          changeInput(data[0].shareContentTitle)
440
+        }
441
+      }).catch(err => {
442
+        message.info(err.msg || err.message)
443
+      })
444
+    }
445
+  }, [dynamicId])
446
+
447
+  const submitShare = () => {
448
+    if (dynamicId) {
449
+      if (shareContentId) {
450
+        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
451
+          message.info('保存成功')
452
+        }).catch(err => {
453
+          message.info(err.msg || err.message)
454
+        })
455
+      } else {
456
+        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
457
+          setShareContentId(data.shareContentId)
458
+          message.info('保存成功')
459
+        }).catch(err => {
460
+          message.info(err.msg || err.message)
461
+        })
462
+      }
463
+    } else {
464
+      message.warn('请先保存基本信息数据')
465
+    }
466
+  }
467
+
468
+  return <div style={{ padding: '20px' }}>
469
+    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
470
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
471
+      <div>
472
+        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
473
+          <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt=""/>橙蕉互动</p>
474
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue || '置业V客厅 精准获客平台'}</p>
475
+        <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
476
+      </div>
477
+    </div>
478
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
479
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
480
+      <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
481
+    </div>
482
+    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
483
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
484
+      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
485
+    </div>
486
+    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友</p>
487
+    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
488
+    <Button onClick={() => cancelPage()}>
489
+      取消
490
+    </Button>
491
+  </div>
492
+}
493
+
494
+
495
+/**
496
+ *
497
+ *
498
+ * @param {*} props
499
+ * @returns
500
+ */
501
+const Edit = props => {
502
+  const [tab, changeTab] = useState('basic')
503
+  const { dynamicId } = props.location.query
504
+
505
+  return (
506
+    <div>
507
+      <div>
508
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
509
+          <Radio.Button value="basic">基本信息</Radio.Button>
510
+          <Radio.Button value="poster">海报图片</Radio.Button>
511
+          <Radio.Button value="share">分享设置</Radio.Button>
512
+        </Radio.Group>
513
+      </div>
514
+      <div>
515
+        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
516
+        {tab === 'poster' && <Poster dynamicId={dynamicId}/>}
517
+        {tab === 'share' && <Share dynamicId={dynamicId}/>}
518
+      </div>
519
+    
520
+    </div>
521
+  );
522
+}
523
+
524
+export default Edit

+ 34
- 0
src/pages/activity/lookHouseActivity/edit/index.jsx Parādīt failu

@@ -0,0 +1,34 @@
1
+import React, { useState } from 'react';
2
+import { Radio, Card } from 'antd';
3
+import Basic from './Basic';
4
+import Poster from './Poster';
5
+import Share from './Share';
6
+/**
7
+ *
8
+ *
9
+ * @param {*} props
10
+ * @returns
11
+ */
12
+const Edit = props => {
13
+  const [tab, changeTab] = useState('basic');
14
+  const { dynamicId } = props.location.query;
15
+
16
+  return (
17
+    <Card>
18
+      <div>
19
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
20
+          <Radio.Button value="basic">基本信息</Radio.Button>
21
+          <Radio.Button value="poster">海报图片</Radio.Button>
22
+          <Radio.Button value="share">分享设置</Radio.Button>
23
+        </Radio.Group>
24
+      </div>
25
+      <div>
26
+        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
27
+        {tab === 'poster' && <Poster dynamicId={dynamicId} />}
28
+        {tab === 'share' && <Share dynamicId={dynamicId} />}
29
+      </div>
30
+    </Card>
31
+  );
32
+};
33
+
34
+export default Edit;

+ 331
- 0
src/pages/activity/lookHouseActivity/index.jsx Parādīt failu

@@ -0,0 +1,331 @@
1
+import React, { useState, useEffect, useRef } from 'react';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  Icon,
7
+  Typography,
8
+  message,
9
+  Table,
10
+  Pagination,
11
+  Modal,
12
+  DatePicker,
13
+  Card,
14
+} from 'antd';
15
+import router from 'umi/router';
16
+import moment from 'moment';
17
+import AuthButton from '@/components/AuthButton';
18
+import withActions from '@/components/ActionList';
19
+import EditIcon from '@/components/EditIcon';
20
+import Navigate from '@/components/Navigate';
21
+import SelectCity from '@/components/SelectButton/CitySelect';
22
+import BuildSelect from '@/components/SelectButton/BuildSelect';
23
+import apis from '@/services/apis';
24
+import request from '@/utils/request';
25
+import QueryTable from '@/components/QueryTable';
26
+
27
+const LookHouseActivity = props => {
28
+  const ref = useRef();
29
+
30
+  const searchFields = [
31
+    {
32
+      name: 'cityId',
33
+      label: '城市',
34
+      placeholder: '请选择城市',
35
+      render: () => <SelectCity style={{ width: 160 }} />,
36
+    },
37
+    {
38
+      name: 'buildingId',
39
+      label: '项目',
40
+      placeholder: '请选择项目',
41
+      render: () => <BuildSelect style={{ width: 160 }} />,
42
+    },
43
+
44
+    {
45
+      name: 'title',
46
+      label: '标题',
47
+      placeholder: '请输入标题',
48
+    },
49
+    {
50
+      name: 'time',
51
+      label: '时间',
52
+      placeholder: '请选择时间',
53
+      type: 'datepicker',
54
+    },
55
+  ];
56
+
57
+  const toLookHouseActivityDetail = dynamicId => () => {
58
+    router.push({
59
+      pathname: '/activity/lookHouseActivity/detail',
60
+      query: {
61
+        dynamicId,
62
+      },
63
+    });
64
+  };
65
+
66
+  // 跳转到编辑
67
+  const toLookHouseActivityEdit = dynamicId => {
68
+    router.push({
69
+      pathname: '/activity/lookHouseActivity/edit',
70
+      query: {
71
+        dynamicId,
72
+      },
73
+    });
74
+  };
75
+
76
+  //   置顶
77
+  const topDynamic = row => () => {
78
+    const weight = Math.abs(row.weight - 1);
79
+    request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } })
80
+      .then(data => {
81
+        message.info('操作成功!');
82
+        ref.current.reload();
83
+      })
84
+      .catch(err => {
85
+        console.log(err);
86
+        message.info(err.msg || err.message);
87
+      });
88
+  };
89
+
90
+  //   推首页
91
+  const homeDynamic = row => () => {
92
+    const home = Math.abs(row.home - 1);
93
+    request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } })
94
+      .then(data => {
95
+        message.info('操作成功!');
96
+        ref.current.reload();
97
+      })
98
+      .catch(err => {
99
+        console.log(err);
100
+        message.info(err.msg || err.message);
101
+      });
102
+  };
103
+
104
+  //结束活动
105
+  const finishDynamic = row => {
106
+    Modal.confirm({
107
+      title:
108
+        '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
109
+      okText: '确定',
110
+      cancelText: '取消',
111
+      onOk() {
112
+        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } })
113
+          .then(data => {
114
+            message.info('操作成功!');
115
+            ref.current.reload();
116
+          })
117
+          .catch(err => {
118
+            console.log(err);
119
+            message.info(err.msg || err.message);
120
+          });
121
+      },
122
+    });
123
+  };
124
+
125
+  // 发布活动
126
+  const sendDynamic = row => {
127
+    Modal.confirm({
128
+      title: '确定发布吗?',
129
+      okText: '确认',
130
+      cancelText: '取消',
131
+      onOk() {
132
+        request({ ...apis.activity.send, urlData: { id: row.dynamicId } })
133
+          .then(data => {
134
+            message.info('操作成功!');
135
+            ref.current.reload();
136
+          })
137
+          .catch(err => {
138
+            console.log(err);
139
+            message.info(err.msg || err.message);
140
+          });
141
+      },
142
+    });
143
+  };
144
+
145
+  // 取消活动
146
+  const cancelDynamic = row => {
147
+    Modal.confirm({
148
+      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
149
+      okText: '确认',
150
+      cancelText: '取消',
151
+      onOk() {
152
+        request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } })
153
+          .then(data => {
154
+            message.info('操作成功!');
155
+            ref.current.reload();
156
+          })
157
+          .catch(err => {
158
+            console.log(err);
159
+            message.info(err.msg || err.message);
160
+          });
161
+      },
162
+    });
163
+  };
164
+
165
+  //   发布or取消发布
166
+  const sendOrPublicDynamic = row => {
167
+    if (row.status === 1) {
168
+      cancelDynamic(row);
169
+    } else {
170
+      sendDynamic(row);
171
+    }
172
+  };
173
+
174
+  const getJoinPeople = dynamicId => () => {
175
+    router.push({
176
+      pathname: '/activity/lookHouseActivity/registrationRecord',
177
+      query: {
178
+        dynamicId,
179
+      },
180
+    });
181
+  };
182
+
183
+  const columns = [
184
+    {
185
+      title: '活动标题',
186
+      dataIndex: 'title',
187
+      key: 'title',
188
+      align: 'center',
189
+      width: '20%',
190
+      render: (x, row) => (
191
+        <Navigate onClick={toLookHouseActivityDetail(row.dynamicId)}>
192
+          <Typography.Text ellipsis>{row.title}</Typography.Text>
193
+        </Navigate>
194
+      ),
195
+    },
196
+    {
197
+      title: '活动时间',
198
+      dataIndex: 'startDate',
199
+      key: 'startDate',
200
+      align: 'center',
201
+      width: '15%',
202
+      // width: '20%',
203
+      render: (x, row) => (
204
+        <>
205
+          <span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format(
206
+            'YYYY-MM-DD',
207
+          )}`}</span>
208
+        </>
209
+      ),
210
+    },
211
+    {
212
+      title: '已参与人数',
213
+      dataIndex: 'count',
214
+      key: 'count',
215
+      align: 'center',
216
+      render: (x, row) => <Navigate onClick={getJoinPeople(row.dynamicId)}>{row.count}</Navigate>,
217
+    },
218
+    // {
219
+    //   title: '阅读量',
220
+    //   dataIndex: 'pvNum',
221
+    //   key: 'pvNum',
222
+    //   align: 'center',
223
+    //   // width: '10%',
224
+    // },
225
+    // {
226
+    //   title: '转发量',
227
+    //   dataIndex: 'shareNum',
228
+    //   key: 'shareNum',
229
+    //   align: 'center',
230
+    //   // width: '10%',
231
+    // },
232
+    // {
233
+    //   title: '收藏数',
234
+    //   dataIndex: 'saveNum',
235
+    //   key: 'saveNum',
236
+    //   align: 'center',
237
+    //   // width: '10%',
238
+    // },
239
+    {
240
+      title: '报名状态',
241
+      dataIndex: 'activityStatus',
242
+      key: 'activityStatus',
243
+      align: 'center',
244
+      render: activityStatus =>
245
+        activityStatus == 0 ? '进行中' : activityStatus == 1 ? '未开始' : '已结束',
246
+    },
247
+    {
248
+      title: '权重',
249
+      dataIndex: 'heavy',
250
+      key: 'heavy',
251
+      align: 'center',
252
+    },
253
+    {
254
+      title: '操作',
255
+      dataIndex: 'handle',
256
+      key: 'handle',
257
+      align: 'center',
258
+      render: withActions((x, row) => [
259
+        <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
260
+          <EditIcon
261
+            type={row.status === 1 ? 'cancel' : 'publish'}
262
+            text={row.status === 1 ? '取消发布' : '发布'}
263
+            onClick={() => sendOrPublicDynamic(row)}
264
+          />
265
+        </AuthButton>,
266
+
267
+        // //   <EditIcon type="look" text="查看详情" onClick={toLookHouseActivityDetail(row.dynamicId)} />,
268
+
269
+        row.activityStatus === 0 ? (
270
+          <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
271
+            <EditIcon type="end" text="结束活动" onClick={finishDynamic.bind(this, row)} />
272
+          </AuthButton>
273
+        ) : null,
274
+
275
+        <AuthButton name="admin.buildingDynamic.tag" noRight={null}>
276
+          <EditIcon
277
+            type={row.weight === 1 ? 'cancel' : 'add'}
278
+            text={row.weight === 1 ? '取消标签' : '添加标签'}
279
+            onClick={topDynamic(row)}
280
+          />
281
+        </AuthButton>,
282
+
283
+        <EditIcon
284
+          type={row.home === 1 ? 'cancel' : 'top'}
285
+          text={row.home === 1 ? '取消推首页' : '推荐首页'}
286
+          onClick={homeDynamic(row)}
287
+        />,
288
+
289
+        //   <AuthButton name="admin.buildingDynamic.dataRecord" noRight={null}>
290
+        //     <EditIcon type="record" text="数据记录" onClick={toDataReacord(row.dynamicId)} />
291
+        //   </AuthButton>,
292
+
293
+        row.activityStatus === 0 || row.activityStatus === 1 ? (
294
+          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
295
+            <EditIcon
296
+              type="edit"
297
+              text="编辑"
298
+              onClick={() => toLookHouseActivityEdit(row.dynamicId, row.count)}
299
+            />
300
+          </AuthButton>
301
+        ) : null,
302
+      ]),
303
+    },
304
+  ];
305
+
306
+  const actionRender = () => {
307
+    return (
308
+      <Button type="primary" icon="plus" onClick={() => toLookHouseActivityEdit()}>
309
+        新增
310
+      </Button>
311
+    );
312
+  };
313
+
314
+  return (
315
+    <QueryTable
316
+      ref={ref}
317
+      rowKey="dynamicId"
318
+      api={apis.activity.list}
319
+      searchFields={searchFields}
320
+      columns={columns}
321
+      postData={data => {
322
+        data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
323
+        return data;
324
+      }}
325
+      actionRender={actionRender}
326
+      // onPageChange={(pg) => setPage(pg)}
327
+    />
328
+  );
329
+};
330
+
331
+export default SignupActivity;

+ 213
- 0
src/pages/activity/lookHouseActivity/registrationRecord.jsx Parādīt failu

@@ -0,0 +1,213 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Table, Card } from 'antd';
3
+
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import apis from '@/services/apis';
7
+import request from '@/utils/request';
8
+
9
+const { Option } = Select;
10
+
11
+/**
12
+ *
13
+ *
14
+ * @param {*} props
15
+ * @returns
16
+ */
17
+
18
+const columns = [
19
+  {
20
+    title: '用户姓名',
21
+    dataIndex: 'name',
22
+    key: 'name',
23
+    align: 'center',
24
+  },
25
+  {
26
+    title: '手机号',
27
+    dataIndex: 'phone',
28
+    key: 'phone',
29
+    align: 'center',
30
+  },
31
+  {
32
+    title: '参与人数',
33
+    dataIndex: 'attendNum',
34
+    key: 'attendNum',
35
+    align: 'center',
36
+  },
37
+  {
38
+    title: '报名时间',
39
+    dataIndex: 'createDate',
40
+    key: 'createDate',
41
+    align: 'center',
42
+    render: (x, row) => (
43
+      <>
44
+        <span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span>
45
+      </>
46
+    ),
47
+  },
48
+  {
49
+    title: '推广人员',
50
+    dataIndex: 'sharePersonName',
51
+    key: 'sharePersonName',
52
+    align: 'center',
53
+  },
54
+  {
55
+    title: '公司',
56
+    dataIndex: 'orgName',
57
+    key: 'orgName',
58
+    align: 'center',
59
+  },
60
+  {
61
+    title: '状态',
62
+    dataIndex: 'isCheckin',
63
+    key: 'isCheckin',
64
+    align: 'center',
65
+    render: (x, row) => (
66
+      <>
67
+        <span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span>
68
+      </>
69
+    ),
70
+  },
71
+];
72
+
73
+const header = props => {
74
+  const [data, setData] = useState({ list: {} });
75
+  const [loading, setLoading] = useState(false);
76
+  
77
+  //   const [page, changePage] = useState({})
78
+  // 存入导入数据的值
79
+  const { getFieldDecorator, getFieldsValue } = props.form;
80
+  // eslint-disable-next-line react-hooks/rules-of-hooks
81
+  useEffect(() => {
82
+    // eslint-disable-next-line no-use-before-define
83
+    getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId });
84
+  }, []);
85
+
86
+  // 查询列表
87
+  const getSignList = params => {
88
+    // eslint-disable-next-line no-shadow
89
+    setLoading(true)
90
+    request({ ...apis.activity.signList, params: { ...params } }).then(data => {
91
+     
92
+      setData(data);
93
+      setLoading(false)
94
+    });
95
+  };
96
+
97
+  const changePageNum = pageNumber => {
98
+    getSignList({ pageNum: pageNumber, pageSize: 10, dynamicId: props.location.query.dynamicId });
99
+  };
100
+
101
+  const toActivityList = () => {
102
+    router.go('-1')
103
+  };
104
+  // 提交事件
105
+  // eslint-disable-next-line no-shadow
106
+  const handleSubmit = (e, props) => {
107
+    e.preventDefault();
108
+    props.form.validateFields((err, values) => {
109
+      getSignList({
110
+        pageNum: 1,
111
+        pageSize: 10,
112
+        dynamicId: props.location.query.dynamicId,
113
+        isCheckin: values.isCheckin,
114
+        name: values.name,
115
+        phone: values.phone,
116
+      });
117
+    });
118
+  };
119
+  // 重置搜索
120
+  function handleReset() {
121
+    props.form.resetFields();
122
+    getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId });
123
+  }
124
+  // eslint-disable-next-line class-methods-use-this
125
+  function exportHelp() {
126
+    const fieldsValue = getFieldsValue();
127
+    console.log('fieldsValue', fieldsValue);
128
+    request({
129
+      ...apis.activity.getTaActivityDynamicEnlistExport,
130
+      params: { ...fieldsValue, dynamicId: props.location.query.dynamicId },
131
+    })
132
+      .then(data => {
133
+        if (!data) {
134
+          return;
135
+        }
136
+        const url = window.URL.createObjectURL(new Blob([data]));
137
+        const link = document.createElement('a');
138
+        link.style.display = 'none';
139
+        link.href = url;
140
+        link.setAttribute('download', '报名列表.xlsx');
141
+        document.body.append(link);
142
+        link.click();
143
+      })
144
+      .catch(() => {});
145
+  }
146
+
147
+  return (
148
+    <Card>
149
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
150
+        <Form.Item>
151
+          {getFieldDecorator('isCheckin')(
152
+            <Select style={{ width: '180px' }} placeholder="签到状态">
153
+              <Option value="0">未签到</Option>
154
+              <Option value="1">已签到</Option>
155
+            </Select>,
156
+          )}
157
+        </Form.Item>
158
+        <Form.Item>
159
+          {getFieldDecorator('name')(
160
+            <Input
161
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
162
+              placeholder="用户姓名"
163
+            />,
164
+          )}
165
+        </Form.Item>
166
+        <Form.Item>
167
+          {getFieldDecorator('phone')(
168
+            <Input
169
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
170
+              placeholder="手机号"
171
+            />,
172
+          )}
173
+        </Form.Item>
174
+        <Form.Item>
175
+          <Button type="primary" htmlType="submit">
176
+            搜索
177
+          </Button>
178
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
179
+            重置
180
+          </Button>
181
+        </Form.Item>
182
+        <Button style={{ position: 'absolute', right: '30px' }} onClick={toActivityList}>
183
+          返回
184
+        </Button>
185
+      </Form>
186
+
187
+      <div style={{ textAlign: 'right', margin: '6px 0 10px 0' }}>
188
+        {' '}
189
+        <Button
190
+          name="admin.activityDynamicEnlist.export.get"
191
+          noRight={null}
192
+          type="primary"
193
+          onClick={exportHelp}
194
+        >
195
+          导出
196
+        </Button>
197
+      </div>
198
+      <Table
199
+        dataSource={data.list.data}
200
+        columns={columns}
201
+        pagination={{ total: data.total, onChange: changePageNum }}
202
+        loading={loading}
203
+        rowKey="activity"
204
+      />
205
+      {/* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
206
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
207
+      </div> */}
208
+    </Card>
209
+  );
210
+};
211
+const WrappedHeader = Form.create({ name: 'header' })(header);
212
+
213
+export default WrappedHeader;

+ 82
- 51
src/pages/building/Developers/Edit.jsx Parādīt failu

@@ -1,12 +1,14 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Input, Button, Card, Form,  notification } from 'antd';
2
+import { Input, Button, Card, Form,  notification,message } from 'antd';
3 3
 import router from 'umi/router';
4 4
 // import Styles from './style.less';
5 5
 import ImageUploader from '../../../components/XForm/ImageUpload';
6 6
 import request from '../../../utils/request';
7 7
 import apis from '../../../services/apis';
8
+import { fetch } from '@/utils/request';
8 9
 
9
-const formItemLayout = {
10
+
11
+  const formItemLayout = {
10 12
     labelCol: {
11 13
       xs: { span: 24 },
12 14
       sm: { span: 8 },
@@ -31,35 +33,69 @@ const formItemLayout = {
31 33
 
32 34
 function Edit(props) {
33 35
   const { getFieldDecorator } = props.form;
36
+  const { form, history } = props;
37
+  const updateBrandData = fetch(apis.brand.alterBrand);
38
+  const saveBrandData=fetch(apis.brand.addBrand);
39
+  const goBack = () => router.goBack(-1);
40
+  const {validateFields}=form;
41
+
34 42
 
35 43
   // eslint-disable-next-line react-hooks/rules-of-hooks
36 44
   let data = {};
37
-  const { id } = props.location.query;
45
+  const { brandId } = props.location.query;
38 46
 
39
-  useEffect(() => {
40
-    if (id) {
41
-      getById(id);
47
+
48
+  useEffect(()=>{
49
+    if (brandId) {
50
+      getById({brandId})
42 51
     }
43
-  }, [id]);
52
+  },[brandId])
53
+
44 54
 
55
+//增+改
45 56
   function handleSubmit(e) {
46 57
     e.preventDefault();
47
-    props.form.validateFields((err, values) => {
48
-      if (!err) {
49
-        // 提交数据
50
-        submitData(values);
58
+    validateFields((err, values) => {
59
+      if (err) {
60
+        return;
61
+        //字符验证未填写---返回
62
+      }
63
+      if (brandId) {
64
+        updateBrandData({
65
+          data: {
66
+            ...values,
67
+          },
68
+          urlData: { id: brandId }
69
+        }).then(() => {
70
+          // setLoading(false);
71
+          message.success('数据更新成功');
72
+          goBack()
73
+        }).catch((err) => {
74
+          // setLoading(false);//loading消失
75
+          message.error(err.message || err);
76
+        })
77
+      } else {
78
+        saveBrandData({ data: values }).then(() => {
79
+          // setLoading(false);
80
+          message.success('数据保存成功');
81
+          goBack()
82
+        }).catch((err) => {
83
+          // setLoading(false);//loading消失
84
+          message.error(err.message || err);
85
+        })
51 86
       }
52 87
     });
53
-  }
54 88
 
89
+
90
+
91
+  }
55 92
   // 获取详情信息
56
-  function getById(currentId) {
57
-    request({ ...apis.buildingType.getById, urlData: { id: currentId } }).then(res => {
93
+  function getById(res) {
94
+    request({ ...apis.brand.getBrand, urlData: { id: res.brandId } }).then(res => {
58 95
       data = res;
59 96
       props.form.setFieldsValue(res);
60 97
     });
61 98
   }
62
-
63 99
   const openNotificationWithIcon = (type, message) => {
64 100
     notification[type]({
65 101
       message,
@@ -67,46 +103,41 @@ function Edit(props) {
67 103
     });
68 104
   };
69 105
 
70
-  function submitData(dataSources) {
71
-    if (id !== '') {
72
-      // 修改
73
-      updateType(dataSources);
74
-      return;
75
-    }
76 106
 
77
-    dataSources.status = 1;
78
-    dataSources.createDate = new Date();
79
-    request({ ...apis.buildingType.add, data: { ...dataSources } })
80
-      .then(() => {
81
-        // eslint-disable-next-line no-unused-expressions
82
-        openNotificationWithIcon('success', '操作成功');
83
-        router.go(-1);
84
-      })
85
-      .catch(err => {});
86
-  }
107
+//修改
108
+  // function submitData(dataSources) {
109
+  //   if (id !== '') {
110
+  //     // 修改
111
+  //     updateType(dataSources);
112
+  //     return;
113
+  //   }
114
+  //   dataSources.status = 1;
115
+  //   dataSources.createDate = new Date();
116
+  //   request({ ...apis.brand.alterBrand, data: { ...dataSources } })
117
+  //     .then(() => {
118
+  //       // eslint-disable-next-line no-unused-expressions
119
+  //       openNotificationWithIcon('success', '操作成功');
120
+  //       router.go(-1);
121
+  //     })
122
+  //     .catch(err => {});
123
+  // }
87 124
 
88
-  // 修改
89
-  function updateType(row) {
90
-    // const { url, method } = apis.buildingType.update
91
-    // const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(row.buildingTypeId)
92
-
93
-    // request({ url: tempUrl, method, data: { ...row } }).then(() => {
94
-    //   router.go(-1)
95
-    // })
96
-    request({ ...apis.buildingType.update, urlData: { id: row.buildingTypeId }, data: { ...row } })
97
-      .then(() => {
98
-        // eslint-disable-next-line no-unused-expressions
99
-        openNotificationWithIcon('success', '操作成功');
100
-        router.go(-1);
101
-      })
102
-      .catch(err => {});
103
-  }
125
+  //新增
126
+  // function updateType(row) {
127
+  //   request({ ...apis.brand.addBrand, urlData: { id: row.brandId }, data: { ...row } })
128
+  //     .then(() => {
129
+  //       // eslint-disable-next-line no-unused-expressions
130
+  //       openNotificationWithIcon('success', '操作成功');
131
+  //       router.go(-1);
132
+  //     })
133
+  //     .catch(err => {});
134
+  // }
104 135
 
105 136
   return (
106 137
     <Card>
107 138
       <Form {...formItemLayout} onSubmit={handleSubmit}>
108 139
       <Form.Item label="开发商名称">
109
-          {getFieldDecorator('name', {
140
+          {getFieldDecorator('brandName', {
110 141
             rules: [
111 142
               {
112 143
                 required: true,
@@ -116,17 +147,17 @@ function Edit(props) {
116 147
           })(<Input style={{width:200}}/>)}
117 148
         </Form.Item>
118 149
         <Form.Item label="开发商索引">
119
-          {getFieldDecorator('ind', {
150
+          {getFieldDecorator('indexLetter', {
120 151
             rules: [{ required: true, message: '请输入开发商索引' }],
121 152
           })(<Input style={{width:200}}/>)}
122 153
         </Form.Item>
123 154
         <Form.Item label="品牌宣传图">
124
-          {getFieldDecorator('img', {
155
+          {getFieldDecorator('brandImg', {
125 156
             rules: [{ required: true, message: '请上传品牌宣传图' }],
126 157
         })(<ImageUploader />)}
127 158
         </Form.Item>
128 159
         <Form.Item label="开发商简介">
129
-          {getFieldDecorator('buildingTypeName', {
160
+          {getFieldDecorator('brandRemark', {
130 161
             rules: [{ required: true, message: '请输入开发商简介' }],
131 162
           })(<Input.TextArea style={{width:400}} placeholder="120字内的简介"/>)}
132 163
         </Form.Item>

+ 39
- 13
src/pages/building/Developers/index.jsx Parādīt failu

@@ -1,40 +1,66 @@
1
-import React, { useMemo, useRef, useCallback, useState } from 'react'
2
-import {Button} from 'antd'
1
+import React, { useMemo, useRef, useCallback, useState, useEffect } from 'react'
2
+import {Button,message} from 'antd'
3 3
 import apis from '@/services/apis'
4 4
 import AuthButton from '@/components/AuthButton';
5 5
 import QueryTable from '@/components/QueryTable'
6 6
 import getTableColumns from './tableColumns'
7 7
 import { router } from 'umi';
8
+import { fetch} from '@/utils/request';
9
+import request from '@/utils/request'
8 10
 import getSearchFields from './searchFields'//searchbox
9 11
 
10 12
 export default (props) => {
11 13
   const ref = useRef()
12 14
   const [page, setPage] = useState({current: 1, pageSize: 10})
13 15
   const toEdit = useCallback((row) => {
14
-    //
15 16
     router.push({
16 17
       pathname: '/building/Developers/Edit',
17 18
       query: {
18
-        id: row?.id || undefined,
19
+        brandId: row?.brandId || undefined,
19 20
       },
20
-    });
21
+    });            
21 22
   }, [])
22 23
 
23
-  const onDelete = useCallback((row) => {}, [])//格式
24
-  const searchFields = useMemo(getSearchFields, [])//搜索框
24
+ 
25
+
26
+//编辑
27
+  // const onEdit =useCallback((row,brandId)=>{
28
+  //   request({
29
+  //     ...apis.brand.alterBrand,
30
+  //     urlData: { id: brandId },
31
+  //     data:{ ...row}
32
+  // }).then((data) => {
33
+  //     setNewsData(data)
34
+  // }).catch((err) => {
35
+  //   message.error(err.msg || err.message)
36
+  // })
37
+  // },[])
25 38
 
39
+//删除
40
+  const onDelete = useCallback((row,brandId) => {
41
+    request({ ...apis.brand.deleBrand, urlData: { id: brandId }, data: { ...row, } }).then((data) => {
42
+      ref.current.reload();//调用ref对象都有current对象
43
+      message.info('操作成功!')
44
+    }).catch((err) => {
45
+      console.log(err)
46
+      message.info(err.msg || err.message)
47
+    })
48
+  }, [])//格式
49
+  const searchFields = useMemo(getSearchFields, [])//搜索框
50
+    
26 51
   const tableColumns = useMemo(() => {
27 52
     return getTableColumns({
28
-      page,//可无
53
+      page,//
29 54
       onEdit:(e)=>toEdit(e),
30 55
       onDelete,
56
+      // onEdit,
31 57
     })
32 58
   }, [page])
33 59
 
34 60
   const actionRender = () => {
35 61
     return (
36
-      //name 名字错误
37
-      <AuthButton name="admin.tdBuildingType.add" noRight={null}>
62
+      //name
63
+      <AuthButton name="admin.brand.addBrand" noRight={null}>
38 64
         <Button type="primary" icon="plus" onClick={toEdit} >
39 65
           新增
40 66
         </Button>
@@ -45,9 +71,9 @@ export default (props) => {
45 71
   return (
46 72
     <>
47 73
       <QueryTable
48
-      //搜索组件
49
-        rowKey="buildingId"
50
-        api={apis.building.getList}
74
+        ref={ref}//绑定到table
75
+        rowKey="brandId"
76
+        api={apis.brand.list}
51 77
         columns={tableColumns}
52 78
         actionRender={actionRender}
53 79
         searchFields={searchFields}

+ 1
- 1
src/pages/building/Developers/searchFields.js Parādīt failu

@@ -2,7 +2,7 @@
2 2
 export default () => [
3 3
 
4 4
   {
5
-    name: 'name',
5
+    name: 'brandName',
6 6
     label: '开发商名称',
7 7
     placeholder: '请输入开发商名称',
8 8
   },

+ 17
- 31
src/pages/building/Developers/tableColumns.js Parādīt failu

@@ -1,53 +1,39 @@
1 1
 import { router } from 'umi'
2
-import { Button, Badge } from 'antd'
2
+import React, { useState, useEffect } from 'react';
3
+
4
+import { Button, Badge, message } from 'antd'
3 5
 import moment from 'moment'
4 6
 import OperButton from '@/components/OperButton'
5 7
 import AuthButton from '@/components/AuthButton'
6 8
 import withActions from '@/components/ActionList'
9
+import { getImgURL } from '@/utils/image';
10
+import request, { apis } from '@/utils/request'
7 11
 
8
-export default ({page, onEdit, onDelete}) => [
12
+export default ({page,getBrandData, onEdit, onDelete}) => [
9 13
   {
10 14
     title: '开发商索引字母',
11
-    key: '#',
15
+    dataIndex:'indexLetter',
16
+    key: 'indexLetter',
12 17
     align: 'center',
13
-    render: (t, r, index) => (page.current - 1) * page.pageSize + index + 1,//可无
14 18
   },
15 19
   {
16 20
     title: '开发商名称',
17
-    dataIndex: 'name',
18
-    key: 'name',
21
+    dataIndex: 'brandName',
22
+    key: 'brandName',
19 23
     align: 'center',
20 24
   },
21 25
   {
22 26
     title: '品牌宣传图',
23
-    dataIndex: 'image',
24
-    key: 'image',
27
+    dataIndex: 'brandImg',
28
+    key: 'brandImg',
25 29
     align: 'center',
26
-    render: (_, row) => {
27
-      if (row.image) {
28
-        return <img src={row.image} width={128} height={72} style={{borderRadius: '4px'}} alt="" />
29
-      }
30
-      return null
31
-    }
30
+    render:(_,record)=> <img src={getImgURL(record.brandImg)} style={{width:'165px',height:'104px'}}/>,
32 31
   },
33 32
   {
34 33
     title: '简介',
35
-    dataIndex: 'buildingName',
36
-    key: 'buildingName',
34
+    dataIndex: 'brandRemark',
35
+    key: 'brandRemark',
37 36
     align: 'center',
38
-    // render: (t, row) => (
39
-    //   <AuthButton name="admin.building.update" noRight={t}>
40
-    //     <Button
41
-    //       type="link"
42
-    //       onClick={() => router.push({
43
-    //         pathname: '/building/list/add',
44
-    //         query: {
45
-    //           id: row.buildingId,
46
-    //         },
47
-    //       })}
48
-    //     >{t}</Button>
49
-    //   </AuthButton>
50
-    // )
51 37
   },
52 38
   {
53 39
     title: '操作',
@@ -57,11 +43,11 @@ export default ({page, onEdit, onDelete}) => [
57 43
       <AuthButton name="admin.building.public" noRight={null}>
58 44
         <OperButton onClick={() => onEdit(row)}>编辑</OperButton>
59 45
       </AuthButton>,
60
-      <AuthButton name="admin.building.delete" noRight={null}>
46
+      <AuthButton name="admin.brabd.delete" noRight={null}>
61 47
         <OperButton.Confirm
62 48
           title="确认删除?"
63 49
           content="删除之后不可恢复"
64
-          onClick={() => onDelete(row)}
50
+          onClick={()=>onDelete(row,row.brandId)}
65 51
         >删除</OperButton.Confirm>
66 52
       </AuthButton>
67 53
     ], {noMargin: true})

+ 22
- 32
src/pages/home/Recommend/index.jsx Parādīt failu

@@ -14,22 +14,16 @@ import { fromPairs } from 'lodash';
14 14
 import { backgroundColor } from 'echarts/lib/theme/dark';
15 15
 
16 16
 
17
-// const a={
18
-//   /**
19
-//  *
20
-//  *
21
-//  * @param {*} props
22
-//  * @returns
23
-//  */
24
-
25
-// }
26
-// let(dataIndex){
27
-//   render(){
28
-//     return(
29
-//       <h1><input type="datetime-local" name="ckassname" id="" /></h1>
30
-//     )
31
-//   }
32
-// }
17
+
18
+/**
19
+ *
20
+ *
21
+ * @param {*} props
22
+ * @returns
23
+ */
24
+
25
+
26
+
33 27
 
34 28
 function Recommend() {
35 29
   const [exportLoding,setExportLoding] = useState(false)
@@ -70,6 +64,9 @@ function Recommend() {
70 64
 
71 65
     })
72 66
   }
67
+  function back(){
68
+    window.history.back(-1)
69
+  }
73 70
 
74 71
   function download(data) {
75 72
     if (!data) {
@@ -165,13 +162,7 @@ function Recommend() {
165 162
 
166 163
 
167 164
  const searchFields=[
168
-  // {
169
-  //   name:'builidingId',
170
-  //   label:'用户',
171
-  //   placeholder:'选择用户',
172
-  //   render:()=><BuildSelect style={{width:160}}/>
173 165
 
174
-  // },
175 166
   {
176 167
     name: 'project',
177 168
     label: '意向项目',
@@ -193,12 +184,11 @@ function Recommend() {
193 184
     label: '类型',
194 185
     placeholder: '类型',
195 186
     type: 'select',
196
-    placeholder:'全部',//错误
197 187
     options: [
198
-      {label: '全部'},
199
-      {label: '买房',value:1},
200
-      {label: '租房', value: 2},
201
-      {label: '海外', value: 3}
188
+      {label: '全部',value:''},
189
+      {label: '买房',value: '1'},
190
+      {label: '租房', value: '2'},
191
+      {label: '海外', value: '3'}
202 192
     ]
203 193
   },
204 194
   {
@@ -208,10 +198,10 @@ function Recommend() {
208 198
     type: 'select',
209 199
     placeholder:'全部',//错误
210 200
     options: [
211
-      {label: '全部'},
212
-      {label: '待回访', value: 0},
213
-      {label: '已回访', value: 1},
214
-      {label: '无效', value: 2}
201
+      {label: '全部',value:''},
202
+      {label: '待回访', value: '0'},
203
+      {label: '已回访', value: '1'},
204
+      {label: '无效', value: '2'}
215 205
     ]
216 206
   },
217 207
   ]
@@ -228,7 +218,7 @@ function Recommend() {
228 218
       <QueryTable
229 219
           rowKey="recommendCustomer"
230 220
           // recommendCustomer
231
-          api={apis.homeload.houseSchr}
221
+          api={apis.searchHouse.list}
232 222
           searchFields={searchFields}
233 223
           columns={columns}
234 224
           actionRender={actionRender}

+ 0
- 0
src/pages/staff/Organization/form.jsx Parādīt failu


+ 122
- 126
src/pages/staff/Organization/index.jsx Parādīt failu

@@ -1,144 +1,140 @@
1
-import React, { Component } from 'react';
2
-import { Card, Tree } from 'antd';
3
-const { DirectoryTree } = Tree;
4
-
5
-// function Organization(props) {
6
-  
7
-
8
-
9
-//   return (
10
-//     <>
11
-//      组织架构
12
-//     </>
13
-//   );
14
-// }
15
-
16
-
17
-// export default Organization
18
-
19 1
 
2
+import React, { Component,useState } from 'react';
3
+import { Card, Tree,Icon } from 'antd';
4
+import { render } from 'preact';
5
+import { turn } from 'cli-table';
6
+const { DirectoryTree,TreeNode } = Tree;
20 7
 const treeData = [
21 8
   {
22
-    title: '江苏XX软件集团',
23
-    key: '0-0',
24
-    children: [
25
-      {
26
-        title: '南京123电子科技有限公司',
27
-        key: '0-0-1',
28
-
29
-        // isLeaf: true,
30
-        children: [
31
-          {
32
-            title: '秦淮区分公司',
33
-            key: '0-0-1-0',
34
-            // isLeaf: true,
35
-            children: [
36
-              {
37
-                title: '制造一区',
38
-                key: '0-0-1-1',
39
-                isLeaf: true,
40
-              },
41
-              {
42
-                title: '总裁办公室',
43
-                key: '0-0-1-2',
44
-                isLeaf: true,
45
-              },
46
-              {
47
-                title: '工艺部',
48
-                key: '0-0-1-3',
49
-                isLeaf: true,
50
-              },
51
-              {
52
-                title: '技术部',
53
-                key: '0-0-1-4',
54
-                isLeaf: true,
55
-              },
56
-            ]
57
-          },
58
-        ]
59
-      },
60
-      {
61
-        title: '苏州¥¥科技股份有限公司',
62
-        key: '0-0-0',
63
-        isLeaf: true,
64
-      },
65
-      {
66
-        title: '宿迁ABC电商服务有限公司',
67
-        key: '0-0-0-1',
68
-        isLeaf: true,
69
-      },
70
-    ],
71
-  },
72
-  //---------------
73
-  {
74
-    title: '系统管理',
75
-    key: '0-2',
76
-    children: [
77
-      {
78
-        title: '机器设置',
79
-        key: '0-2-0',
80
-        isLeaf: true,
81
-      },
9
+    value:'江苏省公安厅',
10
+    defaultValue:'0',
11
+    parentKey:'0',
12
+    isEditable:false,
13
+    key:'0',
14
+    children:[
82 15
       {
83
-        title: '散热设置',
84
-        key: '0-2-1',
85
-        // isLeaf: true,
86
-        children:[
87
-          {
88
-            title:'一号风扇',
89
-            key:'0-2-1-0'
90
-          },
91
-          {
92
-            title:'二号风扇',
93
-            key:'0-2-1-1'
94
-          },
95
-        ]
16
+        value:'南京分局',
17
+        key:'0-1',
18
+        defaultValue: "0-1",
19
+        isEditable: false,
96 20
       },
97 21
       {
98
-        title: '广播设置',
99
-        key: '0-2-2',
100
-        isLeaf: true,
22
+        value:'苏州分局',
23
+        key:'0-2',
24
+        defaultValue: "0-2",
25
+        isEditable: false,
101 26
       },
102 27
     ],
103 28
   },
104 29
 ];
105 30
 
106
-const Demo = () => {
107
-  const onSelect = (keys, info) => {
108
-    console.log('Trigger Select', keys, info);
109
-  };
110 31
 
111
-  const onExpand = () => {
112
-    console.log('Trigger Expand');
32
+const expandedKeyArr=['0'];
33
+
34
+
35
+export default function TreeDemo() {
36
+  const[data,setData]=useState(treeData)//获取值,及时更新被修改的值。变量
37
+  const renderTreeNodes=(data)=>{
38
+    let nodeArr=data.map((item)=>{//遍历数据
39
+      item.title=(//修改
40
+        <div style={{display:'flex', minWidth: '100px'}}>
41
+          <span style={{ flex: 'auto' }}>{item.value}</span>
42
+          <span style={{ width: '6em', flex: 'none',marginLeft:'20px' }}>
43
+            {/* 编辑 */}
44
+            <Icon type="edit" onClick={()=>onDelete(item.key)} /> 
45
+            {/* 添加 */}
46
+            <Icon type="diff" onClick={()=>onAdd(item.key)} />
47
+            {/* 删除 */}
48
+            <Icon type="delete"  onClick={()=>onEdit(item.key)}/>
49
+          </span>
50
+        </div>
51
+      )
52
+      if(item.children){//如果有子项就返回下面组件
53
+        return(
54
+          <TreeNode title={item.title} key={item.key} dataRef={item}>
55
+            {renderTreeNodes(item.children)}
56
+            {/* 重新渲染节点 */}
57
+          </TreeNode>//title 接收的 ReactNode类型数据 自定义
58
+        )
59
+      }
60
+      //返回
61
+      return <TreeNode title={item.title} key={item.key} />
62
+    })
63
+      return nodeArr
64
+  };
65
+//添加
66
+  const onAdd=(key)=>{
67
+    // useState 里面数据是不能变的对象。需要slice返回一个新的数组
68
+    addNode(key.treeData);//添加节点 树形
69
+    setData(treeData.slice()) //设置 子项
70
+  }
71
+  //编辑
72
+  const onEdit=(key)=>{
73
+    editNode(key,treeData);
74
+    setData(treeData.slice());
113 75
   };
76
+  const editNode=(key,data)=>
77
+    data.forEach((item)=>{
78
+      if (item.key===key) {
79
+        item.isEditable=true;//可编辑状态更改
80
+      }else{
81
+        item.isEditable=false;
82
+      }
83
+      item.value=item.defaultValue;//当某子项处于编辑状态,改变数据,点击其他时候,此项变成不可编辑
84
+      if (item.children) {
85
+        editNode(key,item.children);
86
+      }
87
+    })  
114 88
 
89
+    //删除
90
+    const onDelete = (key) => {
91
+      deleteNode(key, treeData);
92
+      setData(treeData.slice());
93
+    };
94
+    const deleteNode = (key, data) =>
95
+      data.forEach((item, index) => {
96
+        if (item.key === key) {
97
+          data.splice(index, 1);//从某个位置开始删除元素
98
+          return;
99
+        } else {
100
+          if (item.children) {
101
+            deleteNode(key, item.children);
102
+          }
103
+        }
104
+      });
105
+
106
+  const addNode=(key,data)=>
107
+    data.forEach((item)=>{
108
+      if(item.key===key){//如果拿到的key相同则判断子项
109
+        if (item.children) {
110
+          item.children.push({
111
+            value:"请输入内容",
112
+            key:key+Math.random(100),//随机唯一的key
113
+          });
114
+        }
115
+        return;
116
+      }
117
+      if (item.children) {
118
+        addNode(key,item.children)//子项
119
+      }
120
+    })
115 121
   return (
116
-    <DirectoryTree
117
-      multiple
118
-      defaultExpandAll
119
-      onSelect={onSelect}
120
-      onExpand={onExpand}
121
-      treeData={treeData}
122
-    />
122
+    <div>
123
+      <Card style={{width:'90%'}}>
124
+        <Tree 
125
+        switcherIcon={<Icon type="down-square" theme="filled" />}
126
+        // icon={<Icon type="carry-out" />}
127
+        style={{paddingLeft:'60px'}} 
128
+        treeData={treeData}  >
129
+        {renderTreeNodes(data)}
130
+        </Tree>
131
+        {/* 渲染被更新 */}
132
+      </Card>
133
+    </div>
123 134
   );
124
-};
135
+}
136
+
137
+
138
+
125 139
 
126 140
 
127
-class Treetest extends Component {
128
-    // constructor(props) {
129
-    //     super(props);
130
-    //     //react定义数据
131
-    //     this.state = {
132
-    //     }
133
-    // }
134
-    render() {
135
-        return (
136
-          <div>
137
-            <Card style={{width:'60%'}}>
138
-              <DirectoryTree  treeData={treeData} />
139
-            </Card>
140
-          </div>
141
-        )
142
-    }
143
-}
144
-export default  Treetest;

+ 2
- 2
src/pages/staff/staff/Edit/index.jsx Parādīt failu

@@ -234,7 +234,7 @@ const StaffEdit = (props) => {
234 234
       value: userData.roleIds,
235 235
     },
236 236
     {
237
-      label: '授权项目',
237
+      label: '授权项目', //改成组织机构
238 238
       name: 'buildingId',
239 239
       render: <BuildingSelection userData={userData} />,
240 240
       value: userData.buildingId,
@@ -306,7 +306,7 @@ const StaffEdit = (props) => {
306 306
 
307 307
 
308 308
   return <Card>
309
-            <XForm onChange={console.log} onSubmit={handleSubmit} fields={fields.filter(Boolean)} onCancel={() => router.go(-1)}></XForm>
309
+            <XForm  onSubmit={handleSubmit} fields={fields.filter(Boolean)} onCancel={() => router.go(-1)}></XForm>
310 310
 
311 311
         </Card>
312 312
 }

+ 317
- 0
src/pages/staff/staff/Edit/index1.jsx Parādīt failu

@@ -0,0 +1,317 @@
1
+import React, { useState, useEffect } from 'react';
2
+
3
+import { Input, Card, message, Radio, Select, Modal } from 'antd';
4
+import { FormattedMessage } from 'umi-plugin-react/locale';
5
+import BuildSelect from '@/components/SelectButton/BuildSelect'
6
+import router from 'umi/router';
7
+import { FieldTypes, createForm } from '@/components/XForm';
8
+import Wangedit from '@/components/Wangedit/Wangedit'
9
+// import channels from './channelList.less';
10
+// import Tagss from '../components/Tagss.jsx';
11
+import apis from '@/services/apis';
12
+import request from '@/utils/request'
13
+import BuildingSelection from '../components/BuildingSelection'
14
+
15
+const { TextArea } = Input;
16
+const { Option } = Select;
17
+let consultantChecked = false;
18
+
19
+const setExtraData = (data) => {
20
+  consultantChecked = data.isConsultant
21
+}
22
+
23
+const handleFormValueChange = (props, changedValues, allValues) => {
24
+    setExtraData(allValues)
25
+}
26
+
27
+const XForm = createForm({ onValuesChange: handleFormValueChange })
28
+
29
+/**
30
+ *
31
+ *
32
+ * @param {*} props
33
+ * @returns
34
+ */
35
+const StaffEdit = (props) => {
36
+  const userId = props.location.query.userId
37
+  const [userData, setUserData] = useState({})
38
+  const [tagData, setTagData] = useState([])
39
+  const [roleData, setRoleData] = useState([])
40
+  const [buildData, setBuildData] = useState([])
41
+  const [visible, setVisible] = useState(false)
42
+
43
+  const getTagList = () => {
44
+    request({ ...apis.staff.taTags, params: { pageNum: 1, pageSize: 999 } }).then((data) => {
45
+      setTagData(data.records)
46
+    })
47
+  }
48
+
49
+  const getRoleList = () => {
50
+    request({ ...apis.role.getRoleList, params: { pageNum: 1, pageSize: 999 } }).then((data) => {
51
+      console.log(data)
52
+      setRoleData(data.records)
53
+    })
54
+  }
55
+
56
+  //获取项目列表
57
+  const getBuildList = e => {
58
+    request({ ...apis.building.buildingSelect, params: { pageNum: 1, pageSize: 999 } }).then(data => {
59
+        setBuildData(data)
60
+    })
61
+  }
62
+
63
+  // 查询列表
64
+  const getUserData = (userId) => {
65
+    request({ ...apis.staff.getTaUser, urlData: { id: userId } }).then((data) => {
66
+      consultantChecked = data.isConsultant
67
+      setUserData(data)
68
+    })
69
+  }
70
+
71
+  if(userData.buildingIds && buildData.length > 0 && !consultantChecked){
72
+      const newBuildings = userData.buildingIds.filter(x => buildData.filter(it => it.buildingId === x)[0])
73
+      userData.buildingIds = newBuildings
74
+  }
75
+
76
+  if(userData.roleIds && roleData.length > 0){
77
+    const newRoleIds = userData.roleIds.filter(x => roleData.filter(it => it.roleId === x)[0])
78
+      userData.roleIds = newRoleIds
79
+  }
80
+
81
+  useEffect(() => {
82
+    getTagList();
83
+    getRoleList();
84
+    getBuildList();
85
+    if (userId) {
86
+      getUserData(userId);
87
+    }
88
+  }, [])
89
+
90
+  const tagsChange = (value) => {
91
+    console.log(`selected ${value}`);
92
+  }
93
+
94
+  const handleSubmit = val => {
95
+    if (userId) {
96
+      request({ ...apis.staff.updateTaUser, urlData: { id: userId }, data: val, }).then((data) => {
97
+        console.log(data, "tauser")
98
+        message.info("保存成功")
99
+        router.go(-1)
100
+      }).catch(error => {
101
+        // message.info(error.message)
102
+      })
103
+    } else {
104
+      request({ ...apis.staff.addTaUser, data: val, }).then((data) => {
105
+        console.log(data, "tauser")
106
+        message.info("保存成功")
107
+        router.go(-1)
108
+      }).catch(error => {
109
+        // message.info(error.message)
110
+      })
111
+    }
112
+  }
113
+
114
+  const photoBeforeUpload = (file) => {
115
+    // const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
116
+    // if (!isJpgOrPng) {
117
+    //   message.error('请上传 JPG/PNG 格式的图片!');
118
+    // }
119
+    console.log(file.size, file.size / 1024)
120
+    const isLt100k = (file.size / 1024) < 100;
121
+    if (!isLt100k) {
122
+      message.error('请上传小于100k的图片!');
123
+    }
124
+    return isLt100k;
125
+  }
126
+
127
+  //授权项目改变
128
+  const consultantBuildingChange =(e) => {
129
+    if(userData.isConsultant){
130
+      request({ ...apis.staff.check, params: { userId: userData.userId, personId: userData.consultantPersonId, buildingId: userData.buildingId } }).then(res => {
131
+        if(res.length > 0){
132
+          Modal.confirm({
133
+            title: '此置业顾问下有私客,是否转移私客?',
134
+            okText: '确认',
135
+            cancelText: '取消',
136
+            onOk () {
137
+              setVisible(true)
138
+            },
139
+          });
140
+        }
141
+     })
142
+    }
143
+  }
144
+
145
+   //迁移私客成功回调
146
+   const moveSuccess = (e) => {
147
+    setVisible(false)
148
+  }
149
+
150
+  const fields = [
151
+
152
+
153
+    
154
+    // {
155
+    //   label: '姓名',
156
+    //   name: 'userName',
157
+    //   type: FieldTypes.Text,
158
+    //   value: userData.userName,
159
+    //   rules: [
160
+    //     { required: true, message: '请输入姓名' },
161
+    //   ]
162
+    // },
163
+    // {
164
+    //   label: '公司',
165
+    //   name: 'orgName',
166
+    //   type: FieldTypes.Text,
167
+    //   placeholder: '请输入公司名称',
168
+    //   value: userData.orgName,
169
+    //   rules: [
170
+    //     { required: true, message: '请输入公司名称' },
171
+    //   ]
172
+    // },
173
+    // {
174
+    //   label: '部门',
175
+    //   name: 'department',
176
+    //   type: FieldTypes.Text,
177
+    //   placeholder: '请输入部门',
178
+    //   value: userData.department,
179
+    //   rules: [
180
+    //     { required: true, message: '请输入部门' },
181
+    //   ]
182
+    // },
183
+    // {
184
+    //   label: '职位',
185
+    //   name: 'position',
186
+    //   type: FieldTypes.Text,
187
+    //   placeholder: '请输入职位',
188
+    //   value: userData.position,
189
+    //   rules: [
190
+    //     { required: true, message: '请输入职位' },
191
+    //   ]
192
+    // },
193
+    // {
194
+    //   label: '是否置业顾问',
195
+    //   name: 'isConsultant',
196
+    //   type: FieldTypes.Switch,
197
+    //   value: userData.isConsultant,
198
+    //   props: {disabled: userData.isConsultant},
199
+    // },
200
+    // {
201
+    //   label: '电话',
202
+    //   name: 'phone',
203
+    //   type: FieldTypes.Text,
204
+    //   placeholder: '请输入电话号码',
205
+    //   value: userData.phone,
206
+    //   rules: [
207
+    //     {
208
+    //         required: true,
209
+    //         pattern: new RegExp('^1[0-9]{10}$'),
210
+    //         message: '请输入正确的电话号码',
211
+    //     },
212
+    //   ]
213
+    // },
214
+    // {
215
+    //   label: '登录名',
216
+    //   name: 'loginName',
217
+    //   type: FieldTypes.Text,
218
+    //   placeholder: '请输入登录名',
219
+    //   value: userData.loginName,
220
+    //   // hidden: () => consultantChecked,
221
+    //   help: '默认密码:123456',
222
+    // },
223
+    // {
224
+    //   label: '角色',
225
+    //   name: 'roleIds',
226
+    //   render: <Select
227
+    //     mode="multiple"
228
+    //     style={{ width: '100%' }}
229
+    //     placeholder="请选择标签"
230
+    //     onChange={tagsChange} >
231
+    //     {roleData.map(item => (
232
+    //       <Select.Option key={item.roleId} value={item.roleId}>
233
+    //         {item.roleName}
234
+    //       </Select.Option>
235
+    //     ))}
236
+    //   </Select>,
237
+    //   value: userData.roleIds,
238
+    // },
239
+    // {
240
+    //   label: '授权项目',
241
+    //   name: 'buildingId',
242
+    //   render: <BuildingSelection userData={userData} />,
243
+    //   value: userData.buildingId,
244
+    //   hidden: () => !consultantChecked,
245
+    //   rules: [
246
+    //     { required: true, message: '请选择授权项目' },
247
+    //   ]
248
+    // },
249
+    // {
250
+    //   label: '授权项目',
251
+    //   name: 'buildingIds',
252
+    //   render: <Select
253
+    //     mode="multiple"
254
+    //     showSearch
255
+    //     style={{ width: '100%' }}
256
+    //     placeholder="请选择授权项目"
257
+    //     filterOption={(input, option) =>
258
+    //       option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
259
+    //     }
260
+    //     >
261
+    //     {buildData.map(item => (
262
+    //       <Select.Option key={item.buildingId} value={item.buildingId}>
263
+    //         {item.buildingName}
264
+    //       </Select.Option>
265
+    //     ))}
266
+    //   </Select>,
267
+    //   value: userData.buildingIds,
268
+    //   hidden: () => consultantChecked,
269
+    //   rules: [
270
+    //     { required: true, message: '请选择授权项目' },
271
+    //   ]
272
+    // },
273
+    // {
274
+    //   label: '置业顾问头像',
275
+    //   name: 'photo',
276
+    //   type: FieldTypes.ImageUploader,
277
+    //   extra: '建议图片尺寸:320*320px,比例1:1,格式:jpg,用于置业顾问头像,限制大小:100k',
278
+    //   value: userData.photo,
279
+    //   beforeUpload: (e) => photoBeforeUpload(e),
280
+    //   rules: [
281
+    //     { required: true, message: '请选择头像' },
282
+    //   ]
283
+    // },
284
+    // {
285
+    //   label: '简介',
286
+    //   name: 'description',
287
+    //   render: <TextArea  ></TextArea>,
288
+    //   value: userData.description
289
+    //   // className={channels.inpuitTxt}
290
+    // },
291
+    // {
292
+    //   label: '状态',
293
+    //   name: 'status',
294
+    //   render: <Radio.Group initialValue="1" buttonStyle="solid">
295
+    //     <Radio.Button value="9">禁用</Radio.Button>
296
+    //     <Radio.Button value="1">启用</Radio.Button>
297
+    //   </Radio.Group>,
298
+    //   value: userData.status != null ? userData.status.toString() : "1"
299
+    // },
300
+    // {
301
+    //   label: '权重',
302
+    //   name: 'weight',
303
+    //   type: FieldTypes.Number,
304
+    //   render: <Input type="number" style={{ width: 150}} />,
305
+    //   value: userData.weight,
306
+    //   help: '数字越大越靠前',
307
+    // },
308
+  ]
309
+
310
+
311
+  return <Card>
312
+            <XForm  onSubmit={handleSubmit} fields={fields} onCancel={() => router.go(-1)}></XForm>
313
+
314
+        </Card>
315
+}
316
+
317
+export default StaffEdit

+ 61
- 13
src/services/apis.js Parādīt failu

@@ -44,6 +44,42 @@ export default {
44 44
       logout: true,
45 45
       action: 'signout',
46 46
     },
47
+  },
48
+  //品牌开发商
49
+  brand:{
50
+    //查询
51
+    list:{
52
+      method:'GET',
53
+      url:`${prefix}/brand`,
54
+      action:'admin.brand.get'
55
+    },
56
+    //添加
57
+    addBrand:{
58
+      method:'POST',
59
+      url:`${prefix}/brand`,
60
+      action:'admin.brand.post'
61
+    },
62
+    //shanchu
63
+    deleBrand:{
64
+      method:'DELETE',
65
+      url:`${prefix}/brand/:id`,
66
+      action:'admin.brand.id.delete',
67
+    },
68
+    // 获取详情数据
69
+    getBrand:{
70
+      method:'GET',
71
+      url:`${prefix}/brand/:id`,
72
+      action:'admin.brand.id.get',
73
+    },
74
+    //修改
75
+    alterBrand:{
76
+      method:'PUT',
77
+      url:`${prefix}/brand/:id`,
78
+      action:'admin.brand.id.put'
79
+    }
80
+    
81
+    
82
+
47 83
   },
48 84
   building: {
49 85
     getList: {
@@ -208,15 +244,33 @@ export default {
208 244
       action: 'admin.taNewsType.get',
209 245
     }
210 246
   },
211
-  //预加 帮我找房
212
-  homeload: {
213
-    houseSchr:{
247
+  // 帮我找房
248
+  searchHouse: {
249
+    //查询
250
+    list:{
214 251
       method: 'GET',
215
-      url: `${prefix}/home/Recommend/searchHouse`,
216
-      action: 'admin.home.Recommend.searchHouse.get',
217
-      // action: 'admin.customer.recommend.recommender.get',
218
-
252
+      url: `${prefix}/searchHouse`,
253
+      action: 'admin.searchHouse.get',
254
+    },
255
+    //根据ID查询
256
+    IdHouse:{
257
+      method:'GET',
258
+      url:`${prefix}/searchHouse/:id`,
259
+      action:'admin.searchHouse.id.get',  
260
+    },
261
+    //修改
262
+    alterHouse:{
263
+      method:'PUT',
264
+      url:`${prefix}/searchHouse/:id`,
265
+      action:'admin.searchHouse.id.put',
266
+    },
267
+    //回访
268
+    savingHouse:{
269
+      method:'POST',
270
+      url:`${prefix}/searchHouse`,
271
+      action:''
219 272
     }
273
+
220 274
   },
221 275
 
222 276
   customer: {
@@ -311,12 +365,6 @@ export default {
311 365
       action: 'admin.customer.recommend.recommender.export.get',
312 366
     },
313 367
 
314
-    // //recommender
315
-    // homeRecommendrecommenderExport: { // 导出数据(home   推荐客户 预加)
316
-    //   method: 'GET',
317
-    //   url: `${prefix}/home/recommend/recommender/export`,
318
-    //   action: 'admin.home.recommend.recommender.export.get',
319
-    // },
320 368
     customerRecommendReportExport: { // 导出数据(报备客户)
321 369
       method: 'GET',
322 370
       url: `${prefix}/customer/recommend/report/export`,

+ 5
- 1
src/utils/request.js Parādīt failu

@@ -68,6 +68,7 @@ request.interceptors.request.use((url, options) => {
68 68
 });
69 69
 
70 70
 request.interceptors.response.use(async (response, options) => {
71
+  
71 72
   if (response && response.status) {
72 73
     if (response.status != 200) {
73 74
       const errorText = codeMessage[response.status] || response.statusText;
@@ -81,6 +82,7 @@ request.interceptors.response.use(async (response, options) => {
81 82
     } else {
82 83
       // console.log('response.headers: ', response.headers)
83 84
       // console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
85
+      console.log(response,'response')
84 86
       if (response.headers.get('Content-Type') === 'application/octet-stream;charset=utf-8') {
85 87
         return await response.clone().blob();
86 88
       }
@@ -89,8 +91,9 @@ request.interceptors.response.use(async (response, options) => {
89 91
       if (response.url.indexOf('gaode_amap') !== -1) {
90 92
         return await response.clone().json();
91 93
       }
92
-
94
+      console.log(response,'response')
93 95
       const { code, data, message } = await response.clone().json();
96
+     
94 97
       if (code != 1000) {
95 98
         if (code === 1001) {
96 99
           // notification.error({
@@ -99,6 +102,7 @@ request.interceptors.response.use(async (response, options) => {
99 102
           // });
100 103
           // throw new Error('请登录系统');
101 104
         } else {
105
+          console.log(code, data, message ,'code, data, message ')
102 106
           notification.error({
103 107
             message: message || '请求错误',
104 108
             // description: message,