Yansen 2 vuotta sitten
vanhempi
commit
fbe7f1ebf8

+ 1
- 1
config/prod.js Näytä tiedosto

@@ -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.21-20230413"',
10 10
   },
11 11
   mini: {},
12 12
   h5: {

+ 0
- 3
src/components/map/index.jsx Näytä tiedosto

@@ -36,8 +36,6 @@ 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 }
@@ -109,7 +107,6 @@ export default (props) => {
109 107
     // eslint-disable-next-line react-hooks/exhaustive-deps
110 108
   }, [readOnly, getContext]);
111 109
 
112
-  console.log('-----方---》', center);
113 110
   return (
114 111
     <View className={style['map-wrapper']}>
115 112
       {

+ 8
- 4
src/pages/check/edit/components/Footer/index.jsx Näytä tiedosto

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

+ 11
- 6
src/pages/check/edit/components/LocForm.jsx Näytä tiedosto

@@ -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,20 +23,23 @@ 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
 

+ 1
- 1
src/pages/check/edit/index.jsx Näytä tiedosto

@@ -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 Näytä tiedosto

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