Bladeren bron

Merge branch 'dev1.0' of http://git.ycjcjy.com/civilized_city/miniapp into dev1.0

fangmingyue 2 jaren geleden
bovenliggende
commit
c3d81dc832

+ 2
- 2
config/dev.js Bestand weergeven

@@ -3,8 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"',
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"http://127.0.0.1:9087"',
7
-    HOST: '"http://192.168.89.147:9087"',
6
+    HOST: '"http://127.0.0.1:9087"',
7
+    // HOST: '"http://192.168.89.147:9087"',
8 8
     AD_IMAGE: '"https://h5.njyunzhi.com/images/citizen_banner.png"',
9 9
     DEFAULT_POS: '"116.3476917447715,31.409912844296578"', // 霍山县人民政府 gcj02
10 10
     VERSION: '"1.1.13-20230325"',

+ 1
- 1
config/prod.js Bestand weergeven

@@ -6,7 +6,7 @@ module.exports = {
6 6
     HOST: '"https://wmcj.huoshannews.com"',
7 7
     AD_IMAGE: '"https://h5.njyunzhi.com/images/citizen_banner.png"',
8 8
     DEFAULT_POS: '"116.3476917447715,31.409912844296578"', // 霍山县人民政府 gcj02
9
-    VERSION: '"1.1.15-20230328"',
9
+    VERSION: '"1.1.18-20230404"',
10 10
   },
11 11
   mini: {},
12 12
   h5: {

+ 1
- 0
src/components/IssueCard/index.jsx Bestand weergeven

@@ -12,6 +12,7 @@ const colors = [
12 12
   ['rgba(251, 157, 75, 0.08)', 'rgba(232, 116, 16, 1)'], // 已办结
13 13
   ['rgba(255, 245, 245, 1)', 'rgba(255, 76, 76, 1)'], // 已逾期
14 14
   ['transparent', 'rgba(159, 159, 159, 1)'], // 已打回
15
+  ['rgba(255, 245, 245, 1)', 'rgba(255, 76, 76, 1)'], // 逾期办结
15 16
 ]
16 17
 
17 18
 export default (props) => {

+ 57
- 29
src/components/PowerList/index.jsx Bestand weergeven

@@ -3,19 +3,19 @@ import Taro from "@tarojs/taro";
3 3
 import { View } from "@tarojs/components";
4 4
 import { PowerScrollView } from "@antmjs/vantui";
5 5
 import useShow from "@/layouts/hooks/useShow";
6
+import useHide from "@/layouts/hooks/useHide";
7
+import { throttle } from "@/utils/tools";
6 8
 
7 9
 export default React.forwardRef((props, ref) => {
8
-  const { request, params, renderItem, onLoadingChange, onDataChange } = props;
10
+  const { sid, request, params, renderItem, onLoadingChange, onDataChange } = props;
9 11
 
10 12
   const pageSize = 5;
11
-  const pageNumRef = React.useRef(0);
13
+  const pageShowRef = React.useRef(false);
12 14
   const [loading, setLoading] = React.useState(false);
13 15
   const [list, setList] = React.useState([]);
14 16
   const [finished, setFinished] = React.useState(true);
15 17
   const listRef = React.useRef([]);
16
-  const paramsRef = React.useRef();
17 18
   listRef.current = list;
18
-  paramsRef.current = params || {};
19 19
 
20 20
   const changeLoading = (val) => {
21 21
     setLoading(val);
@@ -24,17 +24,19 @@ export default React.forwardRef((props, ref) => {
24 24
     }
25 25
   };
26 26
 
27
-  const queryData = React.useCallback(
27
+  const queryData = React.useMemo(() => throttle(
28 28
     (options = {}) => {
29 29
       return new Promise((resolve, reject) => {
30 30
         changeLoading(true);
31
-        request({
31
+
32
+        const queryParams = {
32 33
           pageSize,
33
-          ...paramsRef.current,
34 34
           ...options,
35
-        })
35
+        }
36
+
37
+        request(queryParams)
36 38
           .then((res) => {
37
-            const { records, current, pages } = res;
39
+            const { records, current, total } = res;
38 40
 
39 41
             let dataset =
40 42
               current == 1
@@ -45,51 +47,77 @@ export default React.forwardRef((props, ref) => {
45 47
             }
46 48
             setList(dataset);
47 49
 
48
-            setFinished(current >= pages);
50
+            setFinished(dataset.length >= total);
49 51
             changeLoading(false);
50 52
             resolve();
53
+
54
+            // 写入缓存
55
+            Taro.setStorage({
56
+              key: `list-${sid}`,
57
+              data: JSON.stringify({
58
+                params: queryParams,
59
+              }),
60
+            })
61
+
51 62
           })
52 63
           .catch((err) => {
53 64
             changeLoading(false);
54 65
             reject(err);
55 66
           });
56 67
       });
57
-    },
68
+    }),
58 69
     []
59 70
   );
60 71
 
61
-  const refresh = React.useCallback(() => {
62
-    console.log(pageNumRef);
63
-    pageNumRef.current = 1;
64
-
65
-    queryData({ pageNum: pageNumRef.current });
66
-    console.log("refresh" + pageNumRef.current);
67
-  }, [queryData]);
72
+  const refresh = React.useCallback((options = {}) => {
73
+    queryData({ ...options, pageNum: 1 });
74
+  }, []);
68 75
 
69 76
   const onScrollToLower = React.useCallback(
70
-    (event = 0, isRefresh = false) => {
71
-      console.log("onScrollToLower" + pageNumRef.current);
72
-      pageNumRef.current += 1;
73
-      queryData({ pageNum: pageNumRef.current });
77
+    (page) => {
78
+      const currentPage = Math.ceil(page / pageSize);
79
+      queryData({ pageNum: currentPage + 1, ...(params || {}) });
74 80
     },
75
-    []
81
+    [params]
76 82
   );
77 83
 
78 84
   useShow(() => {
79
-    refresh();
85
+    pageShowRef.current = true;
86
+
87
+    const paramStr = Taro.getStorageSync(`list-${sid}`);
88
+    const finalParams = paramStr ? JSON.parse(paramStr).params : { ...params || {} };
89
+
90
+    // 如果已经加载多页数据
91
+    // 那么需要重新加载
92
+    if (finalParams.pageNum && finalParams.pageNum > 1) {
93
+      finalParams.pageSize = finalParams.pageNum * finalParams.pageSize;
94
+      finalParams.pageNum = 1;
95
+    }
96
+
97
+    refresh(finalParams);
80 98
   });
81 99
 
100
+  useHide(() => {
101
+    pageShowRef.current = false;
102
+  });
82 103
   
83 104
   React.useEffect(() => {
84
-    refresh();
85
-  }, [refresh, params]);
105
+    if (pageShowRef.current) {
106
+      refresh(params);
107
+    }
108
+  }, [params]);
86 109
 
87 110
   React.useImperativeHandle(ref, () => ({
88
-    refresh,
111
+    refresh: () => refresh(params),
89 112
     updateData: (dt) => setList(dt),
90
-  }));
91
- 
113
+  }), [params]);
92 114
 
115
+  React.useEffect(() => {
116
+    return () => {
117
+      Taro.removeStorageSync(`list-${sid}`);
118
+    }
119
+  }, []);
120
+ 
93 121
   return (
94 122
     <PowerScrollView
95 123
       scrollY

+ 11
- 20
src/layouts/hooks/useHide.js Bestand weergeven

@@ -1,34 +1,25 @@
1 1
 import React from "react";
2
-import evtBus from '@/utils/event_bus';
2
+import Taro from '@tarojs/taro';
3 3
 
4 4
 /**
5 5
  * 页面显示, 隐藏 hook, 可以在 component 中使用
6 6
  */
7
-export default (fn, deps) => {
7
+export default (fn) => {
8 8
   const fnRef = React.useRef();
9 9
   fnRef.current = fn;
10 10
 
11
-  const [evt, func] = React.useMemo(() => {
12
-    const evt1 = evtBus.current();
13
-    const func1 = () => fnRef.current();
11
+  const evt = React.useMemo(() => {
12
+    const _evt = Taro.getCurrentInstance().router.onHide;
13
+    Taro.eventCenter.on(_evt, () => fnRef.current());
14 14
 
15
-    evt1.addEventListener('hide', func1);
16
-    evt1.addEventListener('unload', func1);
17
-
18
-    return [
19
-      evt1,
20
-      func1,
21
-    ];
15
+    return _evt;
22 16
   }, []);
23 17
 
24 18
   React.useEffect(() => {
25
-    evt.addEventListener('hide', func);
26
-    evt.addEventListener('unload', func);
27
-
28 19
     return () => {
29
-      evt.removeEventListener('hide', func);
30
-      evt.removeEventListener('unload', func);
31
-    };
32
-    // eslint-disable-next-line react-hooks/exhaustive-deps
33
-  }, deps);
20
+      fnRef.current(); // 卸载的时候也执行一次
21
+      Taro.eventCenter.off(evt);
22
+    }
23
+  }, []);
34 24
 }
25
+

+ 9
- 17
src/layouts/hooks/useShow.js Bestand weergeven

@@ -1,31 +1,23 @@
1 1
 import React from "react";
2
-import evtBus from '@/utils/event_bus';
2
+import Taro from '@tarojs/taro';
3 3
 
4 4
 /**
5 5
  * 页面显示, 隐藏 hook, 可以在 component 中使用
6 6
  */
7
-export default (fn, deps) => {
7
+export default (fn) => {
8 8
   const fnRef = React.useRef();
9 9
   fnRef.current = fn;
10 10
 
11
-  const [evt, func] = React.useMemo(() => {
12
-    const evt1 = evtBus.current();
13
-    const func1 = () => console.log('--show-->') || fnRef.current();
11
+  const evt = React.useMemo(() => {
12
+    const _evt = Taro.getCurrentInstance().router.onShow;
13
+    Taro.eventCenter.on(_evt, () => fnRef.current());
14 14
 
15
-    evt1.addEventListener('show', func1);
16
-
17
-    return [
18
-      evt1,
19
-      func1,
20
-    ];
15
+    return _evt;
21 16
   }, []);
22 17
 
23 18
   React.useEffect(() => {
24
-    evt.addEventListener('show', func);
25
-
26 19
     return () => {
27
-      evt.removeEventListener('show', func);
28
-    };
29
-    // eslint-disable-next-line react-hooks/exhaustive-deps
30
-  }, deps);
20
+      Taro.eventCenter.off(evt);
21
+    }
22
+  }, []);
31 23
 }

+ 0
- 25
src/layouts/index.jsx Bestand weergeven

@@ -5,7 +5,6 @@ import { useModel } from '@/store';
5 5
 import { Loading, Notify, Dialog } from '@antmjs/vantui';
6 6
 import NavLoading from '@/components/NavLoading';
7 7
 import Auth from '@/components/Auth';
8
-import evtBus from '@/utils/event_bus';
9 8
 import TabBar from './TabBar';
10 9
 import laySty from './layout.module.less';
11 10
 
@@ -15,10 +14,6 @@ export default (props) => {
15 14
   const { person, user, duty } = useModel('user');
16 15
   const containerClass = `${laySty['page-conatiner']} ${tabBar ? laySty['with-tabbar'] : ''} ${className}`;
17 16
 
18
-  const evt = React.useMemo(() => {
19
-    return evtBus.current();
20
-  }, []);
21
-
22 17
   React.useEffect(() => {
23 18
     if (person && !user) {
24 19
       const currentPage = Taro.getCurrentPages().slice().pop();
@@ -36,26 +31,6 @@ export default (props) => {
36 31
     };
37 32
   });
38 33
 
39
-  Taro.useDidShow(() => {
40
-    // useDidShow 比 React Hook 要早
41
-    // 所以使用 nextTick
42
-    Taro.nextTick(() => {
43
-      evt.dispatchEvent('show');
44
-    });
45
-  });
46
-
47
-  Taro.useDidHide(() => {
48
-    Taro.nextTick(() => {
49
-      evt.dispatchEvent('hide');
50
-    });
51
-  })
52
-
53
-  Taro.useUnload(() => {
54
-    Taro.nextTick(() => {
55
-      evt.dispatchEvent('unload');
56
-    });
57
-  })
58
-
59 34
   return (
60 35
       <View className={laySty['page-wrapper']}>
61 36
         <Notify id="vanNotify" />

+ 14
- 2
src/pages/apply/list/index.jsx Bestand weergeven

@@ -14,6 +14,9 @@ const tabStyle = {
14 14
   overflow: "hidden",
15 15
 };
16 16
 
17
+const sid1 = Math.random().toString(36).substring(2, 8);
18
+const sid2 = Math.random().toString(36).substring(2, 8);
19
+
17 20
 export default (props) => {
18 21
   const router = Taro.useRouter();
19 22
   const { title, applyType = "" } = router.params;
@@ -31,6 +34,13 @@ export default (props) => {
31 34
 
32 35
   const { user } = useModel("user");
33 36
 
37
+  const [param1, param2] = React.useMemo(() => {
38
+    return [
39
+      { applyType, sourceType: "inspector", duty, issueId },
40
+      { applyType, sourceType: "feedback", duty }
41
+    ]
42
+  }, [applyType, issueId, duty]);
43
+
34 44
   const onClick = (item) => {
35 45
     if (!user) return;
36 46
 
@@ -66,8 +76,9 @@ export default (props) => {
66 76
       <Tabs sticky>
67 77
         <Tab title="督查员" style={tabStyle}>
68 78
           <PowerList
79
+            sid={sid1}
69 80
             request={getTaIssueApply}
70
-            params={{ applyType, sourceType: "inspector", duty, issueId }}
81
+            params={param1}
71 82
             renderItem={(item) => (
72 83
               <Card
73 84
                 key={item.applyId}
@@ -80,8 +91,9 @@ export default (props) => {
80 91
         </Tab>
81 92
         <Tab title="市民" style={tabStyle}>
82 93
           <PowerList
94
+            sid={sid2}
83 95
             request={getTaIssueApply}
84
-            params={{ applyType, sourceType: "feedback", duty }}
96
+            params={param2}
85 97
             renderItem={(item) => (
86 98
               <Card
87 99
                 key={item.applyId}

+ 3
- 0
src/pages/check/list/index.jsx Bestand weergeven

@@ -9,6 +9,8 @@ import { getTaCheck } from '@/services/tacheck';
9 9
 import Card from './components/Card';
10 10
 
11 11
 const queryParams = {isValid: true};
12
+const sid1 = Math.random().toString(36).substring(2, 8);
13
+
12 14
 export default (props) => {
13 15
 
14 16
   const onClick = (typ, item) => {
@@ -26,6 +28,7 @@ export default (props) => {
26 28
   return (
27 29
     <Page roles={[ROLE_INSPECTOR]}>
28 30
       <PowerList
31
+        sid={sid1}
29 32
         request={getTaCheck}
30 33
         params={queryParams}
31 34
         renderItem={item => (

+ 3
- 0
src/pages/check/loc/list/index.jsx Bestand weergeven

@@ -7,6 +7,8 @@ import PowerList from '@/components/PowerList';
7 7
 import { getTaCheckItem } from '@/services/tacheckitem';
8 8
 import { ROLE_INSPECTOR } from '@/utils/user';
9 9
 
10
+const sid1 = Math.random().toString(36).substring(2, 8);
11
+
10 12
 export default (props) => {
11 13
 
12 14
   const router = Taro.useRouter();
@@ -38,6 +40,7 @@ export default (props) => {
38 40
   return (
39 41
     <Page loading={loading} roles={[ROLE_INSPECTOR]}>
40 42
       <PowerList
43
+        sid={sid1}
41 44
         request={getTaCheckItem}
42 45
         params={params}
43 46
         renderItem={item => {

+ 3
- 0
src/pages/checkStand/list/index.jsx Bestand weergeven

@@ -7,6 +7,8 @@ import PowerList from "@/components/PowerList";
7 7
 import { getTaCheckStand } from "@/services/tacheckstand";
8 8
 import { ROLE_INSPECTOR } from "@/utils/user";
9 9
 
10
+const sid1 = Math.random().toString(36).substring(2, 8);
11
+
10 12
 export default (props) => {
11 13
   const router = Taro.useRouter();
12 14
   const { checkId } = router.params;
@@ -40,6 +42,7 @@ export default (props) => {
40 42
   return (
41 43
     <Page tabBar="check" loading={loading}>
42 44
       <PowerList
45
+        sid={sid1}
43 46
         request={getTaCheckStand}
44 47
         params={params}
45 48
         renderItem={(item) => {

+ 8
- 1
src/pages/feedback/issuelist/index.jsx Bestand weergeven

@@ -7,11 +7,17 @@ import Card from '@/components/IssueCard';
7 7
 import { getTaFeedback } from '@/services/tafeedback';
8 8
 import { getIssueStatus } from '@/utils/biz';
9 9
 
10
+const sid1 = Math.random().toString(36).substring(2, 8);
11
+
10 12
 export default (props) => {
11 13
 
12 14
   const router = Taro.useRouter();
13 15
   const { title, bizStatus = '' } = router.params;
14 16
 
17
+  const params = React.useMemo(() => {
18
+    return {bizStatus, isMine: true};
19
+  }, [bizStatus]);
20
+
15 21
   React.useMemo(() => {
16 22
     if (title) {
17 23
       Taro.setNavigationBarTitle({ title });
@@ -29,8 +35,9 @@ export default (props) => {
29 35
   return (
30 36
     <Page>
31 37
       <PowerList
38
+        sid={sid1}
32 39
         request={getTaFeedback}
33
-        params={{bizStatus, isMine: true}}
40
+        params={params}
34 41
         renderItem={(item) => (
35 42
           <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
36 43
         )}

+ 5
- 3
src/pages/home/components/StatCard.jsx Bestand weergeven

@@ -9,6 +9,8 @@ export default React.forwardRef((props, ref) => {
9 9
   const { duty } = props;
10 10
 
11 11
   const [list, setList] = React.useState([]);
12
+  const dutyRef = React.useRef();
13
+  dutyRef.current = duty;
12 14
 
13 15
   const classNames = React.useMemo(() => {
14 16
     return [
@@ -32,10 +34,10 @@ export default React.forwardRef((props, ref) => {
32 34
   }), [duty]);
33 35
 
34 36
   useShow(() => {
35
-    if (duty) {
36
-      getIndexData(duty).then(setList);
37
+    if (dutyRef.current) {
38
+      getIndexData(dutyRef.current).then(setList);
37 39
     }
38
-  }, [duty]);
40
+  });
39 41
 
40 42
   return (
41 43
     <View className={classNames}>

+ 37
- 6
src/pages/issue/list/index.jsx Bestand weergeven

@@ -15,6 +15,13 @@ const tabStyle = {
15 15
   overflow: 'hidden',
16 16
 }
17 17
 
18
+const sid1 = Math.random().toString(36).substring(2, 8);
19
+const sid2 = Math.random().toString(36).substring(2, 8);
20
+const sid3 = Math.random().toString(36).substring(2, 8);
21
+const sid4 = Math.random().toString(36).substring(2, 8);
22
+const sid5 = Math.random().toString(36).substring(2, 8);
23
+const sid6 = Math.random().toString(36).substring(2, 8);
24
+
18 25
 // 只有督查员能看到当前页面
19 26
 export default (props) => {
20 27
   // const { user } = useModel('user');
@@ -24,6 +31,24 @@ export default (props) => {
24 31
 
25 32
   const [active, setActive] = React.useState(0);
26 33
 
34
+  const [
35
+    param1,
36
+    param2,
37
+    param3,
38
+    param4,
39
+    param5,
40
+    param6,
41
+  ] = React.useMemo(() => {
42
+    return [
43
+      { mine },
44
+      { mine, bizStatus: PROCESS_START },
45
+      { mine, bizStatus: PROCESS_ASSIGNED },
46
+      { mine, bizStatus: PROCESS_END },
47
+      { mine, bizStatus: 'expired' },
48
+      { mine, bizStatus: 'reject' },
49
+    ];
50
+  }, [mine])
51
+
27 52
   const onClick = (item) => {
28 53
     Taro.navigateTo({
29 54
       url: `/pages/issue/edit/index?id=${item.issueId}`
@@ -41,8 +66,9 @@ export default (props) => {
41 66
         <Tab title="全部" style={tabStyle}>
42 67
           {active == 0 && (
43 68
             <PowerList
69
+              sid={sid1}
44 70
               request={getTaIssue}
45
-              params={{ mine }}
71
+              params={param1}
46 72
               renderItem={(item) => (
47 73
                 <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
48 74
               )}
@@ -52,8 +78,9 @@ export default (props) => {
52 78
         <Tab title="未交办" style={tabStyle}>
53 79
         {active == 1 && (
54 80
           <PowerList
81
+            sid={sid2}
55 82
             request={getTaIssue}
56
-            params={{ mine, bizStatus: PROCESS_START }}
83
+            params={param2}
57 84
             renderItem={(item) => (
58 85
               <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
59 86
             )}
@@ -63,8 +90,9 @@ export default (props) => {
63 90
         <Tab title="已交办" style={tabStyle}>
64 91
           {active == 2 && (
65 92
           <PowerList
93
+            sid={sid3}
66 94
             request={getTaIssue}
67
-            params={{ mine, bizStatus: PROCESS_ASSIGNED }}
95
+            params={param3}
68 96
             renderItem={(item) => (
69 97
               <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
70 98
             )}
@@ -74,8 +102,9 @@ export default (props) => {
74 102
         <Tab title="已办结" style={tabStyle}>
75 103
           {active == 3 && (
76 104
           <PowerList
105
+            sid={sid4}
77 106
             request={getTaIssue}
78
-            params={{ mine, bizStatus: PROCESS_END }}
107
+            params={param4}
79 108
             renderItem={(item) => (
80 109
               <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
81 110
             )}
@@ -85,8 +114,9 @@ export default (props) => {
85 114
         <Tab title="已逾期" style={tabStyle}>
86 115
           {active == 4 && (
87 116
           <PowerList
117
+            sid={sid5}
88 118
             request={getTaIssue}
89
-            params={{ mine, bizStatus: 'expired' }}
119
+            params={param5}
90 120
             renderItem={(item) => (
91 121
               <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
92 122
             )}
@@ -96,8 +126,9 @@ export default (props) => {
96 126
         <Tab title="已打回" style={tabStyle}>
97 127
           {active == 5 && (
98 128
           <PowerList
129
+            sid={sid6}
99 130
             request={getTaIssue}
100
-            params={{ mine, bizStatus: 'reject' }}
131
+            params={param6}
101 132
             renderItem={(item) => (
102 133
               <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
103 134
             )}

+ 15
- 2
src/pages/issue/list2/index.jsx Bestand weergeven

@@ -16,6 +16,9 @@ const tabStyle = {
16 16
   overflow: "hidden",
17 17
 };
18 18
 
19
+const sid1 = Math.random().toString(36).substring(2, 8);
20
+const sid2 = Math.random().toString(36).substring(2, 8);
21
+
19 22
 export default (props) => {
20 23
   const router = Taro.useRouter();
21 24
   const { title, bizStatus = "", mine = "" } = router.params;
@@ -28,6 +31,13 @@ export default (props) => {
28 31
     }
29 32
   }, [title]);
30 33
 
34
+  const [param1, param2] = React.useMemo(() => {
35
+    return [
36
+      {bizStatus, mine, sourceType: "inspector", issueId},
37
+      {bizStatus, mine, sourceType: "feedback"},
38
+    ];
39
+  }, [mine, bizStatus, issueId]);
40
+
31 41
   const { user } = useModel("user");
32 42
 
33 43
   const onClick = (item) => {
@@ -40,6 +50,7 @@ export default (props) => {
40 50
     console.log(value);
41 51
     setIssueId(value);
42 52
   };
53
+
43 54
   return (
44 55
     <Page>
45 56
       <Search
@@ -51,8 +62,9 @@ export default (props) => {
51 62
       <Tabs sticky>
52 63
         <Tab title="督查员" style={tabStyle}>
53 64
           <PowerList
65
+            sid={sid1}
54 66
             request={getTaIssue}
55
-            params={{ bizStatus, mine, sourceType: "inspector", issueId }}
67
+            params={param1}
56 68
             renderItem={(item) => (
57 69
               <Card
58 70
                 key={item.issueId}
@@ -64,8 +76,9 @@ export default (props) => {
64 76
         </Tab>
65 77
         <Tab title="市民" style={tabStyle}>
66 78
           <PowerList
79
+            sid={sid2}
67 80
             request={getTaIssue}
68
-            params={{ bizStatus, mine, sourceType: "feedback" }}
81
+            params={param2}
69 82
             renderItem={(item) => (
70 83
               <Card
71 84
                 key={item.issueId}

+ 4
- 0
src/pages/message/list/index.jsx Bestand weergeven

@@ -7,12 +7,16 @@ import { getTaMessage } from '@/services/tamessage';
7 7
 import { useModel } from '@/store';
8 8
 import Card from './components/Card';
9 9
 
10
+const sid1 = Math.random().toString(36).substring(2, 8);
11
+// const sid2 = Math.random().toString(36).substring(2, 8);
12
+
10 13
 export default (props) => {
11 14
   const { duty } = useModel('user');
12 15
   
13 16
   return (
14 17
     <Page>
15 18
       <PowerList
19
+        sid={sid1}
16 20
         request={getTaMessage}
17 21
         renderItem={(item) => (
18 22
           <Card key={item.msgId} item={item} duty={duty} />

+ 9
- 1
src/pages/notice/index.jsx Bestand weergeven

@@ -4,15 +4,23 @@ import PowerList from '@/components/PowerList';
4 4
 import { getTaNotice } from '@/services/tanotice';
5 5
 import Card from './components/Card/index';
6 6
 
7
+const sid1 = Math.random().toString(36).substring(2, 8);
8
+// const sid2 = Math.random().toString(36).substring(2, 8);
9
+
7 10
 export default (props) => {
8 11
 
9 12
   const [loading, setLoading] = React.useState(false);
10 13
 
14
+  const params = React.useMemo(() => {
15
+    return {status: 1};
16
+  }, []);
17
+
11 18
   return (
12 19
     <Page tabBar="notice">
13 20
       <PowerList
21
+        sid={sid1}
14 22
         request={getTaNotice}
15
-        params={{status: 1}}
23
+        params={params}
16 24
         renderItem={(item) => (
17 25
           <Card key={item.noticeId} dataset={item} />
18 26
         )}

+ 15
- 2
src/pages/org/issue/list/index.jsx Bestand weergeven

@@ -15,10 +15,14 @@ const tabStyle = {
15 15
   overflow: "hidden",
16 16
 };
17 17
 
18
+const sid1 = Math.random().toString(36).substring(2, 8);
19
+const sid2 = Math.random().toString(36).substring(2, 8);
20
+
18 21
 export default (props) => {
19 22
   const router = Taro.useRouter();
20 23
   const { title, bizStatus, color } = router.params;
21 24
   const [issueId, setIssueId] = useState("");
25
+
22 26
   React.useMemo(() => {
23 27
     if (title) {
24 28
       Taro.setNavigationBarTitle({ title });
@@ -29,6 +33,13 @@ export default (props) => {
29 33
 
30 34
   // const { user } = useModel('user');
31 35
 
36
+  const [param1, param2] = React.useMemo(() => {
37
+    return [
38
+      { bizStatus, sourceType: "inspector" ,issueId},
39
+      { bizStatus, sourceType: "feedback" },
40
+    ];
41
+  }, [bizStatus, issueId]);
42
+
32 43
   const onClick = (item) => {
33 44
     Taro.navigateTo({
34 45
       url: `/pages/org/issue/detail/index?id=${item.issueId}`,
@@ -55,8 +66,9 @@ export default (props) => {
55 66
       <Tabs sticky>
56 67
         <Tab title="督查员" style={tabStyle}>
57 68
           <PowerList
69
+            sid={sid1}
58 70
             request={getTaOrgIssue}
59
-            params={{ bizStatus, sourceType: "inspector" ,issueId}}
71
+            params={param1}
60 72
             renderItem={(item) => (
61 73
               <Card
62 74
                 key={item.issueId}
@@ -70,8 +82,9 @@ export default (props) => {
70 82
         </Tab>
71 83
         <Tab title="市民" style={tabStyle}>
72 84
           <PowerList
85
+            sid={sid2}
73 86
             request={getTaOrgIssue}
74
-            params={{ bizStatus, sourceType: "feedback" }}
87
+            params={param2}
75 88
             renderItem={(item) => (
76 89
               <Card
77 90
                 key={item.issueId}

+ 4
- 0
src/pages/user/list/index.jsx Bestand weergeven

@@ -8,6 +8,9 @@ import PowerList from "@/components/PowerList";
8 8
 import { getSysUser, deleteSysUser } from "@/services/sysuser";
9 9
 import styles from "./index.module.less";
10 10
 
11
+const sid1 = Math.random().toString(36).substring(2, 8);
12
+// const sid2 = Math.random().toString(36).substring(2, 8);
13
+
11 14
 export default (props) => {
12 15
   const [loading, setLoading] = React.useState(false);
13 16
   const listRef = React.useRef();
@@ -52,6 +55,7 @@ export default (props) => {
52 55
       <view className={styles["user-warpper"]}>
53 56
         <view className={styles["user-warpper-list"]}>
54 57
           <PowerList
58
+            sid={sid1}
55 59
             ref={listRef}
56 60
             request={getSysUser}
57 61
             onLoadingChange={setLoading}

+ 12
- 5
src/utils/biz.js Bestand weergeven

@@ -41,15 +41,17 @@ export function getIssueStatus(taIssue) {
41 41
       label: '待交办',
42 42
     }
43 43
   } else if (taIssue.processNode === PROCESS_END) {
44
+    if (dayjs(taIssue.expireDate).add(1,'day').format('YYYY-MM-DD') < dayjs().format('YYYY-MM-DD')) {
45
+      return {
46
+        value: 5,
47
+        label: '逾期办结',
48
+      };
49
+    }
50
+
44 51
     return {
45 52
       value: 2,
46 53
       label: '已办结',
47 54
     };
48
-  } else if (taIssue.processNode !== PROCESS_END && taIssue.expireDate <= dayjs().format('YYYY-MM-DD')) {
49
-    return {
50
-      value: 3,
51
-      label: '已逾期',
52
-    };
53 55
   } else if (taIssue.processNode.indexOf(PROCESS_ASSIGNED) === 0) {
54 56
     if (taIssue.processStatus === APPLY_READY) {
55 57
       if (taIssue.processNode === PROCESS_APPLY_REJECT) {
@@ -128,6 +130,11 @@ export function getIssueStatus(taIssue) {
128 130
       value: 1,
129 131
       label: '已交办',
130 132
     };
133
+  } else if (taIssue.processNode !== PROCESS_END && dayjs(taIssue.expireDate).add(1,'day').format('YYYY-MM-DD') < dayjs().format('YYYY-MM-DD')) {
134
+    return {
135
+      value: 3,
136
+      label: '已逾期',
137
+    };
131 138
   }
132 139
 
133 140
   return {};

+ 19
- 0
src/utils/tools.js Bestand weergeven

@@ -0,0 +1,19 @@
1
+
2
+// @fn 是对应请求数据
3
+// @ms 是用户多次触发事件的时间间隔 是一个毫秒数
4
+export function throttle(fn, ms = 800){
5
+  let flag = true;
6
+
7
+  return (...args) => {
8
+    if(!flag) return;
9
+
10
+    flag = false;
11
+    
12
+    const t = setTimeout(()=>{
13
+      clearTimeout(t);
14
+      flag = true
15
+    }, ms);
16
+
17
+    return fn(...args);
18
+  }
19
+}