|
@@ -47,27 +47,27 @@ const header = props => {
|
47
|
47
|
const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
|
48
|
48
|
|
49
|
49
|
|
50
|
|
- // 详情
|
51
|
|
- const getDynamicData = helpActivityId => {
|
52
|
|
- request({ ...apis.helpActivity.details, params: { helpActivityId } }).then((data) => {
|
53
|
|
- data.activityTime = [moment(data.startDate), moment(data.endDate)]
|
54
|
|
- const num = data.helpNum > 0 ? 1 : 0
|
55
|
|
- setIsEnlist(num)
|
56
|
|
- setActivityStatus(data.activityStatus)
|
57
|
|
- setDisable(data.activityStatus === 0 ? true : false)
|
58
|
|
- data.isEnlist = num
|
59
|
|
- props.form.setFieldsValue(data)
|
60
|
|
- setDynamicData(data)
|
61
|
|
- })
|
62
|
|
- }
|
|
50
|
+ // 详情
|
|
51
|
+ const getDynamicData = helpActivityId => {
|
|
52
|
+ request({ ...apis.helpActivity.details, params: { helpActivityId } }).then((data) => {
|
|
53
|
+ data.activityTime = [moment(data.startDate), moment(data.endDate)]
|
|
54
|
+ const num = data.helpNum > 0 ? 1 : 0
|
|
55
|
+ setIsEnlist(num)
|
|
56
|
+ setActivityStatus(data.activityStatus)
|
|
57
|
+ setDisable(data.activityStatus === 0 ? true : false)
|
|
58
|
+ data.isEnlist = num
|
|
59
|
+ props.form.setFieldsValue(data)
|
|
60
|
+ setDynamicData(data)
|
|
61
|
+ })
|
|
62
|
+ }
|
63
|
63
|
|
64
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
65
|
|
- useEffect(() => {
|
66
|
|
- // eslint-disable-next-line no-use-before-define
|
67
|
|
- if (helpActivityId) {
|
68
|
|
- getDynamicData(helpActivityId)
|
69
|
|
- }
|
70
|
|
- }, [])
|
|
64
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
65
|
+ useEffect(() => {
|
|
66
|
+ // eslint-disable-next-line no-use-before-define
|
|
67
|
+ if (helpActivityId) {
|
|
68
|
+ getDynamicData(helpActivityId)
|
|
69
|
+ }
|
|
70
|
+ }, [])
|
71
|
71
|
|
72
|
72
|
// function addChannel(params) {
|
73
|
73
|
// request({ ...apis.channelList.addChannel, data: { ...params } }).then((data) => {
|
|
@@ -78,6 +78,17 @@ const header = props => {
|
78
|
78
|
// })
|
79
|
79
|
// }
|
80
|
80
|
|
|
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;
|
|
89
|
+ }
|
|
90
|
+ }
|
|
91
|
+
|
81
|
92
|
function handleSubmit(e) {
|
82
|
93
|
e.preventDefault();
|
83
|
94
|
props.form.validateFields((err, values) => {
|
|
@@ -91,7 +102,7 @@ const header = props => {
|
91
|
102
|
message.error('助力邀请人数不能超过200')
|
92
|
103
|
return
|
93
|
104
|
}
|
94
|
|
- // 助力邀请人数>0
|
|
105
|
+ // 助力邀请人数>0
|
95
|
106
|
if (values.personNum <= 0) {
|
96
|
107
|
message.error('助力邀请人数大于0')
|
97
|
108
|
return
|
|
@@ -99,11 +110,11 @@ const header = props => {
|
99
|
110
|
|
100
|
111
|
// 判断助力人数必须大于0
|
101
|
112
|
if (values.isEnlist === 1) {
|
102
|
|
- if (values.helpNum <= 0) {
|
103
|
|
- message.error('限制助力次数必须大于0')
|
104
|
|
- return
|
|
113
|
+ if (values.helpNum <= 0) {
|
|
114
|
+ message.error('限制助力次数必须大于0')
|
|
115
|
+ return
|
|
116
|
+ }
|
105
|
117
|
}
|
106
|
|
- }
|
107
|
118
|
const { activityTime, signupTime, ...submitValue } = values
|
108
|
119
|
const [startDate, endDate] = activityTime
|
109
|
120
|
console.log('startDate', activityTime)
|
|
@@ -114,6 +125,14 @@ const header = props => {
|
114
|
125
|
// submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
|
115
|
126
|
console.log('submit data --->', submitValue)
|
116
|
127
|
if (helpActivityId) {
|
|
128
|
+
|
|
129
|
+ const nowDate = new Date()
|
|
130
|
+ if (!compareDate(nowDate, startDate)) {
|
|
131
|
+
|
|
132
|
+ message.info("修改后的开始时间不得大于当前时间(会存在已经成功助力或者发起助力的用户)")
|
|
133
|
+ return
|
|
134
|
+ }
|
|
135
|
+
|
117
|
136
|
submitValue.helpActivityId = helpActivityId
|
118
|
137
|
request({ ...apis.helpActivity.update, data: submitValue }).then((data) => {
|
119
|
138
|
message.info("保存成功")
|
|
@@ -145,129 +164,129 @@ const header = props => {
|
145
|
164
|
<>
|
146
|
165
|
<Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
|
147
|
166
|
<Form.Item label="所属项目">
|
148
|
|
- {getFieldDecorator('buildingId', {
|
149
|
|
- rules: [
|
150
|
|
- {
|
151
|
|
- required: true,
|
152
|
|
- message: '请选择所属项目',
|
153
|
|
- },
|
154
|
|
- ],
|
155
|
|
- })(<BuildSelect disabled={disable}/>)}
|
|
167
|
+ {getFieldDecorator('buildingId', {
|
|
168
|
+ rules: [
|
|
169
|
+ {
|
|
170
|
+ required: true,
|
|
171
|
+ message: '请选择所属项目',
|
|
172
|
+ },
|
|
173
|
+ ],
|
|
174
|
+ })(<BuildSelect disabled={disable} />)}
|
156
|
175
|
</Form.Item>
|
157
|
176
|
|
158
|
177
|
<Form.Item label="活动标题">
|
159
|
|
- {getFieldDecorator('title', {
|
160
|
|
- rules: [
|
161
|
|
- {
|
162
|
|
- required: true,
|
163
|
|
- message: '请输入活动标题',
|
164
|
|
- },
|
165
|
|
- ],
|
166
|
|
- })(<Input />)}
|
|
178
|
+ {getFieldDecorator('title', {
|
|
179
|
+ rules: [
|
|
180
|
+ {
|
|
181
|
+ required: true,
|
|
182
|
+ message: '请输入活动标题',
|
|
183
|
+ },
|
|
184
|
+ ],
|
|
185
|
+ })(<Input />)}
|
167
|
186
|
</Form.Item>
|
168
|
187
|
|
169
|
188
|
<Form.Item label="助力详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:助力活动详情">
|
170
|
189
|
{getFieldDecorator('img', {
|
171
|
|
- rules: [
|
172
|
|
- {
|
173
|
|
- required: true,
|
174
|
|
- message: '助力详情主图不能为空',
|
175
|
|
- },
|
176
|
|
- ],
|
177
|
|
- })(<ImageUploader />)}
|
|
190
|
+ rules: [
|
|
191
|
+ {
|
|
192
|
+ required: true,
|
|
193
|
+ message: '助力详情主图不能为空',
|
|
194
|
+ },
|
|
195
|
+ ],
|
|
196
|
+ })(<ImageUploader />)}
|
178
|
197
|
</Form.Item>
|
179
|
198
|
|
180
|
199
|
<Form.Item label="助力封面图1" help="建议图片尺寸:750*420px,比例16:9,格式:jpg,用于:活动列表/首页推荐">
|
181
|
200
|
{getFieldDecorator('listImg', {
|
182
|
|
- rules: [
|
183
|
|
- {
|
184
|
|
- required: true,
|
185
|
|
- message: '助力封面图1不能为空',
|
186
|
|
- },
|
187
|
|
- ],
|
188
|
|
- })(<ImageUploader />)}
|
|
201
|
+ rules: [
|
|
202
|
+ {
|
|
203
|
+ required: true,
|
|
204
|
+ message: '助力封面图1不能为空',
|
|
205
|
+ },
|
|
206
|
+ ],
|
|
207
|
+ })(<ImageUploader />)}
|
189
|
208
|
</Form.Item>
|
190
|
209
|
|
191
|
210
|
<Form.Item label="助力封面图2" help="建议图片尺寸:750*250px,比例3:1,格式:jpg,用于:项目详情页">
|
192
|
211
|
{getFieldDecorator('bannerListImg', {
|
193
|
|
- rules: [
|
194
|
|
- {
|
195
|
|
- required: true,
|
196
|
|
- message: '助力封面图2不能为空',
|
197
|
|
- },
|
198
|
|
- ],
|
199
|
|
- })(<ImageUploader />)}
|
|
212
|
+ rules: [
|
|
213
|
+ {
|
|
214
|
+ required: true,
|
|
215
|
+ message: '助力封面图2不能为空',
|
|
216
|
+ },
|
|
217
|
+ ],
|
|
218
|
+ })(<ImageUploader />)}
|
200
|
219
|
</Form.Item>
|
201
|
220
|
|
202
|
221
|
<Form.Item label="活动时间">
|
203
|
|
- {getFieldDecorator('activityTime', {
|
204
|
|
- rules: [
|
205
|
|
- {
|
206
|
|
- required: true,
|
207
|
|
- message: '请选择活动时间',
|
208
|
|
- },
|
209
|
|
- ],
|
210
|
|
- })(<RangePicker disabled={activityStatus===0 ? true : false} format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
|
|
222
|
+ {getFieldDecorator('activityTime', {
|
|
223
|
+ rules: [
|
|
224
|
+ {
|
|
225
|
+ required: true,
|
|
226
|
+ message: '请选择活动时间',
|
|
227
|
+ },
|
|
228
|
+ ],
|
|
229
|
+ })(<RangePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} />)}
|
211
|
230
|
</Form.Item>
|
212
|
231
|
|
213
|
232
|
<Form.Item label="助力邀请人数" min={1} max={10}>
|
214
|
|
- {getFieldDecorator('personNum', {
|
215
|
|
- rules: [
|
216
|
|
- {
|
217
|
|
- required: true,
|
218
|
|
- message: '请输入活动人数',
|
219
|
|
- },
|
220
|
|
- ],
|
221
|
|
- })(<Input type="number" disabled={activityStatus===0 ? true : false}/>)}
|
|
233
|
+ {getFieldDecorator('personNum', {
|
|
234
|
+ rules: [
|
|
235
|
+ {
|
|
236
|
+ required: true,
|
|
237
|
+ message: '请输入活动人数',
|
|
238
|
+ },
|
|
239
|
+ ],
|
|
240
|
+ })(<Input type="number" disabled={activityStatus === 0 ? true : false} />)}
|
222
|
241
|
</Form.Item>
|
223
|
242
|
|
224
|
243
|
<Form.Item label="助力次数">
|
225
|
|
- {getFieldDecorator('isEnlist', {
|
226
|
|
- rules: [
|
227
|
|
- {
|
228
|
|
- required: true,
|
229
|
|
- message: '请选择助力次数',
|
230
|
|
- },
|
231
|
|
- ],
|
232
|
|
- })(
|
233
|
|
- <Radio.Group onChange={(e) => radioOnChange(e)} disabled={activityStatus===0 ? true : false}>
|
234
|
|
- <Radio value={0}>不限制</Radio>
|
235
|
|
- <Radio value={1}>限制</Radio>
|
236
|
|
- </Radio.Group>,
|
237
|
|
- )}
|
|
244
|
+ {getFieldDecorator('isEnlist', {
|
|
245
|
+ rules: [
|
|
246
|
+ {
|
|
247
|
+ required: true,
|
|
248
|
+ message: '请选择助力次数',
|
|
249
|
+ },
|
|
250
|
+ ],
|
|
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
|
+ )}
|
238
|
257
|
</Form.Item>
|
239
|
|
- {
|
240
|
|
- isEnlist === 1 && <Form.Item label=" " min={1} max={10}>
|
241
|
|
- {getFieldDecorator('helpNum', {
|
242
|
|
- rules: [
|
243
|
|
- {
|
244
|
|
- required: true,
|
245
|
|
- message: '请输入助力人数',
|
246
|
|
- },
|
247
|
|
- ],
|
248
|
|
- })(<Input type="number" placeholder="助力人数限制"/>)}
|
249
|
|
- </Form.Item>
|
250
|
|
- }
|
|
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
|
+ }
|
251
|
270
|
|
252
|
271
|
<Form.Item label="活动说明" help="建议宽度:750px,高度不限,格式:jpg,用于活动详情">
|
253
|
272
|
{getFieldDecorator('activityInstructions', {
|
254
|
|
- rules: [
|
255
|
|
- {
|
256
|
|
- required: true,
|
257
|
|
- message: '活动说明不能为空',
|
258
|
|
- },
|
259
|
|
- ],
|
260
|
|
- })(<ImageUploader />)}
|
261
|
|
- </Form.Item>
|
|
273
|
+ rules: [
|
|
274
|
+ {
|
|
275
|
+ required: true,
|
|
276
|
+ message: '活动说明不能为空',
|
|
277
|
+ },
|
|
278
|
+ ],
|
|
279
|
+ })(<ImageUploader />)}
|
|
280
|
+ </Form.Item>
|
262
|
281
|
<Form.Item label="权重">
|
263
|
|
- {getFieldDecorator('heavy', {
|
264
|
|
- rules: [
|
265
|
|
- {
|
266
|
|
- required: true,
|
267
|
|
- message: '请输入权重',
|
268
|
|
- },
|
269
|
|
- ],
|
270
|
|
- })(<Input type="number" style={{ width: 80}}/>)}<span style={{ marginLeft: 30, color:'grey'}}>数字越大越靠前</span>
|
|
282
|
+ {getFieldDecorator('heavy', {
|
|
283
|
+ rules: [
|
|
284
|
+ {
|
|
285
|
+ required: true,
|
|
286
|
+ message: '请输入权重',
|
|
287
|
+ },
|
|
288
|
+ ],
|
|
289
|
+ })(<Input type="number" style={{ width: 80 }} />)}<span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
|
271
|
290
|
</Form.Item>
|
272
|
291
|
<Form.Item wrapperCol={{ span: 12, offset: 8 }}>
|
273
|
292
|
<Button type="primary" htmlType="submit">
|
|
@@ -277,7 +296,7 @@ const header = props => {
|
277
|
296
|
<Button onClick={() => cancelPage()}>
|
278
|
297
|
取消
|
279
|
298
|
</Button>
|
280
|
|
- </Form.Item>
|
|
299
|
+ </Form.Item>
|
281
|
300
|
</Form>
|
282
|
301
|
</>
|
283
|
302
|
)
|
|
@@ -298,22 +317,22 @@ const Edit = props => {
|
298
|
317
|
const { helpActivityId } = props.location.query
|
299
|
318
|
const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
|
300
|
319
|
|
301
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
302
|
|
- useEffect(() => {
|
303
|
|
- // eslint-disable-next-line no-use-before-define
|
304
|
|
- if (helpActivityId) {
|
|
320
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
321
|
+ useEffect(() => {
|
|
322
|
+ // eslint-disable-next-line no-use-before-define
|
|
323
|
+ if (helpActivityId) {
|
305
|
324
|
getDynamicData(helpActivityId);
|
306
|
325
|
}
|
307
|
|
- }, [])
|
|
326
|
+ }, [])
|
|
327
|
+
|
|
328
|
+ // 详情
|
|
329
|
+ const getDynamicData = (helpActivityId) => {
|
|
330
|
+ request({ ...apis.helpActivity.details, params: { helpActivityId } }).then((data) => {
|
|
331
|
+ console.log(data)
|
|
332
|
+ setDynamicData(data)
|
|
333
|
+ })
|
|
334
|
+ }
|
308
|
335
|
|
309
|
|
- // 详情
|
310
|
|
- const getDynamicData = (helpActivityId) => {
|
311
|
|
- request({ ...apis.helpActivity.details, params: { helpActivityId } }).then((data) => {
|
312
|
|
- console.log(data)
|
313
|
|
- setDynamicData(data)
|
314
|
|
- })
|
315
|
|
- }
|
316
|
|
-
|
317
|
336
|
const radioOnChange = e => {
|
318
|
337
|
console.log(e.target.value)
|
319
|
338
|
setDynamicData({ ...dynamicData, isEnlist: e.target.value })
|
|
@@ -341,7 +360,7 @@ const Edit = props => {
|
341
|
360
|
})
|
342
|
361
|
getMiniappName()
|
343
|
362
|
}, [])
|
344
|
|
- }else{
|
|
363
|
+ } else {
|
345
|
364
|
getMiniappName()
|
346
|
365
|
}
|
347
|
366
|
// 获取小程序名称
|
|
@@ -417,7 +436,7 @@ const Edit = props => {
|
417
|
436
|
<p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>助力海报图</p>
|
418
|
437
|
<ImageUploader value={imgValue} onChange={e => changeImg(e)} />
|
419
|
438
|
</div>
|
420
|
|
- <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动海报</p>
|
|
439
|
+ <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动海报</p>
|
421
|
440
|
<div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
|
422
|
441
|
<p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
|
423
|
442
|
<Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
|
|
@@ -495,7 +514,7 @@ const Edit = props => {
|
495
|
514
|
<p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>助力分享图</p>
|
496
|
515
|
<ImageUploader value={imgValue} onChange={e => changeImg(e)} />
|
497
|
516
|
</div>
|
498
|
|
- <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动分享好友</p>
|
|
517
|
+ <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动分享好友</p>
|
499
|
518
|
<Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
|
500
|
519
|
<Button onClick={() => cancelPage()}>取消</Button>
|
501
|
520
|
</div>
|
|
@@ -511,7 +530,7 @@ const Edit = props => {
|
511
|
530
|
</Radio.Group>
|
512
|
531
|
</div>
|
513
|
532
|
<div>
|
514
|
|
- {tab === 'basic' && <Basic helpActivityId={helpActivityId}/>}
|
|
533
|
+ {tab === 'basic' && <Basic helpActivityId={helpActivityId} />}
|
515
|
534
|
{tab === 'poster' && <Poster />}
|
516
|
535
|
{tab === 'share' && <Share />}
|
517
|
536
|
</div>
|