|
@@ -1,6 +1,6 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react'
|
2
|
2
|
import { useModel } from '@/store'
|
3
|
|
-import Taro from '@tarojs/taro'
|
|
3
|
+import Taro, { useDidShow } from '@tarojs/taro'
|
4
|
4
|
import { Swiper, SwiperItem } from '@tarojs/components'
|
5
|
5
|
import WuYeBaoXiuItem from '@/components/WuYeBaoXiuItem/index'
|
6
|
6
|
import ScrollPageRefresh from '@/components/ScrollPageRefresh/index'
|
|
@@ -10,15 +10,21 @@ import '@/assets/css/reset.less'
|
10
|
10
|
import '@/assets/css/iconfont.less'
|
11
|
11
|
import './index.less'
|
12
|
12
|
|
13
|
|
-export default function WuYeBaoXiu () {
|
|
13
|
+export default function WuYeBaoXiu (props) {
|
14
|
14
|
|
15
|
15
|
const { user } = useModel('user')
|
16
|
16
|
const [PageList, setPageList] = useState([])
|
17
|
17
|
const [BannerList, setBannerList] = useState([])
|
18
|
18
|
const [IsEmpty, setIsEmpty] = useState(false)
|
|
19
|
+ const [Reset, setReset] = useState(false)
|
|
20
|
+ const { PageReset = false, StopReset = () => {} } = props
|
19
|
21
|
|
20
|
|
- Taro.useDidShow(() => {
|
21
|
|
- })
|
|
22
|
+ useEffect(() => {
|
|
23
|
+ console.log(PageReset, `11111`)
|
|
24
|
+ if (PageReset) {
|
|
25
|
+ setReset(true)
|
|
26
|
+ }
|
|
27
|
+ }, [PageReset])
|
22
|
28
|
|
23
|
29
|
const GetBanner = (done = () => { }) => { // 获取轮播图
|
24
|
30
|
request({ ...apis.getBanner, params: { showPosition: `property`, showType: 'banner', pageSize: 5, pageNum: 1 } }).then((res) => {
|
|
@@ -30,6 +36,7 @@ export default function WuYeBaoXiu () {
|
30
|
36
|
}
|
31
|
37
|
|
32
|
38
|
const Refresh = (e) => { // 下拉刷新
|
|
39
|
+ StopReset()
|
33
|
40
|
GetBanner()
|
34
|
41
|
if (e.length > 0) {
|
35
|
42
|
setIsEmpty(false)
|
|
@@ -46,9 +53,12 @@ export default function WuYeBaoXiu () {
|
46
|
53
|
return (
|
47
|
54
|
<view className='WuYeBaoXiu'>
|
48
|
55
|
<ScrollPageRefresh
|
|
56
|
+ AutoRequest={false}
|
|
57
|
+ Reset={Reset}
|
|
58
|
+ CloseReset={() => { setReset(false) }}
|
49
|
59
|
IsEmpty={IsEmpty}
|
50
|
|
- ApiName={`getGongDanList`}
|
51
|
|
- ListName={`pagelist`}
|
|
60
|
+ ApiName='getGongDanList'
|
|
61
|
+ ListName='pagelist'
|
52
|
62
|
RequestUrlData={{ orgId: user.orgId }}
|
53
|
63
|
RequestParams={{ type: 2 }}
|
54
|
64
|
Refresh={Refresh}
|