张涛 hace 11 meses
padre
commit
02e8969f56

+ 2
- 1
src/layouts/TabBar.jsx Ver fichero

@@ -83,7 +83,8 @@ export default (props) => {
83 83
 
84 84
     // 责任单位用户
85 85
     if (duty == ROLE_ORG_USER || duty == ROLE_ORG_MANAGER) {
86
-      return [home, notice,feedback, mine];
86
+      return [home, notice, mine];
87
+      // return [home, notice,feedback, mine];
87 88
     }
88 89
 
89 90
     if (duty == ROLE_CITIZEN) {

+ 32
- 23
src/layouts/index.jsx Ver fichero

@@ -12,28 +12,34 @@ import { useEffect } from "react";
12 12
 export default (props) => {
13 13
   const { className, style, roles, tabBar = false, loading } = props;
14 14
 
15
-  const { person, user, duty, current } = useModel('user');
15
+  const { person, user, duty, current } = useModel("user");
16 16
 
17 17
   const containerClass = `${laySty["page-conatiner"]} ${
18 18
     tabBar ? laySty["with-tabbar"] : ""
19 19
   } ${className}`;
20
+
21
+  const currentPage = Taro.getCurrentPages().slice().pop();
22
+  const isLoginPage = currentPage.route.includes("pages/login/index");
23
+
20 24
   React.useEffect(() => {
21
-    const currentPage = Taro.getCurrentPages().slice().pop();
25
+    //  currentPage = Taro.getCurrentPages().slice().pop();
22 26
 
23 27
     if (!user) {
24 28
       try {
25
-        current().then((res) => {
26
-          console.log('---当前人员----', res);
27
-        }).catch((err) => {
28
-          console.log('---当前人员--报错了--');
29
-          console.error(err);
30
-  
31
-          if (!currentPage.route.includes("pages/login/index")) {
32
-            Taro.navigateTo({
33
-              url: "/pages/login/index",
34
-            });
35
-          }
36
-        });
29
+        current()
30
+          .then((res) => {
31
+            console.log("---当前人员----", res);
32
+          })
33
+          .catch((err) => {
34
+            console.log("---当前人员--报错了--");
35
+            console.error(err);
36
+
37
+            if (!isLoginPage) {
38
+              Taro.navigateTo({
39
+                url: "/pages/login/index",
40
+              });
41
+            }
42
+          });
37 43
       } catch (error) {
38 44
         console.error(error);
39 45
       }
@@ -48,8 +54,7 @@ export default (props) => {
48 54
     //     return;
49 55
     //   }
50 56
     // }
51
-  }, [current, user]);
52
-
57
+  }, [current, user, isLoginPage]);
53 58
 
54 59
   // React.useEffect(() => {
55 60
   //   console.log("personRef******************");
@@ -80,12 +85,12 @@ export default (props) => {
80 85
   });
81 86
 
82 87
   useEffect(() => {
83
-      // 获取当前编码后的标题
84
-      var encodedTitle = document.title;
85
-      // 解码标题
86
-      var decodedTitle = decodeURIComponent(encodedTitle);
87
-      // 设置解码后的标题
88
-      document.title = decodedTitle;
88
+    // 获取当前编码后的标题
89
+    var encodedTitle = document.title;
90
+    // 解码标题
91
+    var decodedTitle = decodeURIComponent(encodedTitle);
92
+    // 设置解码后的标题
93
+    document.title = decodedTitle;
89 94
   }, []);
90 95
 
91 96
   return (
@@ -101,8 +106,12 @@ export default (props) => {
101 106
             </Loading>
102 107
           </View>
103 108
         )} */}
109
+        {/* {!isLoginPage ? (
110
+          <Auth roles={roles}>{props.children}</Auth>
111
+        ) : (
112
+          props.children
113
+        )} */}
104 114
         <Auth roles={roles}>{props.children}</Auth>
105
-
106 115
         {!tabBar && <View className={laySty["pdm-space"]}></View>}
107 116
       </View>
108 117
       {tabBar && (

+ 5
- 5
src/pages/home/index.jsx Ver fichero

@@ -127,11 +127,11 @@ export default (props) => {
127 127
           link: "/pages/org/issue/list/index?title=已逾期&bizStatus=expired",
128 128
         },
129 129
         { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
130
-        {
131
-          icon: "icon10",
132
-          text: "我的上报",
133
-          link: `/pages/feedback/issuelist/index?title=我的上报&bizStatus=`,
134
-        },
130
+        // {
131
+        //   icon: "icon10",
132
+        //   text: "我的上报",
133
+        //   link: `/pages/feedback/issuelist/index?title=我的上报&bizStatus=`,
134
+        // },
135 135
         {
136 136
           icon: "icon12",
137 137
           text: "交办历史",

+ 21
- 20
src/pages/org/components/issue-info/index.jsx Ver fichero

@@ -1,13 +1,20 @@
1
-import React from 'react';
2
-import Taro from '@tarojs/taro';
3
-import { View } from '@tarojs/components';
4
-import { Cell, CellGroup, Field, Button } from '@antmjs/vantui';
5
-import Uploader from '@/components/Uploader/index';
6
-import Map from '@/components/map';
7
-import { getDtStr } from '@/utils/date';
1
+import React, { useEffect } from "react";
2
+import Taro from "@tarojs/taro";
3
+import { View } from "@tarojs/components";
4
+import { Cell, CellGroup, Field, Button } from "@antmjs/vantui";
5
+import Uploader from "@/components/Uploader/index";
6
+import Map from "@/components/map";
7
+import { getDtStr } from "@/utils/date";
8
+import { APPLY_READY, getIssueStatus } from "@/utils/biz";
8 9
 
9 10
 export default (props) => {
10 11
   const { issue } = props;
12
+  const [bizStatus, setBizStatus] = React.useState({});
13
+  useEffect(()=>{
14
+    const data=getIssueStatus(issue)
15
+    setBizStatus(data);
16
+
17
+  },[issue])
11 18
   return (
12 19
     <>
13 20
       <Map location={issue?.location} readOnly />
@@ -17,25 +24,19 @@ export default (props) => {
17 24
         <Cell title="办结时间" value={issue?.expireDate} />
18 25
         <Cell title="交办次数" value={issue?.processNum || 1} />
19 26
       </CellGroup>
20
-      <CellGroup style={{marginTop: '20px'}}>
27
+      <CellGroup style={{ marginTop: "20px" }}>
21 28
         <Cell title="抽检位置" value={issue?.locName} />
22 29
         <Cell title="定 位 点" value={issue?.addr} />
23
-        <Cell title="问题详情" />        
30
+        <Cell title="问题详情" />
24 31
         <Field
25 32
           readonly
26 33
           type="textarea"
27
-          autosize={{ minHeight: '120px' }}
34
+          autosize={{ minHeight: "120px" }}
28 35
           value={issue?.content}
29
-        /> 
30
-        <Cell
31
-          renderTitle={
32
-            <Uploader
33
-              disabled
34
-              value={issue?.attachList}
35
-            />
36
-          }
37 36
         />
37
+        <Cell renderTitle={<Uploader disabled value={issue?.attachList} />} />
38
+        <Cell title="状态" value={bizStatus?.label}></Cell>
38 39
       </CellGroup>
39 40
     </>
40
-  )
41
-}
41
+  );
42
+};

+ 2
- 2
src/pages/org/issue/detail/index.jsx Ver fichero

@@ -111,13 +111,13 @@ export default (props) => {
111 111
                   <Apply block type="primary" applyType={PROCESS_APPLY_END} orgIssue={orgIssue}>申请办结</Apply>
112 112
               }
113 113
             </View>
114
-            {
114
+            {/* {
115 115
               showApplyVerify && (
116 116
                 <View style={{marginTop: '20px'}}>
117 117
                   <Apply block type="primary" applyType={PROCESS_APPLY_VERIFY} orgIssue={orgIssue}>申请审核</Apply>
118 118
                 </View>
119 119
               )
120
-            }
120
+            } */}
121 121
             <View style={{marginTop: '20px', display: 'flex' }}>
122 122
               <Apply
123 123
                 block

+ 20
- 17
src/pages/org/issue/detail2/components/Order.jsx Ver fichero

@@ -34,33 +34,36 @@ export default (props) => {
34 34
       return 0;
35 35
     });
36 36
     return sortedSteps.map((it, index, array) => {
37
-      const { value: bizStatus = 0, label: statusText } = getIssueStatus({
38
-        ...(it || {}),
39
-        expireDate: it?.createDate,
40
-        processNode: it?.processNode || it?.applyType,
41
-        processStatus: it?.processStatus || it?.verifyStatus || APPLY_READY,
42
-      });
43
-      const [bg1, bg2] = colors[bizStatus];
37
+      // const { value: bizStatus = 0, label: statusText } = getIssueStatus({
38
+      //   ...(it || {}),
39
+      //   expireDate: it?.createDate,
40
+      //   processNode: it?.processNode || it?.applyType,
41
+      //   processStatus: it?.processStatus || it?.verifyStatus || APPLY_READY,
42
+      // });
43
+      // const [bg1, bg2] = colors[bizStatus];
44 44
 
45 45
       let nextOrgName = null;
46 46
       if (index == 0) {
47
-        nextOrgName = "平台管理员";
47
+        nextOrgName = "平台";
48 48
       } else if (index <= array.length - 1) {
49 49
         nextOrgName = array[index - 1].orgName;
50 50
       }
51 51
       return (
52 52
         <View key={it.orgIssueId} className={styles["page_order"]}>
53 53
           <Cell
54
-            value={dayjs(it.createDate).format("YYYY-MM-DD HH:mm:ss")}
55
-            renderTitle={
56
-              <View>
57
-                
58
-
59
-                <View className="title">
60
-                  {nextOrgName} {"---->"} {it.orgName}
61
-                  <Tag plain={true} style={{ color: bg2 }}>{statusText}</Tag>
54
+            title={
55
+              <>
56
+                <View>{nextOrgName}</View>
57
+                <View>
58
+                  {dayjs(it.createDate).format("YYYY-MM-DD HH:mm:ss")}
62 59
                 </View>
63
-              </View>
60
+              </>
61
+            }
62
+            renderRightIcon={
63
+              <>
64
+                <View>{it.orgName}</View>
65
+                <View>&ensp;&ensp;</View>
66
+              </>
64 67
             }
65 68
           />
66 69
           {/* <View className={styles["org_order"]}>

+ 0
- 1
src/pages/org/issue/detail2/index.jsx Ver fichero

@@ -76,7 +76,6 @@ export default (props) => {
76 76
   return (
77 77
     <Page loading={loading}>
78 78
       <IssueInfo issue={issue} />
79
-
80 79
     <Order id={id}/>
81 80
 
82 81
       {/* <CellGroup style={{marginTop: '20px'}}>

+ 16
- 29
src/store/user.js Ver fichero

@@ -31,35 +31,23 @@ export default function useUser() {
31 31
   };
32 32
 
33 33
   const updateDuty = (d = ROLE_CITIZEN) => {
34
-    try {
35
-      setDuty(d);
36
-      Taro.setStorageSync("duty", d);
37
-    } catch (e) {
38
-      console.log(e);
39
-    }
34
+    setDuty(d);
35
+    Taro.setStorageSync("duty", d);
40 36
   };
41 37
 
42 38
   const initDuty = (u) => {
43 39
     console.log(u);
44
-    let d;
45
-    try {
46
-      d = Taro.getStorageSync("duty");
47
-    } catch (error) {
48
-      console.error("读取存储中'duty'失败:", error);
49
-      // 根据业务需求考虑是否需要进行错误处理或通知用户
50
-    }
40
+    const d = Taro.getStorageSync("duty");
41
+    console.log(d);
51 42
     const dutyList = u?.dutyList || [];
52
-    const firstDuty = dutyList[0];
53
-
54 43
     if (d) {
55 44
       if (dutyList.indexOf(d) < 0) {
56
-        console.log(firstDuty);
57
-        updateDuty(firstDuty);
45
+        updateDuty(dutyList[0]);
58 46
       } else {
59 47
         updateDuty(d);
60 48
       }
61 49
     } else {
62
-      updateDuty(firstDuty);
50
+      updateDuty(dutyList[0]);
63 51
     }
64 52
   };
65 53
 
@@ -77,16 +65,14 @@ export default function useUser() {
77 65
 
78 66
   const maSignup = (data) => {
79 67
     return new Promise((resolve, reject) => {
80
-      signup(data)
81
-        .then((res) => {
82
-          setPerson(res.person);
83
-          setUser(res.user);
84
-          initDuty(res.user);
85
-          resolve(res);
86
-        })
87
-        .catch(reject);
68
+      signup(data).then(res => {
69
+        setPerson(res.person);
70
+        setUser(res.user);
71
+        initDuty(res.user);
72
+        resolve(res);
73
+      }).catch(reject);
88 74
     });
89
-  };
75
+  }
90 76
 
91 77
   const current = () => {
92 78
     return new Promise((resolve, reject) => {
@@ -123,7 +109,7 @@ export default function useUser() {
123 109
   };
124 110
 
125 111
   const signOut = () => {
126
-    console.log(111111);
112
+    console.log(111111)
127 113
     setPerson(null);
128 114
     setUser(null);
129 115
     initDuty(null);
@@ -141,7 +127,8 @@ export default function useUser() {
141 127
 
142 128
     changePassword(data)
143 129
       .then((res) => {
144
-        signOut();
130
+        signOut()
131
+
145 132
       })
146 133
       .catch((e) => {
147 134
         console.error(e);

+ 21
- 21
src/utils/biz.js Ver fichero

@@ -34,15 +34,15 @@ export const APPLY_REJECT = "reject";
34 34
 
35 35
 
36 36
 export function getIssueStatus (taIssue) {
37
+console.log(taIssue)
38
+  const isExpired = dayjs(taIssue?.expireDate).format('YYYY-MM-DD') < dayjs().format('YYYY-MM-DD');
37 39
 
38
-  const isExpired = dayjs(taIssue.expireDate).format('YYYY-MM-DD') < dayjs().format('YYYY-MM-DD');
39
-
40
-  if (taIssue.processStatus === APPLY_REJECT) {
40
+  if (taIssue?.processStatus === APPLY_REJECT) {
41 41
     return {
42 42
       value: 4,
43 43
       label: '已打回',
44 44
     };
45
-  } else if (taIssue.processNode === PROCESS_START) {
45
+  } else if (taIssue?.processNode === PROCESS_START) {
46 46
 
47 47
     if (isExpired) {
48 48
       return {
@@ -55,8 +55,8 @@ export function getIssueStatus (taIssue) {
55 55
       value: 0,
56 56
       label: '待交办',
57 57
     }
58
-  } else if (taIssue.processNode === PROCESS_END) {
59
-    if (dayjs(taIssue.expireDate).format('YYYY-MM-DD') < dayjs(taIssue.endDate).format('YYYY-MM-DD')) {
58
+  } else if (taIssue?.processNode === PROCESS_END) {
59
+    if (dayjs(taIssue?.expireDate).format('YYYY-MM-DD') < dayjs(taIssue?.endDate).format('YYYY-MM-DD')) {
60 60
       return {
61 61
         value: 5,
62 62
         label: '逾期办结',
@@ -67,24 +67,24 @@ export function getIssueStatus (taIssue) {
67 67
       value: 2,
68 68
       label: '已办结',
69 69
     };
70
-  } else if (taIssue.processNode.indexOf(PROCESS_ASSIGNED) === 0) {
71
-    if (taIssue.processStatus === APPLY_READY) {
72
-      if (taIssue.processNode === PROCESS_APPLY_REJECT) {
70
+  } else if (taIssue?.processNode.indexOf(PROCESS_ASSIGNED) === 0) {
71
+    if (taIssue?.processStatus === APPLY_READY) {
72
+      if (taIssue?.processNode === PROCESS_APPLY_REJECT) {
73 73
         return {
74 74
           value: 1,
75 75
           label: '驳回申请',
76 76
         };
77
-      } else if (taIssue.processNode === PROCESS_APPLY_DELAY) {
77
+      } else if (taIssue?.processNode === PROCESS_APPLY_DELAY) {
78 78
         return {
79 79
           value: 1,
80 80
           label: '延期申请',
81 81
         };
82
-      } else if (taIssue.processNode === PROCESS_APPLY_VERIFY) {
82
+      } else if (taIssue?.processNode === PROCESS_APPLY_VERIFY) {
83 83
         return {
84 84
           value: 1,
85 85
           label: '审核申请',
86 86
         };
87
-      } else if (taIssue.processNode === PROCESS_APPLY_END) {
87
+      } else if (taIssue?.processNode === PROCESS_APPLY_END) {
88 88
         return {
89 89
           value: 1,
90 90
           label: '消单申请',
@@ -95,45 +95,45 @@ export function getIssueStatus (taIssue) {
95 95
         //   label: '待处理',
96 96
         // };
97 97
       }
98
-    } else if (taIssue.processStatus === APPLY_PASS) {
99
-      if (taIssue.processNode === PROCESS_APPLY_REJECT) {
98
+    } else if (taIssue?.processStatus === APPLY_PASS) {
99
+      if (taIssue?.processNode === PROCESS_APPLY_REJECT) {
100 100
         return {
101 101
           value: 1,
102 102
           label: '驳回申请通过',
103 103
         };
104
-      } else if (taIssue.processNode === PROCESS_APPLY_DELAY) {
104
+      } else if (taIssue?.processNode === PROCESS_APPLY_DELAY) {
105 105
         return {
106 106
           value: 1,
107 107
           label: '延期申请通过',
108 108
         };
109
-      } else if (taIssue.processNode === PROCESS_APPLY_VERIFY) {
109
+      } else if (taIssue?.processNode === PROCESS_APPLY_VERIFY) {
110 110
         return {
111 111
           value: 1,
112 112
           label: '审核申请通过',
113 113
         };
114
-      } else if (taIssue.processNode === PROCESS_APPLY_END) {
114
+      } else if (taIssue?.processNode === PROCESS_APPLY_END) {
115 115
         return {
116 116
           value: 1,
117 117
           label: '消单申请通过',
118 118
         };
119 119
       }
120 120
     } else {
121
-      if (taIssue.processNode === PROCESS_APPLY_REJECT) {
121
+      if (taIssue?.processNode === PROCESS_APPLY_REJECT) {
122 122
         return {
123 123
           value: 1,
124 124
           label: '驳回申请驳回',
125 125
         };
126
-      } else if (taIssue.processNode === PROCESS_APPLY_DELAY) {
126
+      } else if (taIssue?.processNode === PROCESS_APPLY_DELAY) {
127 127
         return {
128 128
           value: 1,
129 129
           label: '延期申请驳回',
130 130
         };
131
-      } else if (taIssue.processNode === PROCESS_APPLY_VERIFY) {
131
+      } else if (taIssue?.processNode === PROCESS_APPLY_VERIFY) {
132 132
         return {
133 133
           value: 1,
134 134
           label: '审核申请驳回',
135 135
         };
136
-      } else if (taIssue.processNode === PROCESS_APPLY_END) {
136
+      } else if (taIssue?.processNode === PROCESS_APPLY_END) {
137 137
         return {
138 138
           value: 1,
139 139
           label: '消单申请驳回',