xcx преди 4 години
родител
ревизия
7e649c4dc2
променени са 3 файла, в които са добавени 30 реда и са изтрити 17 реда
  1. 16
    6
      src/components/WuYeBaoXiu/index.jsx
  2. 4
    10
      src/pages/WuYe/BaoXiuFeiYong/index.jsx
  3. 10
    1
      src/pages/WuYe/index.jsx

+ 16
- 6
src/components/WuYeBaoXiu/index.jsx Целия файл

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

+ 4
- 10
src/pages/WuYe/BaoXiuFeiYong/index.jsx Целия файл

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react'
2
-import Taro, { Current, useDidShow } from '@tarojs/taro'
2
+import Taro, { Current } from '@tarojs/taro'
3 3
 import SlidePopup from '@/components/SlidePopup/index'
4 4
 import UploadImg from '@/components/UploadImg/index'
5 5
 import Page from '@/layouts'
@@ -19,15 +19,9 @@ export default function BaoXiuFeiYong () {
19 19
   const [DetailInfo, setDetailInfo] = useState(null)
20 20
   const [BillInfo, setBillInfo] = useState(null)
21 21
 
22
-  // useEffect(() => {
23
-  //   Init()
24
-  // }, [CurrnetBaoXiuId])
25
-
26
-  useDidShow(() => {
27
-    if (CurrnetBaoXiuId !== null) {
28
-      Init()
29
-    }
30
-  })
22
+  useEffect(() => {
23
+    Init()
24
+  }, [CurrnetBaoXiuId])
31 25
 
32 26
   const Init = () => {
33 27
     request({ ...apis.getGongDanDetail, args: { orgId: user.orgId }, params: { ticketId: CurrnetBaoXiuId } }).then((res) => { // 获取工单详情

+ 10
- 1
src/pages/WuYe/index.jsx Целия файл

@@ -18,6 +18,7 @@ export default function WuYe () {
18 18
   const { user, setUser } = useModel('user')
19 19
   const [NavList] = useState([{ name: '公告', id: 1 }, { name: '服务', id: 2 }, { name: '报修', id: 3 }, { name: '缴费', id: 4 }])
20 20
   const [CurrentNavId, setCurrentNavId] = useState(null)
21
+  const [PageReset, setPageReset] = useState(false)
21 22
 
22 23
   useDidShow(() => {
23 24
     if (user.verifyStatus !== 'certified') {
@@ -39,6 +40,10 @@ export default function WuYe () {
39 40
           }
40 41
         }
41 42
       })
43
+    } else {
44
+      if (CurrentNavId - 0 === 3) {
45
+        setPageReset(true)
46
+      }
42 47
     }
43 48
   })
44 49
 
@@ -50,6 +55,10 @@ export default function WuYe () {
50 55
         } else {
51 56
           setCurrentNavId(1)
52 57
         }
58
+      } else {
59
+        if (CurrentNavId - 0 === 3) {
60
+          setPageReset(true)
61
+        }
53 62
       }
54 63
     }
55 64
   }, [CurrentNavId])
@@ -99,7 +108,7 @@ export default function WuYe () {
99 108
             {
100 109
               CurrentNavId - 0 === 3 &&
101 110
               <view className='Content BaoXiu'>
102
-                <WuYeBaoXiu></WuYeBaoXiu>
111
+                <WuYeBaoXiu PageReset={PageReset} StopReset={() => { setPageReset(false) }}></WuYeBaoXiu>
103 112
               </view>
104 113
             }
105 114