浏览代码

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

张涛 2 年前
父节点
当前提交
0bd4dadd86

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

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

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

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

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

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

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

2
 import Taro from '@tarojs/taro';
2
 import Taro from '@tarojs/taro';
3
 import { View } from '@tarojs/components';
3
 import { View } from '@tarojs/components';
4
 import { Button } from '@antmjs/vantui';
4
 import { Button } from '@antmjs/vantui';
5
+import { warn } from '@/utils/message';
5
 import QuSelect from '../QuSelect';
6
 import QuSelect from '../QuSelect';
6
 import style from './style.module.less';
7
 import style from './style.module.less';
7
 
8
 
8
 export default (props) => {
9
 export default (props) => {
9
   const { value, list, readonly, onChange, onSubmit } = props;
10
   const { value, list, readonly, onChange, onSubmit } = props;
10
 
11
 
12
+  const total = list?.length || 0;
11
   const [isPrev, isFinished] = React.useMemo(() => {
13
   const [isPrev, isFinished] = React.useMemo(() => {
12
-    const total = list?.length || 0;
13
 
14
 
14
     return [
15
     return [
15
       value > 0,
16
       value > 0,
16
-      value >= total - 1,
17
+      (value >= total - 1) && (total > 0),
17
     ]
18
     ]
18
-  }, [value, list]);
19
+  }, [value, total]);
19
 
20
 
20
   const onPrev = () => {
21
   const onPrev = () => {
21
     onChange(value - 1);
22
     onChange(value - 1);
25
     if (isFinished) {
26
     if (isFinished) {
26
       onSubmit()
27
       onSubmit()
27
     } else {
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
   const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
13
   const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
14
 
14
 
15
   const [showAgePicker, setShowAgePicker] = React.useState(false);
15
   const [showAgePicker, setShowAgePicker] = React.useState(false);
16
+  const answerRef = React.useRef();
17
+  answerRef.current = answer;
16
 
18
 
17
   const setLoading = (v) => {
19
   const setLoading = (v) => {
18
     if (onLoadingChange) {
20
     if (onLoadingChange) {
21
   }
23
   }
22
 
24
 
23
   const setFieldChange = (key, val) => {
25
   const setFieldChange = (key, val) => {
24
-    onChange({
25
-      ...answer || {},
26
+    const newAnswer = {
27
+      ...answerRef.current || {},
26
       [key]: val,
28
       [key]: val,
27
-    })
29
+    }
30
+
31
+    answerRef.current = newAnswer;
32
+    onChange(newAnswer);
28
   }
33
   }
29
 
34
 
30
   const onLocationChange = (loc) => {
35
   const onLocationChange = (loc) => {
31
     setFieldChange('location', loc);
36
     setFieldChange('location', loc);
32
-
37
+    
33
     if (checkType == 'loc' && loc) {
38
     if (checkType == 'loc' && loc) {
34
       // 交换经纬度位置
39
       // 交换经纬度位置
35
       const [x, y] = loc.split(',');
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
   return (
46
   return (
42
     <View>
47
     <View>
60
         {
65
         {
61
           checkType == 'survey' && (
66
           checkType == 'survey' && (
62
             <Field
67
             <Field
68
+              key="01"
63
               label="社区"
69
               label="社区"
64
               placeholder="请填写社区名称"
70
               placeholder="请填写社区名称"
65
               readonly={readonly}
71
               readonly={readonly}
69
           )
75
           )
70
         }
76
         }
71
         <Field
77
         <Field
78
+          key="02"
72
           readonly={readonly}
79
           readonly={readonly}
73
           label={checkType == 'loc' ? '地址' : '小区'}
80
           label={checkType == 'loc' ? '地址' : '小区'}
74
           placeholder={checkType == 'loc' ? '请输入地址' : '请填写小区名称'}
81
           placeholder={checkType == 'loc' ? '请输入地址' : '请填写小区名称'}

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

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

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

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