zlisen vor 3 Jahren
Ursprung
Commit
fe6e19e75c

+ 16
- 2
config/routes.js Datei anzeigen

@@ -232,9 +232,23 @@ export default [
232 232
             component: '../layouts/BlankLayout',
233 233
             routes: [
234 234
               {
235
-                path: '/activity/ActivityList',
235
+                path: '/activity/SignupActivity',
236 236
                 name: '报名活动',
237
-                component: './activity/ActivityList',
237
+                component: './activity/SignupActivity',
238
+              },
239
+              {
240
+                path: '/activity/SignupActivity/detail',
241
+                name: '活动详情',
242
+                hideInMenu: true,
243
+                component: './activity/SignupActivity/detail',
244
+              },
245
+             
246
+
247
+              // /activity/SignupActivity/detail
248
+              {
249
+                path: '/activity/Activity',
250
+                name: '报名活动(old)',
251
+                component: './activity/Activity',
238 252
               },
239 253
               {
240 254
                 path: '/activity/editActivity',

+ 3
- 2
src/components/QueryTable/index.jsx Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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
 });

+ 404
- 0
src/pages/activity/Activity/index.jsx Datei anzeigen

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

+ 426
- 0
src/pages/activity/SignupActivity/detail.jsx Datei anzeigen

@@ -0,0 +1,426 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Card, Radio, DatePicker, message, Upload } from 'antd';
3
+
4
+import apis from '@/services/apis';
5
+import moment from 'moment';
6
+import router from 'umi/router';
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.png';
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';
15
+import AuthButton from '@/components/AuthButton';
16
+import Prompt from 'umi/prompt';
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.go('-1')
28
+}
29
+
30
+const getSignList = dynamicId => {
31
+  router.push({
32
+    pathname: '/activity/SignList',
33
+    query: {
34
+      dynamicId,
35
+    },
36
+  });
37
+}
38
+
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
+}
54
+
55
+const BasicForm = props => {
56
+  const detailData = props.detailData || {}
57
+
58
+  const radioOnChange = e => {
59
+    // setIsEnlist(e.target.value)
60
+  }
61
+
62
+  const { dynamicId } = props
63
+  const handleSubmit = e => {
64
+    e.preventDefault();
65
+    props.form.validateFields((err, values) => {
66
+      if (!err) {
67
+        console.log('Received values of form: ', values);
68
+        const { activityTime, signupTime } = values
69
+        const [startDate, endDate] = activityTime
70
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
71
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
72
+        if (signupTime) {
73
+          const [enlistStart, enlistEnd] = signupTime
74
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
75
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
76
+        }
77
+        console.log('submit data --->', values)
78
+        if (dynamicId) {
79
+          values.dynamicId = dynamicId
80
+          request({ ...apis.activity.update, data: values }).then(data => {
81
+            message.info('保存成功')
82
+            // router.go(-1)
83
+          }).catch((err) => {
84
+            message.info(err.msg || err.message)
85
+          })
86
+        } else {
87
+          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
88
+            message.info('保存成功')
89
+            router.push({
90
+              pathname: '/activity/editActivity',
91
+              query: {
92
+                dynamicId: data.dynamicId,
93
+              },
94
+            });
95
+            // router.go(-1)
96
+          }).catch((err) => {
97
+            message.info(err.msg || err.message)
98
+          })
99
+        }
100
+      }
101
+    });
102
+  }
103
+
104
+  const { getFieldDecorator } = props.form;
105
+  return (
106
+    <>
107
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
108
+        <Form.Item label="所属项目">
109
+          {getFieldDecorator('buildingId', {
110
+            initialValue: detailData.buildingId,
111
+            rules: [
112
+              {
113
+                required: true,
114
+                message: '请选择所属项目',
115
+              },
116
+            ],
117
+          })(<BuildSelect disabled />)}
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>
128
+        <Form.Item label="活动标题">
129
+          <span>{detailData.title}</span>
130
+        </Form.Item>
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>
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>
142
+        </Form.Item>
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>
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>
157
+        </Form.Item>
158
+        <Form.Item label="权重">
159
+          <span>{detailData.heavy}</span>
160
+        </Form.Item>
161
+      </Form>
162
+    </>
163
+  )
164
+}
165
+
166
+const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
167
+
168
+const Poster = (props) => {
169
+  const { dynamicId } = props
170
+  const [inputValue, changeInput] = useState('')
171
+  const [textAreaValue, changeTextArea] = useState('')
172
+  const [imgValue, changeImg] = useState('')
173
+  const [posterId, setPosterId] = useState('')
174
+
175
+  if (dynamicId) {
176
+    console.log(dynamicId, 'dynamicId')
177
+    useEffect(() => {
178
+      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
179
+        console.log(data, "2222")
180
+        if (data.length > 0) {
181
+          setPosterId(data[0].posterId)
182
+          changeImg(data[0].posterImg)
183
+          changeTextArea(data[0].posterDescription)
184
+          changeInput(data[0].posterTitle)
185
+        }
186
+      }).catch((err) => {
187
+        message.info(err.msg || err.message)
188
+      })
189
+      getMiniappName()
190
+    }, [])
191
+  } else {
192
+    getMiniappName()
193
+  }
194
+  // 获取小程序名称
195
+  const [miniappName, setMiniappName] = useState('')
196
+  function getMiniappName() {
197
+    request({ ...apis.building.getMiniappName }).then(res => {
198
+      console.log(res, "0000000000000")
199
+      setMiniappName(res)
200
+    })
201
+  }
202
+
203
+  const submitPoster = () => {
204
+    if (dynamicId) {
205
+      if (posterId) {
206
+        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
207
+          message.info("保存成功")
208
+        }).catch((err) => {
209
+          message.info(err.msg || err.message)
210
+        })
211
+      } else {
212
+        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
213
+          setPosterId(data.posterId)
214
+          message.info("保存成功")
215
+        }).catch((err) => {
216
+          message.info(err.msg || err.message)
217
+        })
218
+      }
219
+    } else {
220
+      message.warn("请先保存基本信息数据")
221
+    }
222
+  }
223
+
224
+  return <div>
225
+    <div style={{ display: 'flex' }}>
226
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
227
+        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
228
+          <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
229
+          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
230
+            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
231
+            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
232
+            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
233
+            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
234
+          </div>
235
+          <p style={{
236
+            margin: '10px 20px',
237
+            fontSize: '20px',
238
+            color: '#222',
239
+            fontWeight: '600',
240
+            display: '-webkit-box',
241
+            lineClamp: '3',
242
+            height: '60px',
243
+            WebkitLineClamp: '2',
244
+            WebkitBoxOrient: 'vertical',
245
+            overflow: 'hidden',
246
+            textOverflow: 'ellipsis'
247
+          }}>{inputValue ? inputValue : '海报标题'}</p>
248
+
249
+          <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
250
+          <p style={{
251
+            margin: '16px 20px 28px 20px',
252
+            fontSize: '17px',
253
+            color: '#999',
254
+            display: '-webkit-box',
255
+            lineClamp: '3',
256
+            height: '72px',
257
+            WebkitLineClamp: '3',
258
+            WebkitBoxOrient: 'vertical',
259
+            overflow: 'hidden',
260
+            textOverflow: 'ellipsis'
261
+          }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
262
+          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
263
+            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
264
+            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入<span style={{ margin: '0 5px', fontSize: '18px', color: '#333', fontWeight: '600' }}>{miniappName || '置业V顾问'}</span>报名活动</p>
265
+            <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
266
+          </div>
267
+        </div>
268
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
269
+      </div>
270
+
271
+      {/* <div >
272
+        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
273
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动海报图</p>
274
+          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
275
+        </div>
276
+        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报</p>
277
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
278
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
279
+          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
280
+        </div>
281
+        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
282
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
283
+          <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
284
+        </div>
285
+
286
+      </div> */}
287
+    </div>
288
+    {/* <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
289
+    <Button onClick={() => cancelPage()}>
290
+      取消
291
+    </Button> */}
292
+  </div>
293
+
294
+}
295
+
296
+
297
+
298
+const Share = (props) => {
299
+  const { dynamicId } = props
300
+
301
+  const [inputValue, changeInput] = useState('')
302
+  const [imgValue, changeImg] = useState('')
303
+  const [shareContentId, setShareContentId] = useState('')
304
+
305
+
306
+  useEffect(() => {
307
+    if (dynamicId) {
308
+      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' }, }).then((data) => {
309
+        if (data.length > 0) {
310
+          setShareContentId(data[0].shareContentId)
311
+          changeImg(data[0].shareContentImg)
312
+          changeInput(data[0].shareContentTitle)
313
+        }
314
+      }).catch((err) => {
315
+        message.info(err.msg || err.message)
316
+      })
317
+    }
318
+  }, [])
319
+
320
+
321
+  const submitShare = () => {
322
+    if (dynamicId) {
323
+      if (shareContentId) {
324
+        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
325
+          message.info("保存成功")
326
+        }).catch((err) => {
327
+          message.info(err.msg || err.message)
328
+        })
329
+      } else {
330
+        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
331
+          setShareContentId(data.shareContentId)
332
+          message.info("保存成功")
333
+        }).catch(err => {
334
+          message.info(err.msg || err.message)
335
+        })
336
+      }
337
+    } else {
338
+      message.warn("请先保存基本信息数据")
339
+    }
340
+  }
341
+
342
+  return <div style={{ padding: '20px' }}>
343
+    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
344
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
345
+      <div>
346
+        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />橙蕉互动</p>
347
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
348
+        <img style={{ width: '200px', height: '160px' }} src={imgValue ? imgValue : poster2} alt="" />
349
+      </div>
350
+    </div>
351
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
352
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
353
+      {inputValue === '' ? '无' : <span>{inputValue}</span>}
354
+    </div>
355
+    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
356
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
357
+      {imgValue === '' ? '无' : <img src={imgValue} height="120px" height="150px" />}
358
+    </div>
359
+    {/* <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
360
+    <Button onClick={() => cancelPage()}>
361
+      取消
362
+    </Button> */}
363
+  </div>
364
+}
365
+
366
+/**
367
+ *
368
+ *
369
+ * @param {*} props
370
+ * @returns
371
+ */
372
+const Edit = props => {
373
+  const [tab, changeTab] = useState('basic')
374
+  const { dynamicId } = props.location.query
375
+  const [detailData, setDetailData] = useState(false)
376
+
377
+  const getDynamicData = dynamicId => {
378
+    request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
379
+      console.log(data)
380
+      data.activityTime = [moment(data.startDate), moment(data.endDate)]
381
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
382
+
383
+      setDetailData(data)
384
+    })
385
+  }
386
+
387
+
388
+  useEffect(() => {
389
+    if (dynamicId) {
390
+      getDynamicData(dynamicId);
391
+    }
392
+  }, [])
393
+
394
+
395
+  
396
+
397
+  return (
398
+    <Card>
399
+      <div>
400
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
401
+          <Radio.Button value="basic">基本信息</Radio.Button>
402
+          <Radio.Button value="poster">海报图片</Radio.Button>
403
+          <Radio.Button value="share">分享设置</Radio.Button>
404
+        </Radio.Group>
405
+      </div>
406
+      <div>
407
+        {tab === 'basic' && <Basic dynamicId={dynamicId} detailData={detailData} />}
408
+        {tab === 'poster' && <Poster  dynamicId={dynamicId} />}
409
+        {tab === 'share' && <Share  dynamicId={dynamicId} />}
410
+      </div>
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
+          取消
420
+          </Button>
421
+      </div>
422
+    </Card>
423
+  );
424
+}
425
+
426
+export default Edit

+ 198
- 0
src/pages/activity/SignupActivity/index.jsx Datei anzeigen

@@ -0,0 +1,198 @@
1
+import React, { useState, useEffect } 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 Prompt from 'umi/prompt';
19
+import withActions from '@/components/ActionList';
20
+import EditIcon from '@/components/EditIcon';
21
+import Navigate from '@/components/Navigate';
22
+import SelectCity from '@/components/SelectButton/CitySelect';
23
+import BuildSelect from '@/components/SelectButton/BuildSelect';
24
+import apis from '@/services/apis';
25
+import request from '@/utils/request';
26
+import QueryTable from '@/components/QueryTable';
27
+
28
+const SignupActivity = props => {
29
+  const searchFields = [
30
+    {
31
+      name: 'cityId',
32
+      label: '城市',
33
+      placeholder: '请选择城市',
34
+      render: () => <SelectCity style={{ width: 160 }} />,
35
+    },
36
+    {
37
+      name: 'buildingId',
38
+      label: '项目',
39
+      placeholder: '请选择项目',
40
+      render: () => <BuildSelect style={{ width: 160 }} />,
41
+    },
42
+
43
+    {
44
+      name: 'title',
45
+      label: '标题',
46
+      placeholder: '请输入标题',
47
+    },
48
+    {
49
+      name: 'time',
50
+      label: '时间',
51
+      placeholder: '请选择时间',
52
+      type: 'datepicker',
53
+    },
54
+  ];
55
+
56
+  const toSignupActivityDetail = dynamicId => () => {
57
+    router.push({
58
+      pathname: '/activity/SignupActivity/detail',
59
+      query: {
60
+        dynamicId,
61
+      },
62
+    });
63
+  };
64
+
65
+    // 跳转到编辑
66
+    const toActivityEdit = dynamicId => () => {
67
+        router.push({
68
+          pathname: '/activity/editActivity',
69
+          query: {
70
+            dynamicId,
71
+          },
72
+        });
73
+      }
74
+    
75
+
76
+  const columns = [
77
+    {
78
+      title: '活动标题',
79
+      dataIndex: 'title',
80
+      key: 'title',
81
+      align: 'center',
82
+      width: '20%',
83
+      render: (x, row) => (
84
+        <Navigate onClick={toSignupActivityDetail(row.dynamicId)}>
85
+          <Typography.Text ellipsis>{row.title}</Typography.Text>
86
+        </Navigate>
87
+      ),
88
+    },
89
+    {
90
+      title: '活动时间',
91
+      dataIndex: 'startDate',
92
+      key: 'startDate',
93
+      align: 'center',
94
+      width: '15%',
95
+      // width: '20%',
96
+      render: (x, row) => (
97
+        <>
98
+          <span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format(
99
+            'YYYY-MM-DD',
100
+          )}`}</span>
101
+        </>
102
+      ),
103
+    },
104
+    {
105
+      title: '已参与人数',
106
+      dataIndex: 'count',
107
+      key: 'count',
108
+      align: 'center',
109
+      //   render: (x, row) => <Navigate onClick={getJoinPeople(row.dynamicId)}>{row.count}</Navigate>,
110
+    },
111
+    // {
112
+    //   title: '阅读量',
113
+    //   dataIndex: 'pvNum',
114
+    //   key: 'pvNum',
115
+    //   align: 'center',
116
+    //   // width: '10%',
117
+    // },
118
+    // {
119
+    //   title: '转发量',
120
+    //   dataIndex: 'shareNum',
121
+    //   key: 'shareNum',
122
+    //   align: 'center',
123
+    //   // width: '10%',
124
+    // },
125
+    // {
126
+    //   title: '收藏数',
127
+    //   dataIndex: 'saveNum',
128
+    //   key: 'saveNum',
129
+    //   align: 'center',
130
+    //   // width: '10%',
131
+    // },
132
+    {
133
+      title: '报名状态',
134
+      dataIndex: 'activityStatus',
135
+      key: 'activityStatus',
136
+      align: 'center',
137
+      render: activityStatus =>
138
+        activityStatus == 0 ? '进行中' : activityStatus == 1 ? '未开始' : '已结束',
139
+    },
140
+    {
141
+      title: '权重',
142
+      dataIndex: 'heavy',
143
+      key: 'heavy',
144
+      align: 'center',
145
+    },
146
+    {
147
+      title: '操作',
148
+      dataIndex: 'handle',
149
+      key: 'handle',
150
+      align: 'center',
151
+        render: withActions((x, row) => [
152
+        //   <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
153
+        //     <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '取消发布' : '发布'} onClick={sendOrPublicDynamic.bind(this, row)} />
154
+        //   </AuthButton>,
155
+
156
+        // //   <EditIcon type="look" text="查看详情" onClick={toSignupActivityDetail(row.dynamicId)} />,
157
+
158
+        //   row.activityStatus === 0 ?
159
+        //     <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
160
+        //       <EditIcon type="end" text="结束活动" onClick={finishDynamic.bind(this, row)} />
161
+        //     </AuthButton> : null,
162
+
163
+        //   <AuthButton name="admin.buildingDynamic.tag" noRight={null}>
164
+        //     <EditIcon type={row.weight === 1 ? 'cancel' : 'add'} text={row.weight === 1 ? '取消标签' : '添加标签'} onClick={topDynamic(row)} />
165
+        //   </AuthButton>,
166
+
167
+        //   <EditIcon type={row.home === 1 ? 'cancel' : 'top'} text={row.home === 1 ? '取消推首页' : '推荐首页'} onClick={homeDynamic(row)} />,
168
+
169
+        //   <AuthButton name="admin.buildingDynamic.dataRecord" noRight={null}>
170
+        //     <EditIcon type="record" text="数据记录" onClick={toDataReacord(row.dynamicId)} />
171
+        //   </AuthButton>,
172
+
173
+          (row.activityStatus === 0 || row.activityStatus === 1) ?
174
+            <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
175
+              <EditIcon type="edit" text="编辑" onClick={toActivityEdit(row.dynamicId, row.count)} />
176
+            </AuthButton> : null,
177
+        ]),
178
+    },
179
+  ];
180
+  return (
181
+    <QueryTable
182
+      // ref={ref}
183
+      rowKey="dynamicId"
184
+      api={apis.activity.list}
185
+      searchFields={searchFields}
186
+      columns={columns}
187
+      postData={data => {
188
+        console.log(data, 'data');
189
+        data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
190
+        return data;
191
+      }}
192
+      // actionRender={actionRender}
193
+      // onPageChange={(pg) => setPage(pg)}
194
+    />
195
+  );
196
+};
197
+
198
+export default SignupActivity;