fangmingyue 2 years ago
parent
commit
7efd770ad3

+ 7
- 6
src/components/map/index.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import Taro from '@tarojs/taro';
2
 import Taro from '@tarojs/taro';
3
 import { View, Map } from '@tarojs/components';
3
 import { View, Map } from '@tarojs/components';
4
-import { Icon } from '@antmjs/vantui';
4
+import { Icon, Loading } from '@antmjs/vantui';
5
 import { getLocation } from '@/utils/authorize';
5
 import { getLocation } from '@/utils/authorize';
6
 import iconPath from '@/assets/icons/marker.png';
6
 import iconPath from '@/assets/icons/marker.png';
7
 import style from './style.module.less';
7
 import style from './style.module.less';
57
 
57
 
58
   const fixedLocation = () => {
58
   const fixedLocation = () => {
59
     return new Promise((resolve) => {
59
     return new Promise((resolve) => {
60
+      Taro.showLoading({
61
+        title: '加载中',
62
+      })
60
       getLocation({ type: 'gcj02' }).then((res) => {
63
       getLocation({ type: 'gcj02' }).then((res) => {
64
+        Taro.hideLoading()
61
         resolve(res);
65
         resolve(res);
62
       }).catch((err) => {
66
       }).catch((err) => {
63
         console.error(err);
67
         console.error(err);
68
+        Taro.hideLoading();
64
         Taro.showToast({
69
         Taro.showToast({
65
           title: '定位失败',
70
           title: '定位失败',
66
           icon: 'none',
71
           icon: 'none',
79
     }
84
     }
80
   }
85
   }
81
 
86
 
82
-  console.log('mapCtxRef', mapCtxRef);
83
-
84
   React.useEffect(() => {
87
   React.useEffect(() => {
85
     if (!readOnly) {
88
     if (!readOnly) {
86
       fixedLocation().then((res) => {
89
       fixedLocation().then((res) => {
104
       // markers={markers}
107
       // markers={markers}
105
       >
108
       >
106
         {!readOnly && (
109
         {!readOnly && (
107
-          <>
108
-            <Icon name="aim" size="24px" onClick={onRefresh} color="#1A7565" className={style['icon']} />
109
-          </>
110
+          <Icon name="aim" size="24px" onClick={onRefresh} color="#1A7565" className={style['icon']} />
110
         )}
111
         )}
111
       </Map>
112
       </Map>
112
     </View >
113
     </View >

+ 6
- 0
src/components/map/style.module.less View File

17
       right: var(--main-space);
17
       right: var(--main-space);
18
       z-index: 3;
18
       z-index: 3;
19
     }
19
     }
20
+    .loading {
21
+      position: fixed;
22
+      z-index: 100;
23
+      display: grid;
24
+      place-items: center;
25
+    }
20
   }
26
   }
21
 }
27
 }

+ 4
- 1
src/pages/check/edit/components/LocForm.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import Taro from '@tarojs/taro';
2
 import Taro from '@tarojs/taro';
3
 import { View, CoverView } from '@tarojs/components';
3
 import { View, CoverView } from '@tarojs/components';
4
-import { CellGroup, Cell, Field, RadioGroup, Radio, Icon } from '@antmjs/vantui';
4
+import { CellGroup, Cell, Field, RadioGroup, Radio, Icon, Loading } from '@antmjs/vantui';
5
 import Map from '@/components/map';
5
 import Map from '@/components/map';
6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7
 import { getTaCheckAnswer } from '@/services/tacheckanswer';
7
 import { getTaCheckAnswer } from '@/services/tacheckanswer';
57
         location={answer?.location}
57
         location={answer?.location}
58
         onChange={e => setFieldChange('location', e)}
58
         onChange={e => setFieldChange('location', e)}
59
       />
59
       />
60
+      {/* <View style={{ position: 'fixed', zIndex: '3000', top: '50%', color: 'red', display: 'grid', width: '50px', height: '50px' }}>
61
+        <Loading type="spinner" vertical />
62
+      </View> */}
60
       <CellGroup>
63
       <CellGroup>
61
         {
64
         {
62
           checkType == 'loc' && (
65
           checkType == 'loc' && (