瀏覽代碼

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

张涛 2 年之前
父節點
當前提交
0bd4dadd86

+ 1
- 1
config/prod.js 查看文件

@@ -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.20-20230404"',
9
+    VERSION: '"1.1.22-20230413"',
10 10
   },
11 11
   mini: {},
12 12
   h5: {

+ 4
- 4
src/components/PowerList/index.jsx 查看文件

@@ -10,7 +10,7 @@ export default React.forwardRef((props, ref) => {
10 10
   const { sid, request, params, renderItem, onLoadingChange, onDataChange } = props;
11 11
 
12 12
   const pageSize = 5;
13
-  const pageShowRef = React.useRef(false);
13
+  const pageShowRef = React.useRef(true);
14 14
   const [loading, setLoading] = React.useState(false);
15 15
   const [list, setList] = React.useState([]);
16 16
   const [finished, setFinished] = React.useState(true);
@@ -105,18 +105,18 @@ export default React.forwardRef((props, ref) => {
105 105
     if (pageShowRef.current) {
106 106
       refresh(params);
107 107
     }
108
-  }, [params]);
108
+  }, [params, sid]);
109 109
 
110 110
   React.useImperativeHandle(ref, () => ({
111 111
     refresh: () => refresh(params),
112 112
     updateData: (dt) => setList(dt),
113
-  }), [params]);
113
+  }), [params, sid]);
114 114
 
115 115
   React.useEffect(() => {
116 116
     return () => {
117 117
       Taro.removeStorageSync(`list-${sid}`);
118 118
     }
119
-  }, []);
119
+  }, [sid]);
120 120
  
121 121
   return (
122 122
     <PowerScrollView

+ 2
- 3
src/components/map/index.jsx 查看文件

@@ -36,14 +36,14 @@ export default (props) => {
36 36
       height: 20
37 37
     }] : [];
38 38
 
39
-    console.log('-----mks---', mks);
40
-
41 39
     return [
42 40
       mks,
43 41
       { longitude, latitude }
44 42
     ]
45 43
   }, [location, readOnly]);
46 44
 
45
+  console.log('------center-------', center, location)
46
+
47 47
   const moveTo = (ctx, point) => {
48 48
     ctx.moveToLocation({
49 49
       ...point,
@@ -109,7 +109,6 @@ export default (props) => {
109 109
     // eslint-disable-next-line react-hooks/exhaustive-deps
110 110
   }, [readOnly, getContext]);
111 111
 
112
-  console.log('-----方---》', center);
113 112
   return (
114 113
     <View className={style['map-wrapper']}>
115 114
       {

+ 8
- 4
src/pages/check/edit/components/Footer/index.jsx 查看文件

@@ -2,20 +2,21 @@ import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { View } from '@tarojs/components';
4 4
 import { Button } from '@antmjs/vantui';
5
+import { warn } from '@/utils/message';
5 6
 import QuSelect from '../QuSelect';
6 7
 import style from './style.module.less';
7 8
 
8 9
 export default (props) => {
9 10
   const { value, list, readonly, onChange, onSubmit } = props;
10 11
 
12
+  const total = list?.length || 0;
11 13
   const [isPrev, isFinished] = React.useMemo(() => {
12
-    const total = list?.length || 0;
13 14
 
14 15
     return [
15 16
       value > 0,
16
-      value >= total - 1,
17
+      (value >= total - 1) && (total > 0),
17 18
     ]
18
-  }, [value, list]);
19
+  }, [value, total]);
19 20
 
20 21
   const onPrev = () => {
21 22
     onChange(value - 1);
@@ -25,7 +26,10 @@ export default (props) => {
25 26
     if (isFinished) {
26 27
       onSubmit()
27 28
     } else {
28
-      onChange(value + 1);
29
+      try {
30
+        warn(total < 1, '找不到作答题目');
31
+        onChange(value + 1);
32
+      } finally {}
29 33
     }
30 34
   }
31 35
   

+ 14
- 7
src/pages/check/edit/components/LocForm.jsx 查看文件

@@ -13,6 +13,8 @@ export default (props) => {
13 13
   const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
14 14
 
15 15
   const [showAgePicker, setShowAgePicker] = React.useState(false);
16
+  const answerRef = React.useRef();
17
+  answerRef.current = answer;
16 18
 
17 19
   const setLoading = (v) => {
18 20
     if (onLoadingChange) {
@@ -21,22 +23,25 @@ export default (props) => {
21 23
   }
22 24
 
23 25
   const setFieldChange = (key, val) => {
24
-    onChange({
25
-      ...answer || {},
26
+    const newAnswer = {
27
+      ...answerRef.current || {},
26 28
       [key]: val,
27
-    })
29
+    }
30
+
31
+    answerRef.current = newAnswer;
32
+    onChange(newAnswer);
28 33
   }
29 34
 
30 35
   const onLocationChange = (loc) => {
31 36
     setFieldChange('location', loc);
32
-
37
+    
33 38
     if (checkType == 'loc' && loc) {
34 39
       // 交换经纬度位置
35 40
       const [x, y] = loc.split(',');
36
-      const location = [y, x].join(',');
37
-      geocoder(location).then(e => setFieldChange('addr', e?.address_component?.street_number || e?.address)).catch(console.error)
41
+      const reLoc = [y, x].join(',');
42
+      geocoder(reLoc).then(e => setFieldChange('addr', e?.address_component?.street_number || e?.address)).catch(console.error)
38 43
     }
39
-  }
44
+  };
40 45
 
41 46
   return (
42 47
     <View>
@@ -60,6 +65,7 @@ export default (props) => {
60 65
         {
61 66
           checkType == 'survey' && (
62 67
             <Field
68
+              key="01"
63 69
               label="社区"
64 70
               placeholder="请填写社区名称"
65 71
               readonly={readonly}
@@ -69,6 +75,7 @@ export default (props) => {
69 75
           )
70 76
         }
71 77
         <Field
78
+          key="02"
72 79
           readonly={readonly}
73 80
           label={checkType == 'loc' ? '地址' : '小区'}
74 81
           placeholder={checkType == 'loc' ? '请输入地址' : '请填写小区名称'}

+ 1
- 1
src/pages/check/edit/index.jsx 查看文件

@@ -46,7 +46,7 @@ export default (props) => {
46 46
         try {
47 47
           warn(typ == 'survey' && !answer?.communityName, '请填写社区名称');
48 48
           warn(!answer?.addr, typ == 'loc' ? '请填写地址' : '请填写小区名称');
49
-          // warn(!answer?.location, '未能获取定位信息, 请重试');
49
+          warn(!answer?.location, '未能获取定位信息, 请重试');
50 50
           console.log('!answer?.location', !answer?.location);
51 51
           warn(typ == 'survey' && !answer?.sex, '请选择性别');
52 52
           warn(typ == 'survey' && !answer?.age, '请选择年龄段');

+ 8
- 5
src/pages/check/loc/edit/components/Footer/index.jsx 查看文件

@@ -2,20 +2,20 @@ import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { View } from '@tarojs/components';
4 4
 import { Button } from '@antmjs/vantui';
5
+import { warn } from '@/utils/message';
5 6
 import QuSelect from '../QuSelect';
6 7
 import style from './style.module.less';
7 8
 
8 9
 export default (props) => {
9 10
   const { value, list, readonly, onChange, onSubmit } = props;
10 11
 
12
+  const total = list?.length || 0;
11 13
   const [isPrev, isFinished] = React.useMemo(() => {
12
-    const total = list?.length || 0;
13
-
14 14
     return [
15 15
       value > 0,
16
-      value >= total - 1,
16
+      (value >= total - 1) && (total > 0),
17 17
     ]
18
-  }, [value, list]);
18
+  }, [value, total]);
19 19
 
20 20
   const onPrev = () => {
21 21
     onChange(value - 1);
@@ -25,7 +25,10 @@ export default (props) => {
25 25
     if (isFinished) {
26 26
       onSubmit()
27 27
     } else {
28
-      onChange(value + 1);
28
+      try {
29
+        warn(total < 1, '找不到作答题目');
30
+        onChange(value + 1);
31
+      } finally {}
29 32
     }
30 33
   }
31 34