Yansen 2 gadus atpakaļ
vecāks
revīzija
8e3291e96f

+ 27
- 22
src/components/map/index.jsx Parādīt failu

@@ -5,28 +5,23 @@ import { getLocation } from '@/utils/authorize';
5 5
 import iconPath from '@/assets/icons/marker.png';
6 6
 import style from './style.module.less';
7 7
 
8
+// location 逻辑
9
+// 如果 props.location 有值, 那么放弃地图定位的点, 使用 props.location
10
+// 否则使用 地图定位的点
11
+// 如果地图定位失败 或者 props.location 为空, 那么不产生数据交互
12
+// 但是地图上默认使用 霍山县人民政府 的定位
8 13
 export default (props) => {
9 14
   const { location, onLocChange } = props;
10 15
 
11 16
   const [currentPos, setCurPos] = React.useState();
12
-  const [lngLat, setLngLat] = React.useState([,]);
17
+  const [
18
+    markers,
19
+    lngLat,
20
+  ] = React.useMemo(() => {
21
+    const loc = location || currentPos || '116.354259,31.415587';    
22
+    const [longitude, latitude] = loc.split(',');
13 23
 
14
-  const markers = React.useMemo(() => {
15
-    if (!location && !currentPos) return [];
16
-    
17
-    let longitude, latitude;
18
-    if (location) {
19
-      const [lng, lat] = location.split(',');
20
-      longitude = lng - 0;
21
-      latitude = lat - 0;
22
-    } else {
23
-      longitude = currentPos.longitude;
24
-      latitude = currentPos.latitude;
25
-    }
26
-
27
-    setLngLat([longitude, latitude]);
28
-
29
-    return [{
24
+    const mks = [{
30 25
       id: 1,
31 26
       longitude,
32 27
       latitude,
@@ -34,15 +29,16 @@ export default (props) => {
34 29
       width: 17,
35 30
       height: 20
36 31
     }];
32
+
33
+    return [
34
+      mks,
35
+      [longitude, latitude]
36
+    ]
37 37
   }, [location, currentPos]);
38 38
   
39 39
   React.useEffect(() => {
40 40
     getLocation().then((res) => {
41
-      setCurPos(res);
42
-
43
-      if (onLocChange) {
44
-        onLocChange([res.longitude, res.latitude].join(','));
45
-      }
41
+      setCurPos([res.longitude, res.latitude].join(','));
46 42
     }).catch((err) => {
47 43
       console.error(err);
48 44
       Taro.showToast({
@@ -51,6 +47,15 @@ export default (props) => {
51 47
       })
52 48
     });
53 49
   }, []);
50
+
51
+  React.useEffect(() => {
52
+    if (!location && !currentPos) return;
53
+
54
+    const loc = location || currentPos;
55
+    if (loc) {
56
+      onLocChange(loc);
57
+    }
58
+  }, [location, currentPos]);
54 59
   
55 60
   return (
56 61
     <View className={style['map-wrapper']}>

+ 0
- 5
src/layouts/index.jsx Parādīt failu

@@ -26,11 +26,6 @@ export default (props) => {
26 26
     }
27 27
   }, [person, user]);
28 28
 
29
-
30
-  Taro.useDidShow(() => {
31
-    console.log('--------useDidShow-----')
32
-  });
33
-
34 29
   return (
35 30
     <View className={laySty['page-wrapper']}>
36 31
       <Notify id="vanNotify" />

+ 6
- 1
src/pages/apply/detail/index.jsx Parādīt failu

@@ -9,6 +9,11 @@ import { PROCESS_APPLY_DELAY } from '@/utils/biz';
9 9
 import Issue from '../components/Issue';
10 10
 import useTitle from '../useTitle';
11 11
 
12
+const getVerifyStatus = (st) => {
13
+  if (!st || st == 'ready') return '未审批';
14
+  return st == 'pass' ? '通过' : '驳回';
15
+}
16
+
12 17
 export default (props) => {
13 18
   const router = Taro.useRouter();
14 19
   const { id, applyType, issueId } = router.params;
@@ -55,7 +60,7 @@ export default (props) => {
55 60
       <CellGroup style={{marginTop: '20px'}}>
56 61
         <Cell
57 62
           title="审批结果"
58
-          value={applyInfo.verifyStatus == 'pass' ? '通过' : '驳回'}
63
+          value={getVerifyStatus(applyInfo.verifyStatus)}
59 64
         />
60 65
         <Cell title="审批说明" />
61 66
         <Field

+ 5
- 3
src/pages/apply/list/index.jsx Parādīt failu

@@ -6,7 +6,7 @@ import Page from '@/layouts/index';
6 6
 import PowerList from '@/components/PowerList';
7 7
 import Card from '@/components/IssueCard';
8 8
 import { getTaIssueApply } from '@/services/taissueapply';
9
-import { ROLE_MANAGER } from '@/utils/user';
9
+import { ROLE_MANAGER, ROLE_ORG_MANAGER } from '@/utils/user';
10 10
 import { useModel } from '@/store';
11 11
 
12 12
 export default (props) => {
@@ -14,6 +14,8 @@ export default (props) => {
14 14
   const router = Taro.useRouter();
15 15
   const { title, applyType = '' } = router.params;
16 16
 
17
+  const { duty } = useModel('user');
18
+
17 19
   React.useMemo(() => {
18 20
     if (title) {
19 21
       Taro.setNavigationBarTitle({ title });
@@ -27,8 +29,8 @@ export default (props) => {
27 29
   const onClick = (item) => {
28 30
     if (!user) return ;
29 31
 
30
-    if (user.dutyList.indexOf(ROLE_MANAGER) > -1) {
31
-      if (item.verifyStatus) {
32
+    if (!item.verifyDate) {
33
+      if (duty != ROLE_MANAGER && duty != ROLE_ORG_MANAGER) {
32 34
         Taro.navigateTo({
33 35
           url: `/pages/apply/detail/index?id=${item.applyId}&issueId=${item.issueId}&applyType=${item.applyType}`
34 36
         })

+ 1
- 1
src/pages/apply/verify/index.jsx Parādīt failu

@@ -36,7 +36,7 @@ export default (props) => {
36 36
   const onSubmit = () => {
37 37
     try {
38 38
       warn(!formData.verifyStatus, '请选择审批结果');
39
-      warn(!formData.verifyDesc, '请填写审批说明');
39
+      warn(!formData.verifyDesc && formData.verifyStatus == 'reject', '请填写审批说明');
40 40
     } catch (e) {
41 41
       return ;
42 42
     }