zhoulisen преди 5 години
родител
ревизия
abaea4639c

+ 48
- 24
src/pages/activity/ActivityList.jsx Целия файл

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

+ 5
- 0
src/pages/activity/detailActivity.jsx Целия файл

@@ -17,6 +17,7 @@ import poster1 from '../../assets/poster1.png';
17 17
 import poster2 from '../../assets/poster2.png';
18 18
 import xiaochengxu from '../../assets/xiaochengxu.png';
19 19
 import AuthButton from '@/components/AuthButton';
20
+import Prompt from 'umi/prompt';
20 21
 
21 22
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22 23
 const { TextArea } = Input;
@@ -420,6 +421,10 @@ const Edit = props => {
420 421
             取消
421 422
           </Button>
422 423
       </div>
424
+      <Prompt message={location =>
425
+        location.pathname.startsWith("/activity/ActivityList")
426
+          ? true
427
+          : location.pathname.startsWith("/activity/detailActivity") ? true : localStorage.removeItem("activePageParams")} />
423 428
     </div>
424 429
   );
425 430
 }

+ 5
- 2
src/pages/activity/drainage/Detail.jsx Целия файл

@@ -9,7 +9,7 @@ import request from '../../../utils/request';
9 9
 import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
10 10
 import AuthButton from '../../../components/AuthButton';
11 11
 import { timeout } from 'q';
12
-
12
+import Prompt from 'umi/prompt';
13 13
 
14 14
 const data = []
15 15
 
@@ -190,7 +190,10 @@ const header = (props) => {
190 190
         </div>
191 191
       </div>
192 192
 
193
-
193
+      <Prompt message={location =>
194
+        location.pathname.startsWith("/activity/drainage")
195
+          ? true
196
+          : localStorage.removeItem("drainageActivePageParams")} />
194 197
 
195 198
 
196 199
     </>

+ 24
- 7
src/pages/activity/drainage/DrainageList.jsx Целия файл

@@ -10,6 +10,7 @@ import moment from 'moment';
10 10
 import AuthButton from '../../../components/AuthButton';
11 11
 import ImageUploader from '../../../components/XForm/ImageUpload';
12 12
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
13
+import Prompt from 'umi/prompt';
13 14
 
14 15
 const toEditList = (row) => () => {
15 16
   router.push({
@@ -28,8 +29,17 @@ const header = (props) => {
28 29
   const [formsdate, setFormsDate] = useState({})
29 30
   //   const [page, changePage] = useState({})
30 31
   useEffect(() => {
32
+    if (localStorage.getItem("drainageActivePageParams")) {
33
+      props.form.setFieldsValue(JSON.parse(localStorage.getItem("drainageActivePageParams")));
34
+      // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
35
+
36
+      gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
37
+    } else {
38
+      localStorage.setItem("drainageActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
39
+      gettaDrainage({ pageNum: 1, pageSize: 10 });
40
+    }
41
+
31 42
 
32
-    gettaDrainage({ pageNum: 1, pageSize: 10 })
33 43
     setDate({
34 44
       ModalText: 'Content of the modal',
35 45
       visible: false,
@@ -56,7 +66,7 @@ const header = (props) => {
56 66
       onOk () {
57 67
         request({ ...apis.activity.deletetaDrainage, urlData: { id: drainageIid }, }).then((data) => {
58 68
           message.info('操作成功!')
59
-          gettaDrainage({ pageNum: 1, pageSize: 10 })
69
+          gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
60 70
         }).catch((err) => {
61 71
           console.log('111111', err)
62 72
           // message.info(err.msg || err.message)
@@ -101,7 +111,7 @@ const header = (props) => {
101 111
           onOk () {
102 112
             request({ ...apis.activity.exchangeDrainage, urlData: { id: drainage.drainageId }, data: drainage }).then((data) => {
103 113
               message.info('操作成功!')
104
-              gettaDrainage({ pageNum: 1, pageSize: 10 })
114
+              gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
105 115
             }).catch((err) => {
106 116
               console.log(err)
107 117
               message.info(err.msg || err.message)
@@ -111,7 +121,7 @@ const header = (props) => {
111 121
       }else{
112 122
         request({ ...apis.activity.exchangeDrainage, urlData: { id: drainage.drainageId }, data: drainage }).then((data) => {
113 123
           message.info('H5活动已下架!')
114
-          gettaDrainage({ pageNum: 1, pageSize: 10 })
124
+          gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
115 125
         }).catch((err) => {
116 126
           console.log(err)
117 127
           message.info(err.msg || err.message)
@@ -121,7 +131,7 @@ const header = (props) => {
121 131
     }else{
122 132
       request({ ...apis.activity.exchangeDrainage, urlData: { id: drainage.drainageId }, data: drainage }).then((data) => {
123 133
         message.info('H5活动已上架!')
124
-        gettaDrainage({ pageNum: 1, pageSize: 10 })
134
+        gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
125 135
       }).catch((err) => {
126 136
         console.log(err)
127 137
         message.info(err.msg || err.message)
@@ -253,7 +263,7 @@ const header = (props) => {
253 263
             // { ...apis.activity.deletetaDrainage,urlData: { id: drainageIid }, }
254 264
             request({ ...apis.activity.updatetaDrainage, urlData: { id: formsDate.drainageId }, data: values }).then((data) => {
255 265
               message.info('操作成功!')
256
-              gettaDrainage({ pageNum: 1, pageSize: 10 })
266
+              gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
257 267
               setDate({
258 268
                 visible: false,
259 269
               });
@@ -266,7 +276,7 @@ const header = (props) => {
266 276
 
267 277
             request({ ...apis.activity.addtaDrainage, data: values }).then((data) => {
268 278
               message.info("操作成功")
269
-              gettaDrainage({ pageNum: 1, pageSize: 10 })
279
+              gettaDrainage(JSON.parse(localStorage.getItem("drainageActivePageParams")))
270 280
               setDate({
271 281
                 visible: false,
272 282
               });
@@ -414,6 +424,7 @@ const header = (props) => {
414 424
   //重置搜索
415 425
   function handleReset () {
416 426
     props.form.resetFields();
427
+    localStorage.setItem("drainageActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
417 428
     gettaDrainage({ pageNum: 1, pageSize: 10 })
418 429
   }
419 430
 
@@ -443,6 +454,7 @@ const header = (props) => {
443 454
   const changePageNum = pageNumber => {
444 455
     props.form.validateFields((err, values) => {
445 456
       if (!err) {
457
+        localStorage.setItem("drainageActivePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...values }));
446 458
         gettaDrainage({ pageNum: pageNumber, pageSize: 10, ...values })
447 459
       }
448 460
     });
@@ -475,6 +487,7 @@ const header = (props) => {
475 487
       console.log('values', values)
476 488
       if (!err) {
477 489
         console.log('values', values)
490
+        localStorage.setItem("drainageActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10, ...values }));
478 491
         gettaDrainage({ pageNum: 1, pageSize: 10, ...values })
479 492
       }
480 493
     });
@@ -563,6 +576,10 @@ const header = (props) => {
563 576
           <Pagination showQuickJumper defaultCurrent={1} total={datas.total} onChange={(e) => changePageNum(e)} current={datas.current} />
564 577
         </div>
565 578
       </div>
579
+      <Prompt message={location =>
580
+        location.pathname.startsWith("/activity/drainage")
581
+          ? true
582
+          : localStorage.removeItem("drainageActivePageParams")} />
566 583
     </>
567 584
   )
568 585
 }

+ 5
- 0
src/pages/activity/editActivity.jsx Целия файл

@@ -16,6 +16,7 @@ import touxiang from '../../assets/touxiang.jpg';
16 16
 import poster1 from '../../assets/poster1.png';
17 17
 import poster2 from '../../assets/poster2.png';
18 18
 import xiaochengxu from '../../assets/xiaochengxu.png'
19
+import Prompt from 'umi/prompt';
19 20
 
20 21
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21 22
 const { TextArea } = Input;
@@ -459,6 +460,10 @@ const Edit = props => {
459 460
         {tab === 'poster' && <Poster />}
460 461
         {tab === 'share' && <Share />}
461 462
       </div>
463
+      <Prompt message={location =>
464
+        location.pathname.startsWith("/activity/ActivityList")
465
+          ? true
466
+          : location.pathname.startsWith("/activity/detailActivity") ? true : localStorage.removeItem("activePageParams")} />
462 467
     </div>
463 468
   );
464 469
 }

+ 5
- 1
src/pages/activity/groupActivity/detailActivity.jsx Целия файл

@@ -17,6 +17,7 @@ import poster1 from '../../../assets/poster1.png';
17 17
 import poster2 from '../../../assets/poster2.png';
18 18
 import xiaochengxu from '../../../assets/xiaochengxu.png';
19 19
 import AuthButton from '@/components/AuthButton';
20
+import Prompt from 'umi/prompt';
20 21
 
21 22
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22 23
 const { TextArea } = Input;
@@ -390,7 +391,10 @@ const Edit = props => {
390 391
             取消
391 392
           </Button>
392 393
       </div>
393
-
394
+      <Prompt message={location =>
395
+        location.pathname.startsWith("/activity/groupActivity")
396
+          ? true
397
+          : localStorage.removeItem("groupActivePageParams")} />
394 398
     </div>
395 399
     
396 400
   );

+ 5
- 0
src/pages/activity/groupActivity/editGroupActivity.jsx Целия файл

@@ -16,6 +16,7 @@ import touxiang from '../../../assets/touxiang.jpg';
16 16
 import poster1 from '../../../assets/poster1.png';
17 17
 import poster2 from '../../../assets/poster2.png';
18 18
 import xiaochengxu from '../../../assets/xiaochengxu.png'
19
+import Prompt from 'umi/prompt';
19 20
 
20 21
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21 22
 const { TextArea } = Input;
@@ -401,6 +402,10 @@ const Edit = props => {
401 402
         {tab === 'poster' && <Poster />}
402 403
         {tab === 'share' && <Share />}
403 404
       </div>
405
+      <Prompt message={location =>
406
+        location.pathname.startsWith("/activity/groupActivity")
407
+          ? true
408
+          : localStorage.removeItem("groupActivePageParams")} />
404 409
     </div>
405 410
   );
406 411
 }

+ 25
- 7
src/pages/activity/groupActivity/list.jsx Целия файл

@@ -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;
@@ -18,7 +19,16 @@ const header = props => {
18 19
   //   const [page, changePage] = useState({})
19 20
 
20 21
   useEffect(() => {
21
-    getList({ pageNum: 1, pageSize: 10 });
22
+    if (localStorage.getItem("groupActivePageParams")) {
23
+      props.form.setFieldsValue(JSON.parse(localStorage.getItem("groupActivePageParams")));
24
+      // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
25
+
26
+      getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
27
+    } else {
28
+      localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
29
+      getList({ pageNum: 1, pageSize: 10 });
30
+    }
31
+ 
22 32
   }, [])
23 33
 
24 34
   // 查询列表
@@ -161,7 +171,7 @@ const header = props => {
161 171
         request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: "" } }).then((data) => {
162 172
           console.log(data)
163 173
           message.info('操作成功!')
164
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
174
+          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
165 175
         }).catch((err) => {
166 176
           console.log(err)
167 177
           message.info(err.msg || err.message)
@@ -180,7 +190,7 @@ const header = props => {
180 190
         request({ ...apis.groupActivity.finish, urlData: { id: row.groupActivityId } }).then((data) => {
181 191
           console.log(data)
182 192
           message.info('操作成功!')
183
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
193
+          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
184 194
         }).catch((err) => {
185 195
           console.log(err)
186 196
           message.info(err.msg || err.message)
@@ -194,7 +204,7 @@ const header = props => {
194 204
     request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, weight: weight } }).then((data) => {
195 205
       console.log(data)
196 206
       message.info('操作成功!')
197
-      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
207
+      getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
198 208
     }).catch((err) => {
199 209
       console.log(err)
200 210
       message.info(err.msg || err.message)
@@ -218,7 +228,7 @@ const header = props => {
218 228
       onOk() {
219 229
         request({ ...apis.groupActivity.cancel, urlData: { id: row.groupActivityId } }).then(data => {
220 230
           message.info('操作成功!')
221
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue()  })
231
+          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
222 232
         }).catch(err => {
223 233
           console.log(err)
224 234
           message.info(err.msg || err.message)
@@ -236,7 +246,7 @@ const header = props => {
236 246
       onOk() {
237 247
         request({ ...apis.groupActivity.send, urlData: { id: row.groupActivityId } }).then(data => {
238 248
           message.info('操作成功!')
239
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
249
+          getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
240 250
         }).catch(err => {
241 251
           console.log(err)
242 252
           message.info(err.msg || err.message)
@@ -250,7 +260,7 @@ const header = props => {
250 260
     request({ ...apis.groupActivity.top, data: { groupActivityId: row.groupActivityId, sort: row.sort } }).then((data) => {
251 261
       console.log(data)
252 262
       message.info('操作成功!')
253
-      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
263
+      getList(JSON.parse(localStorage.getItem("groupActivePageParams")))
254 264
     }).catch((err) => {
255 265
       console.log(err)
256 266
       message.info(err.msg || err.message)
@@ -258,6 +268,8 @@ const header = props => {
258 268
   }
259 269
 
260 270
   const changePageNum = pageNumber => {
271
+    localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() }));
272
+   
261 273
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
262 274
   }
263 275
 
@@ -267,6 +279,7 @@ const header = props => {
267 279
     props.form.validateFields((err, values) => {
268 280
       if (!err) {
269 281
         console.log('提交数据: ', values)
282
+        localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10, ...values }));
270 283
         getList({ pageNum: 1, pageSize: 10, ...values })
271 284
       }
272 285
     });
@@ -275,6 +288,7 @@ const header = props => {
275 288
   //重置搜索
276 289
   function handleReset () {
277 290
     props.form.resetFields();
291
+    localStorage.setItem("groupActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
278 292
     getList({ pageNum: 1, pageSize: 10 })
279 293
   }
280 294
 
@@ -335,6 +349,10 @@ const header = props => {
335 349
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
336 350
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
337 351
       </div>
352
+      <Prompt message={location =>
353
+        location.pathname.startsWith("/activity/groupActivity")
354
+          ? true
355
+          : localStorage.removeItem("groupActivePageParams")} />
338 356
     </>
339 357
   )
340 358
 }

+ 5
- 1
src/pages/activity/helpActivity/detailActivity.jsx Целия файл

@@ -17,6 +17,7 @@ import poster1 from '../../../assets/poster1.png';
17 17
 import poster2 from '../../../assets/poster2.png';
18 18
 import xiaochengxu from '../../../assets/xiaochengxu.png';
19 19
 import AuthButton from '@/components/AuthButton';
20
+import Prompt from 'umi/prompt';
20 21
 
21 22
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22 23
 const { TextArea } = Input;
@@ -389,7 +390,10 @@ const Edit = props => {
389 390
             取消
390 391
           </Button>
391 392
       </div>
392
-
393
+      <Prompt message={location =>
394
+        location.pathname.startsWith("/activity/helpActivity")
395
+          ? true
396
+          : localStorage.removeItem("helpActivePageParams")} />
393 397
     </div>
394 398
   );
395 399
 }

+ 5
- 0
src/pages/activity/helpActivity/edithelpActivity.jsx Целия файл

@@ -16,6 +16,7 @@ import touxiang from '../../../assets/touxiang.jpg';
16 16
 import poster1 from '../../../assets/poster1.png';
17 17
 import poster2 from '../../../assets/poster2.png';
18 18
 import xiaochengxu from '../../../assets/xiaochengxu.png'
19
+import Prompt from 'umi/prompt';
19 20
 
20 21
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21 22
 const { TextArea } = Input;
@@ -514,6 +515,10 @@ const Edit = props => {
514 515
         {tab === 'poster' && <Poster />}
515 516
         {tab === 'share' && <Share />}
516 517
       </div>
518
+      <Prompt message={location =>
519
+        location.pathname.startsWith("/activity/helpActivity")
520
+          ? true
521
+          : localStorage.removeItem("activePageParams")} />
517 522
     </div>
518 523
   );
519 524
 }

+ 23
- 5
src/pages/activity/helpActivity/list.jsx Целия файл

@@ -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;
@@ -18,7 +19,16 @@ const header = props => {
18 19
 //   const [page, changePage] = useState({})
19 20
 
20 21
   useEffect(() => {
21
-    getList({ pageNum: 1, pageSize: 10 });
22
+    
23
+    if (localStorage.getItem("helpActivePageParams")) {
24
+      props.form.setFieldsValue(JSON.parse(localStorage.getItem("helpActivePageParams")));
25
+      // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
26
+
27
+      getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
28
+    } else {
29
+      localStorage.setItem("helpActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
30
+      getList({ pageNum: 1, pageSize: 10 });
31
+    }
22 32
   },[])
23 33
 
24 34
   // 查询列表
@@ -164,7 +174,7 @@ const getJoinPeople = (helpActivityId) => () => {
164 174
               request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
165 175
                   console.log(data)
166 176
                   message.info('操作成功!')
167
-                  getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
177
+                  getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
168 178
               }).catch((err) => {
169 179
                   console.log(err)
170 180
                   message.info(err.msg || err.message)
@@ -185,7 +195,7 @@ const getJoinPeople = (helpActivityId) => () => {
185 195
         request({ ...apis.helpActivity.top, data: { helpActivityId: row.helpActivityId, status: code } }).then((data) => {
186 196
           console.log(data)
187 197
           message.info('操作成功!')
188
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
198
+          getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
189 199
           }).catch((err) => {
190 200
               console.log(err)
191 201
               message.info(err.msg || err.message)
@@ -211,7 +221,7 @@ const getJoinPeople = (helpActivityId) => () => {
211 221
       onOk() {
212 222
         request({ ...apis.helpActivity.cancel, urlData: {id: row.helpActivityId}}).then((data) => {
213 223
           message.info('操作成功!')
214
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
224
+          getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
215 225
       }).catch((err) => {
216 226
           console.log(err)
217 227
           message.info(err.msg || err.message)
@@ -229,7 +239,7 @@ const getJoinPeople = (helpActivityId) => () => {
229 239
       onOk() {
230 240
         request({ ...apis.helpActivity.send, urlData: {id: row.helpActivityId}}).then((data) => {
231 241
         message.info('操作成功!')
232
-        getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
242
+        getList(JSON.parse(localStorage.getItem("helpActivePageParams")))
233 243
     }).catch(err => {
234 244
         console.log(err)
235 245
         message.info(err.msg || err.message)
@@ -239,6 +249,7 @@ const getJoinPeople = (helpActivityId) => () => {
239 249
   }
240 250
   
241 251
   const changePageNum = pageNumber => {
252
+    localStorage.setItem("helpActivePageParams", JSON.stringify({pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() }));
242 253
       getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
243 254
   }
244 255
 
@@ -252,6 +263,8 @@ const handleSubmit = (e, props) => {
252 263
 
253 264
       if (!err) {
254 265
         console.log('提交数据: ', values)
266
+        localStorage.setItem("helpActivePageParams", JSON.stringify({  pageNum: 1, pageSize: 10, ...values, endDate, startDate  }));
267
+        
255 268
         getList({ pageNum: 1, pageSize: 10, ...values, endDate, startDate })
256 269
       }
257 270
     });
@@ -259,6 +272,7 @@ const handleSubmit = (e, props) => {
259 272
    // 重置搜索
260 273
    function handleReset() {
261 274
     props.form.resetFields();
275
+    localStorage.setItem("helpActivePageParams", JSON.stringify({  pageNum: 1, pageSize: 10 }));
262 276
     getList({ pageNum: 1, pageSize: 10 })
263 277
   }
264 278
 
@@ -329,6 +343,10 @@ const handleSubmit = (e, props) => {
329 343
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
330 344
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
331 345
       </div>
346
+      <Prompt message={location =>
347
+        location.pathname.startsWith("/activity/helpActivity")
348
+          ? true
349
+          : localStorage.removeItem("helpActivePageParams")} />
332 350
     </>
333 351
   )
334 352
 }

+ 5
- 0
src/pages/activity/liveActivity/add/index.jsx Целия файл

@@ -14,6 +14,7 @@ import Wangedit from '../../../../components/Wangedit/Wangedit'
14 14
 import apis from '../../../../services/apis';
15 15
 import request from '../../../../utils/request';
16 16
 import AuthButton from '@/components/AuthButton';
17
+import Prompt from 'umi/prompt';
17 18
 
18 19
 const { Option } = Select;
19 20
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
@@ -167,6 +168,10 @@ const header = props => {
167 168
           </Button>
168 169
         </Form.Item>
169 170
       </Form>
171
+      <Prompt message={location =>
172
+        location.pathname.startsWith("/activity/liveActivity")
173
+          ? true
174
+          : localStorage.removeItem("liveActivePageParams")} />
170 175
     </>
171 176
   )
172 177
 }

+ 5
- 0
src/pages/activity/liveActivity/edit/index.jsx Целия файл

@@ -10,6 +10,7 @@ import Poster from './components/poster'
10 10
 import Share from './components/share'
11 11
 import ShareRecord from './components/shareRecord'
12 12
 import VisitRecord from './components/visitRecord'
13
+import Prompt from 'umi/prompt';
13 14
 
14 15
 
15 16
 const { Option } = Select
@@ -73,6 +74,10 @@ function EditHouse(props) {
73 74
         { (tab === 'shareRecord' && <ShareRecord liveActivityId={{ liveId }}/>)}
74 75
         { (tab === 'visitRecord' && <VisitRecord liveActivityId={{ liveId }}/>)}
75 76
       </div>
77
+      <Prompt message={location =>
78
+        location.pathname.startsWith("/activity/liveActivity")
79
+          ? true
80
+          : localStorage.removeItem("liveActivePageParams")} />
76 81
     </>
77 82
   )
78 83
 }

+ 20
- 3
src/pages/activity/liveActivity/list/index.jsx Целия файл

@@ -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
 // import SaleBatchListHelpDoc from '../edit/components/SalesBatchListHelpDoc';
13 14
 
14 15
 const { Option } = Select;
@@ -32,7 +33,17 @@ const header = props => {
32 33
 
33 34
   // eslint-disable-next-line react-hooks/rules-of-hooks
34 35
   useEffect(() => {
35
-    getList({ pageNum: 1, pageSize: 10 });
36
+
37
+    if (localStorage.getItem("liveActivePageParams")) {
38
+      props.form.setFieldsValue(JSON.parse(localStorage.getItem("liveActivePageParams")));
39
+      // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
40
+
41
+      getList(JSON.parse(localStorage.getItem("liveActivePageParams")))
42
+    } else {
43
+      localStorage.setItem("liveActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
44
+      getList({ pageNum: 1, pageSize: 10 });
45
+    }
46
+   
36 47
   }, [])
37 48
 
38 49
   // 跳转到编辑
@@ -74,7 +85,7 @@ const header = props => {
74 85
       onOk () {
75 86
         request({ ...apis.taliveActivity.deleteTaLiveActivity, data: liveIdList, }).then((data) => {
76 87
           message.info("操作成功")
77
-          getList({ pageNum: 1, pageSize: 10 });
88
+          getList(JSON.parse(localStorage.getItem("liveActivePageParams")))
78 89
         }).catch((err) => {
79 90
           // message.info(err.msg)
80 91
         })
@@ -185,6 +196,7 @@ const header = props => {
185 196
   }
186 197
 
187 198
   const changePageNum = pageNumber => {
199
+    localStorage.setItem("liveActivePageParams", JSON.stringify({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() }));
188 200
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
189 201
   }
190 202
 
@@ -206,7 +218,7 @@ const header = props => {
206 218
         } else {
207 219
           values.time = null
208 220
         }
209
-        
221
+        localStorage.setItem("liveActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10, ...values }));
210 222
         getList({ pageNum: 1, pageSize: 10, ...values })
211 223
       }
212 224
     });
@@ -216,6 +228,7 @@ const header = props => {
216 228
   function handleReset () {
217 229
     props.form.resetFields();
218 230
     setTime('')
231
+    localStorage.setItem("liveActivePageParams", JSON.stringify({ pageNum: 1, pageSize: 10 }));
219 232
     getList({ pageNum: 1, pageSize: 10 })
220 233
   }
221 234
 
@@ -284,6 +297,10 @@ const header = props => {
284 297
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
285 298
       </div>
286 299
       {/* <SaleBatchListHelpDoc visible={showHelp} onCancel={() => setShowHelp(false)} /> */}
300
+      <Prompt message={location =>
301
+        location.pathname.startsWith("/activity/liveActivity")
302
+          ? true
303
+          : localStorage.removeItem("liveActivePageParams")} />
287 304
     </>
288 305
   )
289 306
 }