|
@@ -9,6 +9,7 @@ import BuildSelect from '../../components/SelectButton/BuildSelect'
|
9
|
9
|
import apis from '../../services/apis';
|
10
|
10
|
import request from '../../utils/request';
|
11
|
11
|
import AuthButton from '@/components/AuthButton';
|
|
12
|
+import Prompt from 'umi/prompt';
|
12
|
13
|
|
13
|
14
|
const { Option } = Select;
|
14
|
15
|
const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
|
@@ -29,7 +30,16 @@ const header = props => {
|
29
|
30
|
|
30
|
31
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
31
|
32
|
useEffect(() => {
|
32
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
|
33
|
+
|
|
34
|
+ if (localStorage.getItem("activePageParams")) {
|
|
35
|
+ props.form.setFieldsValue(JSON.parse(localStorage.getItem("activePageParams")));
|
|
36
|
+ // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
|
|
37
|
+
|
|
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
|
+ }
|
33
|
43
|
}, [])
|
34
|
44
|
|
35
|
45
|
// 跳转到编辑商品
|
|
@@ -88,12 +98,12 @@ const header = props => {
|
88
|
98
|
key: 'title',
|
89
|
99
|
align: 'center',
|
90
|
100
|
// width: '15%',
|
91
|
|
- render: (x, row) => <><div style={{overflow: 'hidden',textOverflow: 'ellipsis',whiteSpace: 'nowrap', width: '201px',title:'content'}}>
|
92
|
|
- <span style={{color: 'blue',cursor: 'pointer'}} onClick={getActivityDetail(row.dynamicId)}>{row.title}</span></div></>,
|
|
101
|
+ render: (x, row) => <><div style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: '201px', title: 'content' }}>
|
|
102
|
+ <span style={{ color: 'blue', cursor: 'pointer' }} onClick={getActivityDetail(row.dynamicId)}>{row.title}</span></div></>,
|
93
|
103
|
// width: '300px',
|
94
|
104
|
// ellipsis:'true'overflow: hidden; /*溢出隐藏*/
|
95
|
|
-// text-overflow: ellipsis; /*以省略号...显示*/
|
96
|
|
-// white-space: nowrap;
|
|
105
|
+ // text-overflow: ellipsis; /*以省略号...显示*/
|
|
106
|
+ // white-space: nowrap;
|
97
|
107
|
},
|
98
|
108
|
{
|
99
|
109
|
title: '活动时间',
|
|
@@ -109,8 +119,8 @@ const header = props => {
|
109
|
119
|
dataIndex: 'count',
|
110
|
120
|
key: 'count',
|
111
|
121
|
align: 'center',
|
112
|
|
- render: (x, row) => <><div style={{overflow: 'hidden',textOverflow: 'ellipsis',whiteSpace: 'nowrap', width: '201px',title:'content'}}>
|
113
|
|
- <span style={{color: 'blue',cursor: 'pointer'}} onClick={getJoinPeople(row.dynamicId)}>{row.count}</span></div></>,
|
|
122
|
+ render: (x, row) => <><div style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: '201px', title: 'content' }}>
|
|
123
|
+ <span style={{ color: 'blue', cursor: 'pointer' }} onClick={getJoinPeople(row.dynamicId)}>{row.count}</span></div></>,
|
114
|
124
|
// width: '10%',
|
115
|
125
|
// width: '6%',
|
116
|
126
|
},
|
|
@@ -160,10 +170,10 @@ const header = props => {
|
160
|
170
|
{(row.activityStatus === 0 || row.activityStatus === 2) && <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.dynamicId)}>报名记录{<Icon type="snippets" className={styles.shoppingCart} />}</span>}
|
161
|
171
|
</AuthButton> */}
|
162
|
172
|
<AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
|
163
|
|
- <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this, row)}>{row.status === 1 ? '取消发布' : '发布'}<Icon type="close-circle" className={styles.edit} /></span>
|
|
173
|
+ <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this, row)}>{row.status === 1 ? '取消发布' : '发布'}<Icon type="close-circle" className={styles.edit} /></span>
|
164
|
174
|
</AuthButton>
|
165
|
175
|
<AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
|
166
|
|
- {row.activityStatus === 0 && <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={finishDynamic.bind(this, row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
|
|
176
|
+ {row.activityStatus === 0 && <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={finishDynamic.bind(this, row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
|
167
|
177
|
</AuthButton>
|
168
|
178
|
<AuthButton name="admin.buildingDynamic.tag" noRight={null}>
|
169
|
179
|
<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row)}>{row.weight === 1 ? '取消标签' : '添加标签'}<Icon type="vertical-align-top" className={styles.edit} /></span>
|
|
@@ -172,9 +182,9 @@ const header = props => {
|
172
|
182
|
<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={homeDynamic(row)}>{row.home === 1 ? '取消推首页' : '推首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
|
173
|
183
|
</AuthButton>
|
174
|
184
|
<AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
|
175
|
|
- {(row.activityStatus === 0 || row.activityStatus === 1) && <span style={{ color: '#FF925C',marginRight: '20px', cursor: 'pointer' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>}
|
|
185
|
+ {(row.activityStatus === 0 || row.activityStatus === 1) && <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>}
|
176
|
186
|
</AuthButton>
|
177
|
|
- {/* {(row.activityStatus === 0 || row.activityStatus === 2) &&<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={newQrcode.bind(this, row)}>{'下载二维码'} {<Icon type="qrcode" className={styles.shoppingCart} />}</span>} */}
|
|
187
|
+ {/* {(row.activityStatus === 0 || row.activityStatus === 2) &&<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={newQrcode.bind(this, row)}>{'下载二维码'} {<Icon type="qrcode" className={styles.shoppingCart} />}</span>} */}
|
178
|
188
|
</>
|
179
|
189
|
),
|
180
|
190
|
},
|
|
@@ -193,11 +203,11 @@ const header = props => {
|
193
|
203
|
title: '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
|
194
|
204
|
okText: '确定',
|
195
|
205
|
cancelText: '取消',
|
196
|
|
- onOk () {
|
|
206
|
+ onOk() {
|
197
|
207
|
request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } }).then(data => {
|
198
|
208
|
console.log(data)
|
199
|
209
|
message.info('操作成功!')
|
200
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
|
210
|
+ getList(JSON.parse(localStorage.getItem("activePageParams")))
|
201
|
211
|
}).catch(err => {
|
202
|
212
|
console.log(err)
|
203
|
213
|
message.info(err.msg || err.message)
|
|
@@ -212,7 +222,7 @@ const header = props => {
|
212
|
222
|
request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } }).then(data => {
|
213
|
223
|
console.log(data)
|
214
|
224
|
message.info('操作成功!')
|
215
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
|
225
|
+ getList(JSON.parse(localStorage.getItem("activePageParams")))
|
216
|
226
|
}).catch(err => {
|
217
|
227
|
console.log(err)
|
218
|
228
|
message.info(err.msg || err.message)
|
|
@@ -225,7 +235,7 @@ const header = props => {
|
225
|
235
|
request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } }).then(data => {
|
226
|
236
|
console.log(data)
|
227
|
237
|
message.info('操作成功!')
|
228
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
|
238
|
+ getList(JSON.parse(localStorage.getItem("activePageParams")))
|
229
|
239
|
}).catch(err => {
|
230
|
240
|
console.log(err)
|
231
|
241
|
message.info(err.msg || err.message)
|
|
@@ -249,7 +259,8 @@ const header = props => {
|
249
|
259
|
onOk() {
|
250
|
260
|
request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } }).then(data => {
|
251
|
261
|
message.info('操作成功!')
|
252
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
|
|
262
|
+ getList(JSON.parse(localStorage.getItem("activePageParams")))
|
|
263
|
+
|
253
|
264
|
}).catch(err => {
|
254
|
265
|
console.log(err)
|
255
|
266
|
message.info(err.msg || err.message)
|
|
@@ -267,7 +278,7 @@ const header = props => {
|
267
|
278
|
onOk() {
|
268
|
279
|
request({ ...apis.activity.send, urlData: { id: row.dynamicId } }).then(data => {
|
269
|
280
|
message.info('操作成功!')
|
270
|
|
- getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
|
|
281
|
+ getList(JSON.parse(localStorage.getItem("activePageParams")))
|
271
|
282
|
}).catch(err => {
|
272
|
283
|
console.log(err)
|
273
|
284
|
message.info(err.msg || err.message)
|
|
@@ -277,7 +288,14 @@ const header = props => {
|
277
|
288
|
}
|
278
|
289
|
|
279
|
290
|
const changePageNum = pageNumber => {
|
280
|
|
- getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
|
|
291
|
+ props.form.validateFields((err, values) => {
|
|
292
|
+ if (!err) {
|
|
293
|
+ localStorage.setItem("activePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...values }));
|
|
294
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
295
|
+ getList({ pageNum: pageNumber, pageSize: 10, ...values })
|
|
296
|
+ }
|
|
297
|
+ });
|
|
298
|
+
|
281
|
299
|
}
|
282
|
300
|
|
283
|
301
|
// 提交事件
|
|
@@ -291,16 +309,18 @@ const header = props => {
|
291
|
309
|
} else {
|
292
|
310
|
values.time = null
|
293
|
311
|
}
|
294
|
|
-
|
|
312
|
+ localStorage.setItem("activePageParams", (JSON.stringify({ pageNum: 1, pageSize: 10, ...values })));
|
295
|
313
|
getList({ pageNum: 1, pageSize: 10, ...values })
|
296
|
314
|
}
|
297
|
315
|
});
|
298
|
316
|
}
|
299
|
317
|
|
300
|
318
|
// 重置搜索
|
301
|
|
- function handleReset () {
|
|
319
|
+ function handleReset() {
|
302
|
320
|
props.form.resetFields();
|
303
|
321
|
setTime('')
|
|
322
|
+ props.form.resetFields();
|
|
323
|
+ localStorage.setItem("activePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
|
304
|
324
|
getList({ pageNum: 1, pageSize: 10 })
|
305
|
325
|
}
|
306
|
326
|
|
|
@@ -338,7 +358,7 @@ const header = props => {
|
338
|
358
|
</Form.Item>
|
339
|
359
|
<Form.Item>
|
340
|
360
|
{getFieldDecorator('time')(
|
341
|
|
- <DatePicker onChange={timeOnChange}/>,
|
|
361
|
+ <DatePicker onChange={timeOnChange} />,
|
342
|
362
|
)}
|
343
|
363
|
</Form.Item>
|
344
|
364
|
<Form.Item>
|
|
@@ -361,13 +381,17 @@ const header = props => {
|
361
|
381
|
// onClick: getActivityDetail(record.dynamicId),
|
362
|
382
|
// };
|
363
|
383
|
// }}
|
364
|
|
- dataSource={data.list} columns={columns} pagination={false} rowKey="activityList" />
|
|
384
|
+ dataSource={data.list} columns={columns} pagination={false} rowKey="activityList" />
|
365
|
385
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
366
|
|
- <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
|
|
386
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
|
367
|
387
|
</div>
|
|
388
|
+ <Prompt message={location =>
|
|
389
|
+ location.pathname.startsWith("/activity/ActivityList")
|
|
390
|
+ ? true
|
|
391
|
+ : location.pathname.startsWith("/activity/detailActivity") ? true : localStorage.removeItem("activePageParams")} />
|
368
|
392
|
</>
|
369
|
393
|
)
|
370
|
394
|
}
|
371
|
395
|
const WrappedHeader = Form.create({ name: 'header' })(header);
|
372
|
|
-
|
|
396
|
+// ||"/activity/detailActivity"
|
373
|
397
|
export default WrappedHeader
|