dingxin 5 anos atrás
pai
commit
eb6e373dc5

+ 19
- 0
config/routes.js Ver arquivo

@@ -280,6 +280,25 @@ export default [
280 280
                 hideInMenu: true,
281 281
                 component: './activity/helpActivity/edithelpActivity',
282 282
               },
283
+              
284
+              {
285
+                path: '/activity/groupActivity/list',
286
+                name: '拼团活动',
287
+                component: './activity/groupActivity/list',
288
+              },
289
+              {
290
+                path: '/activity/groupActivity/helpRecord',
291
+                name: '拼团记录',
292
+                hideInMenu: true,
293
+                component: './activity/groupActivity/helpRecord',
294
+              },
295
+              {
296
+                path: '/activity/groupActivity/editgroupActivity',
297
+                name: '新增',
298
+                hideInMenu: true,
299
+                component: './activity/groupActivity/editgroupActivity',
300
+              },
301
+
283 302
             ],
284 303
           },
285 304
           {

+ 1
- 0
src/components/Wangedit/Wangedit.jsx Ver arquivo

@@ -33,6 +33,7 @@ class Wangedit extends React.Component {
33 33
       }
34 34
     }
35 35
     this.editor.customConfig.zIndex = 100
36
+    this.editor.customConfig.uploadImgShowBase64 = true   
36 37
     this.editor.create()
37 38
     this.editor.customConfig.uploadImgShowBase64 = true
38 39
     this.editor.txt.html(this.props.value)

+ 195
- 152
src/pages/activity/editActivity.jsx Ver arquivo

@@ -20,29 +20,193 @@ import xiaochengxu from '../../assets/xiaochengxu.png'
20 20
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21 21
 const { TextArea } = Input;
22 22
 
23
+const formItemLayout = {
24
+  labelCol: { span: 6 },
25
+  wrapperCol: { span: 14 },
26
+};
27
+
28
+const BasicForm = props => {
29
+  const [isEnlist, setIsEnlist] = useState(1)
30
+
31
+  const radioOnChange = e => {
32
+    // console.log(e.target.value)
33
+    setIsEnlist(e.target.value)
34
+  }
35
+
36
+  const { dynamicId } = props
37
+
38
+  // 查询详情
39
+  const getDynamicData = dynamicId => {
40
+    request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
41
+      console.log(data)
42
+      data.activityTime = [moment(data.startDate), moment(data.endDate)]
43
+      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
44
+
45
+      setIsEnlist(data.isEnlist)
46
+      props.form.setFieldsValue(data)
47
+    })
48
+  }
49
+
50
+    // eslint-disable-next-line react-hooks/rules-of-hooks
51
+    useEffect(() => {
52
+      props.form.setFieldsValue({ isEnlist })
53
+      if (dynamicId) {
54
+        getDynamicData(dynamicId);
55
+      }
56
+    }, [])
57
+ 
58
+  const handleSubmit = e => {
59
+    e.preventDefault();
60
+    props.form.validateFields((err, values) => {
61
+      if (!err) {
62
+        console.log('Received values of form: ', values);
63
+        const { activityTime, signupTime } = values
64
+        const [startDate, endDate] = activityTime
65
+        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
66
+        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
67
+        if (signupTime) {
68
+          const [enlistStart, enlistEnd] = signupTime
69
+          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
70
+          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
71
+        }
72
+        
73
+        console.log('submit data --->', values)
74
+        if (dynamicId) {
75
+          values.dynamicId = dynamicId
76
+          request({ ...apis.activity.update, data: values }).then(data => {
77
+            message.info('保存成功')
78
+            router.go(-1)
79
+          }).catch((err) => {
80
+            message.info(err.msg || err.message)
81
+          })
82
+        } else {
83
+          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
84
+            message.info('保存成功')
85
+            router.go(-1)
86
+          }).catch((err) => {
87
+            message.info(err.msg || err.message)
88
+          })
89
+        }
90
+      }
91
+    });
92
+  }
93
+
94
+  const { getFieldDecorator } = props.form;
95
+  return (
96
+    <>
97
+      <Form {...formItemLayout} onSubmit={handleSubmit}>
98
+        <Form.Item label="所属项目">
99
+        {getFieldDecorator('buildingId', {
100
+          rules: [
101
+            {
102
+              required: true,
103
+              message: '请选择所属项目',
104
+            },
105
+          ],
106
+        })(<BuildSelect />)}
107
+        </Form.Item>
108
+        <Form.Item label="主图">
109
+          {getFieldDecorator('imgUrl')(<ImageUploader />)}
110
+          <span>建议图片尺寸:750px*560px</span>
111
+        </Form.Item>
112
+        <Form.Item label="活动标题">
113
+        {getFieldDecorator('title', {
114
+          rules: [
115
+            {
116
+              required: true,
117
+              message: '请输入活动标题',
118
+            },
119
+          ],
120
+        })(<Input />)}
121
+        </Form.Item>
122
+        <Form.Item label="活动时间">
123
+        {getFieldDecorator('activityTime', {
124
+          rules: [
125
+            {
126
+              required: true,
127
+              message: '请选择活动时间',
128
+            },
129
+          ],
130
+        })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
131
+        </Form.Item>
132
+        <Form.Item label="活动地点">
133
+        {getFieldDecorator('address', {
134
+          rules: [
135
+            {
136
+              required: true,
137
+              message: '请输入活动地点',
138
+            },
139
+          ],
140
+        })(<Input />)}
141
+        </Form.Item>
142
+        <Form.Item label="活动人数">
143
+        {getFieldDecorator('personNum', {
144
+          rules: [
145
+            {
146
+              required: true,
147
+              message: '请输入活动人数',
148
+            },
149
+          ],
150
+        })(<Input type="number" />)}
151
+        </Form.Item>
152
+        <Form.Item label="最大报名人数">
153
+        {getFieldDecorator('maxEnlistByPerson', {
154
+          rules: [
155
+            {
156
+              required: true,
157
+              message: '请输入最大报名人数',
158
+            },
159
+          ],
160
+        })(<Input type="number" />)}
161
+        </Form.Item>
162
+        <Form.Item label="活动详情">
163
+        {getFieldDecorator('desc')(<Wangedit />)}
164
+        </Form.Item>
165
+        <Form.Item label="是否需要报名">
166
+        {getFieldDecorator('isEnlist')(
167
+          <Radio.Group onChange={(e) => radioOnChange(e)}>
168
+            <Radio value={1}>是</Radio>
169
+            <Radio value={0}>否</Radio>
170
+          </Radio.Group>,
171
+        )}
172
+        </Form.Item>
173
+        {
174
+          isEnlist === 1 && (<Form.Item label="报名时间">
175
+          {getFieldDecorator('signupTime', {
176
+            rules: [
177
+              {
178
+                required: true,
179
+                message: '请选择报名时间',
180
+              },
181
+            ],
182
+          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
183
+          </Form.Item>)
184
+        }
185
+        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
186
+          <Button type="primary" htmlType="submit">
187
+            确认
188
+          </Button>
189
+          &nbsp;&nbsp;&nbsp;&nbsp;
190
+          <Button onClick={() => router.go(-1)}>
191
+            取消
192
+          </Button>
193
+        </Form.Item>
194
+      </Form>
195
+    </>
196
+  )
197
+}
198
+
199
+const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
200
+
23 201
 /**
24 202
  *
25 203
  *
26 204
  * @param {*} props
27 205
  * @returns
28 206
  */
29
-const Edit = (props) => {
207
+const Edit = props => {
30 208
   const [tab, changeTab] = useState('basic')
31
-  const dynamicId = props.location.query.dynamicId
32
-  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
33
-  if (dynamicId) {
34
-    useEffect(() => {
35
-      getDynamicData(dynamicId);
36
-    }, [])
37
-
38
-    // 查询列表
39
-    const getDynamicData = (dynamicId) => {
40
-      request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
41
-        console.log(data)
42
-        setDynamicData(data)
43
-      })
44
-    }
45
-  }
209
+  const { dynamicId } = props.location.query
46 210
 
47 211
   const cancelPage = () => {
48 212
     router.push({
@@ -50,134 +214,6 @@ const Edit = (props) => {
50 214
     });
51 215
   }
52 216
 
53
-  const radioOnChange = e => {
54
-    console.log(e.target.value)
55
-    setDynamicData({ ...dynamicData, isEnlist: e.target.value })
56
-  }
57
-
58
-  const Basic = (props) => {
59
-    const fields = [
60
-      {
61
-        label: '所属项目',
62
-        name: 'buildingId',
63
-        render: <BuildSelect />,
64
-        value: dynamicData.buildingId,
65
-        rules: [
66
-          { required: true, message: '请选择所属项目' },
67
-        ]
68
-      },
69
-      {
70
-        label: '主图',
71
-        name: 'imgUrl',
72
-        type: FieldTypes.ImageUploader,
73
-        value: dynamicData.imgUrl,
74
-        help: '建议图片尺寸:750px*560px',
75
-      },
76
-      {
77
-        label: '活动标题',
78
-        name: 'title',
79
-        type: FieldTypes.Text,
80
-        value: dynamicData.title,
81
-        rules: [
82
-          { required: true, message: '请输入活动标题' },
83
-        ]
84
-      },
85
-      {
86
-        label: '活动时间',
87
-        name: 'activityTime',
88
-        type: FieldTypes.RangePicker,
89
-        value: dynamicData.startDate != null ? [moment(dynamicData.startDate, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endDate, 'YYYY-MM-DD HH:mm')] : null,
90
-        props: {showTime:{ format: 'HH:mm' }},
91
-        rules: [
92
-          { required: true, message: '请选择活动时间' },
93
-        ]
94
-      },
95
-      {
96
-        label: '活动地点',
97
-        name: 'address',
98
-        type: FieldTypes.Text,
99
-        value: dynamicData.address,
100
-        rules: [
101
-          { required: true, message: '请输入活动地点' },
102
-        ]
103
-      },
104
-      {
105
-        label: '活动人数',
106
-        name: 'personNum',
107
-        type: FieldTypes.Text,
108
-        value: dynamicData.personNum,
109
-        rules: [
110
-          { required: true, message: '请输入活动人数' },
111
-        ]
112
-      },
113
-      {
114
-        label: '最大报名人数',
115
-        name: 'maxEnlistByPerson',
116
-        type: FieldTypes.Text,
117
-        value: dynamicData.maxEnlistByPerson,
118
-        rules: [
119
-          { required: true, message: '请输入最大报名人数' },
120
-        ]
121
-      },
122
-      {
123
-        label: '活动详情',
124
-        name: 'desc',
125
-        render: <Wangedit />,
126
-        value: dynamicData.desc,
127
-      },
128
-      {
129
-        label: '是否需要报名',
130
-        name: 'isEnlist',
131
-        render: <Radio.Group name="radiogroup" onChange={(e) => radioOnChange(e)}>
132
-          <Radio value={1}>是</Radio>
133
-          <Radio value={0}>否</Radio>
134
-        </Radio.Group>,
135
-        value: dynamicData.isEnlist != null ? dynamicData.isEnlist - 0 : 1,
136
-      },
137
-      {
138
-        label: '报名时间',
139
-        name: 'signupTime',
140
-        // type: FieldTypes.RangePicker,
141
-        render: dynamicData.isEnlist === 1 ? (<RangePicker format={ 'YYYY/MM/DD HH:mm' } style={{ width: '100%' }} />) : '',
142
-        value: dynamicData.enlistStart != null ? [moment(dynamicData.enlistStart, 'YYYY-MM-DD HH:mm'), moment(dynamicData.enlistEnd, 'YYYY-MM-DD HH:mm')] : null,
143
-        // props: {showTime:{ format: 'HH:mm' }},
144
-        rules: [
145
-          { required: true, message: '请选择报名时间' },
146
-        ]
147
-      },
148
-    ]
149
-
150
-    const handleSubmit = val => {
151
-      let { isEnlist, activityTime, signupTime, ...submitValue } = val
152
-      const [startDate, endDate] = activityTime
153
-      submitValue.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
154
-      submitValue.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
155
-      const [enlistStart, enlistEnd] = signupTime
156
-      submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
157
-      submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
158
-      console.log('submit data --->', submitValue)
159
-
160
-      if (dynamicId) {
161
-        submitValue.dynamicId = dynamicId
162
-        request({ ...apis.activity.update, data: submitValue }).then((data) => {
163
-          message.info("保存成功")
164
-          cancelPage()
165
-        }).catch((err) => {
166
-          message.info(err.msg || err.message)
167
-        })
168
-      } else {
169
-        request({ ...apis.activity.add, data: submitValue }).then((data) => {
170
-          message.info("保存成功")
171
-          cancelPage()
172
-        }).catch((err) => {
173
-          message.info(err.msg || err.message)
174
-        })
175
-      }
176
-    }
177
-
178
-    return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
179
-  }
180
-
181 217
   const Poster = (props) => {
182 218
     const [inputValue, changeInput] = useState('')
183 219
     const [textAreaValue, changeTextArea] = useState('')
@@ -245,8 +281,13 @@ const Edit = (props) => {
245 281
               <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
246 282
             </div>
247 283
             <p style={{
248
-              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
249
-              display: '-webkit-box', lineClamp: '3', height: '60px',
284
+              margin: '10px 20px',
285
+fontSize: '20px',
286
+color: '#222',
287
+fontWeight: '600',
288
+              display: '-webkit-box',
289
+lineClamp: '3',
290
+height: '60px',
250 291
               WebkitLineClamp: '2',
251 292
               WebkitBoxOrient: 'vertical',
252 293
               overflow: 'hidden',
@@ -255,8 +296,12 @@ const Edit = (props) => {
255 296
 
256 297
             <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
257 298
             <p style={{
258
-              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
259
-              display: '-webkit-box', lineClamp: '3', height: '72px',
299
+              margin: '16px 20px 28px 20px',
300
+fontSize: '17px',
301
+color: '#999',
302
+              display: '-webkit-box',
303
+lineClamp: '3',
304
+height: '72px',
260 305
               WebkitLineClamp: '3',
261 306
               WebkitBoxOrient: 'vertical',
262 307
               overflow: 'hidden',
@@ -327,7 +372,7 @@ const Edit = (props) => {
327 372
           request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
328 373
             setShareContentId(data.shareContentId)
329 374
             message.info("保存成功")
330
-          }).catch((err) => {
375
+          }).catch(err => {
331 376
             message.info(err.msg || err.message)
332 377
           })
333 378
         }
@@ -368,7 +413,7 @@ const Edit = (props) => {
368 413
         </Radio.Group>
369 414
       </div>
370 415
       <div>
371
-        {tab === 'basic' && <Basic />}
416
+        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
372 417
         {tab === 'poster' && <Poster />}
373 418
         {tab === 'share' && <Share />}
374 419
       </div>
@@ -376,6 +421,4 @@ const Edit = (props) => {
376 421
   );
377 422
 }
378 423
 
379
-
380
-
381 424
 export default Edit

+ 0
- 0
src/pages/activity/groupActivity/editGroupActivity.jsx Ver arquivo


+ 0
- 0
src/pages/activity/groupActivity/helpRecord.jsx Ver arquivo


+ 278
- 0
src/pages/activity/groupActivity/list.jsx Ver arquivo

@@ -0,0 +1,278 @@
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';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
+import apis from '../../../services/apis';
10
+import request from '../../../utils/request';
11
+import AuthButton from '@/components/AuthButton';
12
+
13
+const { Option } = Select;
14
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15
+
16
+const header = props => {
17
+  const [ data, setData ] = useState({})
18
+//   const [page, changePage] = useState({})
19
+
20
+  useEffect(() => {
21
+    getList({ pageNum: 1, pageSize: 10 });
22
+  },[])
23
+
24
+  // 查询列表
25
+  const getList = (params) => {
26
+      console.log(params);
27
+    request({ ...apis.groupActivity.list, params: { ...params } }).then((data) => {
28
+        console.log(data)
29
+        setData(data)
30
+    })
31
+  }
32
+
33
+  
34
+// 跳转到助力新增
35
+const toEditActivity = (recordId) => () => {
36
+    router.push({
37
+      pathname: '/activity/groupActivity/editGroupActivity',
38
+      query: {
39
+        recordId
40
+      },
41
+    });
42
+  }
43
+  
44
+  /**
45
+   *
46
+   *
47
+   * @param {*} props
48
+   * @returns
49
+   */
50
+  
51
+  const columns = [
52
+    {
53
+      title: '活动标题',
54
+      dataIndex: 'activityName',
55
+      key: 'activityName',
56
+      align: 'center',
57
+    },
58
+    {
59
+      title: '活动时间',
60
+      dataIndex: 'startTime',
61
+      key: 'startTime',
62
+      align: 'center',
63
+      render: (x, row) => <><span>{`${moment(row.startTime).format('YYYY-MM-DD')} —— ${moment(row.endTime).format('YYYY-MM-DD')}`}</span></>
64
+    },
65
+    {
66
+        title: '所需积分',
67
+        dataIndex: 'integral',
68
+        key: 'integral',
69
+        align: 'center',
70
+      },
71
+    {
72
+      title: '已参与人数',
73
+      dataIndex: 'joinPeople',
74
+      key: 'joinPeople',
75
+      align: 'center',
76
+    },
77
+    {
78
+      title: '成团数',
79
+      dataIndex: 'groupBuyPeople',
80
+      key: 'groupBuyPeople',
81
+      align: 'center',
82
+    },  
83
+    {
84
+      title: '状态',
85
+      dataIndex: 'status',
86
+      key: 'status',
87
+      align: 'center',
88
+      render: (text, records) => {
89
+        if (records.status === 0) { return '进行中' }
90
+        if (records.status === 1) { return '未开始' }
91
+        if (records.status === 2) { return '已结束' }
92
+      },
93
+    },
94
+    {
95
+      title: '操作',
96
+      dataIndex: 'handle',
97
+      key: 'handle',
98
+      align: 'center',
99
+      render: (x, row) => (
100
+        <>
101
+          {row.status === 0 &&
102
+          <AuthButton name="admin.SignList.get" noRight={null}>
103
+        
104
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.recordId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
105
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
106
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消首页推荐' : '推荐至首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
107
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
108
+          </AuthButton> }
109
+
110
+          {row.status === 1 &&
111
+           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
112
+                      <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditActivity(row.recordId)}>编辑<Icon type="form" className={styles.edit} /></span>
113
+                      <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
114
+                      <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消首页推荐' : '推荐至首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
115
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
116
+          </AuthButton>
117
+          }
118
+
119
+          {row.status === 2 &&
120
+        <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
121
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.recordId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
122
+           <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
123
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{ row.sort === true ? '取消推荐首页' : '推荐首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
124
+        </AuthButton>
125
+          }
126
+        </>
127
+      ),
128
+    },
129
+  ];
130
+  const getSignList = recordId => {
131
+      router.push({
132
+          pathname: '/activity/groupActivity/helpRecord',
133
+          query: {
134
+            recordId,
135
+          },
136
+        });
137
+  }
138
+  
139
+  const finishDynamic = (row) => {
140
+      Modal.confirm({
141
+          title: '结束以后将无法编辑, 是否继续?',
142
+          okText: '确定',
143
+          cancelText: '取消',
144
+          onOk() {
145
+              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
146
+                  console.log(data)
147
+                  message.info('操作成功!')
148
+                  getList({ pageNum: 1, pageSize: 10 })
149
+              }).catch((err) => {
150
+                  console.log(err)
151
+                  message.info(err.msg || err.message)
152
+              })
153
+          },
154
+        });
155
+  }
156
+  
157
+  //结束活动
158
+  const endGroupActivity = (row) => () => {
159
+      request({ ...apis.groupActivity.finish, data: { groupActicityId: row.groupActicityId} }).then((data) => {
160
+          console.log(data)
161
+          message.info('操作成功!')
162
+          getList({ pageNum: 1, pageSize: 10 })
163
+      }).catch((err) => {
164
+          console.log(err)
165
+          message.info(err.msg || err.message)
166
+      })
167
+  }
168
+
169
+  //置顶
170
+  const topGroupActivity = (row, code) => () => {
171
+    request({ ...apis.groupActivity.top, data: { groupActicityId: row.groupActicityId, weight: row.weight } }).then((data) => {
172
+        console.log(data)
173
+        message.info('操作成功!')
174
+        getList({ pageNum: 1, pageSize: 10 })
175
+    }).catch((err) => {
176
+        console.log(err)
177
+        message.info(err.msg || err.message)
178
+    })
179
+  }
180
+
181
+  //首页推荐
182
+  const recommendGroupActivity = (row, code) => () => {
183
+    request({ ...apis.groupActivity.top, data: { groupActicityId: row.groupActicityId, sort: row.sort } }).then((data) => {
184
+        console.log(data)
185
+        message.info('操作成功!')
186
+        getList({ pageNum: 1, pageSize: 10 })
187
+    }).catch((err) => {
188
+        console.log(err)
189
+        message.info(err.msg || err.message)
190
+    })
191
+  }
192
+    
193
+  //发布活动
194
+  const sendDynamic = (row) => {
195
+      request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
196
+          message.info('操作成功!')
197
+          getList({ pageNum: 1, pageSize: 10 });
198
+      }).catch(err => {
199
+          console.log(err)
200
+          message.info(err.msg || err.message)
201
+      })
202
+  }
203
+  
204
+  const changePageNum = pageNumber => {
205
+      getList({ pageNum: pageNumber, pageSize: 10 })
206
+  }
207
+
208
+  // 提交事件
209
+const handleSubmit = (e, props) => {
210
+    e.preventDefault();
211
+    props.form.validateFields((err, values) => {
212
+      if (!err) {
213
+        console.log('提交数据: ', values)
214
+        getList({ pageNum: 1, pageSize: 10, ...values })
215
+      }
216
+    });
217
+  }
218
+
219
+   //重置搜索
220
+   function handleReset() {
221
+    props.form.resetFields();
222
+  }
223
+
224
+
225
+  const { getFieldDecorator } = props.form
226
+  return (
227
+
228
+    <>
229
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
230
+        <Form.Item>
231
+          {getFieldDecorator('cityId')(
232
+            <SelectCity />,
233
+          )}
234
+        </Form.Item>
235
+        <Form.Item>
236
+          {getFieldDecorator('buildingId')(
237
+            <BuildSelect />,
238
+          )}
239
+        </Form.Item>
240
+        <Form.Item>
241
+          {getFieldDecorator('activityName')(
242
+            <Input
243
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
244
+              placeholder="请输入标题"
245
+            />,
246
+          )}
247
+        </Form.Item>
248
+        <Form.Item>
249
+          {getFieldDecorator('status')(
250
+            <Select style={{ width: '180px' }} placeholder="活动状态">
251
+              <Option value="0">进行中</Option>
252
+              <Option value="1">未开始</Option>
253
+              <Option value="2">已结束</Option>
254
+            </Select>,
255
+          )}
256
+        </Form.Item>
257
+        <Form.Item>
258
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
259
+            搜索
260
+          </Button>
261
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
262
+              重置
263
+            </Button>
264
+        </Form.Item>
265
+      </Form>
266
+      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
267
+        <Button type="danger" className={styles.addBtn} onClick={toEditActivity()}>新增</Button>
268
+      </AuthButton>
269
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="activityList"/>
270
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
271
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
272
+      </div>
273
+    </>
274
+  )
275
+}
276
+const WrappedHeader = Form.create({ name: 'header' })(header);
277
+
278
+export default WrappedHeader

+ 37
- 0
src/services/apis.js Ver arquivo

@@ -715,6 +715,43 @@ export default {
715 715
     action: 'admin.taRole.get',
716 716
   },
717 717
  },
718
+ groupActivity: {
719
+  list: {
720
+    url: `${prefix}/taShareActivity/list`,
721
+    method: 'get',
722
+    action: 'admin.taShareActivity.get',
723
+  },
724
+  add: {
725
+    url: `${prefix}/helpActivity/add`,
726
+    method: 'post',
727
+    action: 'admin.taRole.get',
728
+  },
729
+  details: {
730
+    url: `${prefix}/helpActivity/details`,
731
+    method: 'get',
732
+    action: 'admin.taRole.get',
733
+  },
734
+  update: {
735
+    url: `${prefix}/helpActivity/update`,
736
+    method: 'put',
737
+    action: 'admin.taRole.get',
738
+  },
739
+  finish: {
740
+    url: `${prefix}/taShareActivity/finish/:id`,
741
+    method: 'put',
742
+    action: 'admin.taShareActivity.finish',
743
+  },
744
+  top: {
745
+    url: `${prefix}/taShareActivity/weight`,
746
+    method: 'put',
747
+    action: 'admin.taShareActivity.weight',
748
+  },
749
+  record: {
750
+    url: `${prefix}/helpRecord`,
751
+    method: 'get',
752
+    action: 'admin.taRole.get',
753
+  },
754
+ },
718 755
  third: {
719 756
   thirdPartyMiniapp: {
720 757
     url: `${prefix}/thirdPartyMiniapp`,