fangmingyue 2 vuotta sitten
vanhempi
commit
7efd770ad3

+ 7
- 6
src/components/map/index.jsx Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { View, Map } from '@tarojs/components';
4
-import { Icon } from '@antmjs/vantui';
4
+import { Icon, Loading } from '@antmjs/vantui';
5 5
 import { getLocation } from '@/utils/authorize';
6 6
 import iconPath from '@/assets/icons/marker.png';
7 7
 import style from './style.module.less';
@@ -57,10 +57,15 @@ export default (props) => {
57 57
 
58 58
   const fixedLocation = () => {
59 59
     return new Promise((resolve) => {
60
+      Taro.showLoading({
61
+        title: '加载中',
62
+      })
60 63
       getLocation({ type: 'gcj02' }).then((res) => {
64
+        Taro.hideLoading()
61 65
         resolve(res);
62 66
       }).catch((err) => {
63 67
         console.error(err);
68
+        Taro.hideLoading();
64 69
         Taro.showToast({
65 70
           title: '定位失败',
66 71
           icon: 'none',
@@ -79,8 +84,6 @@ export default (props) => {
79 84
     }
80 85
   }
81 86
 
82
-  console.log('mapCtxRef', mapCtxRef);
83
-
84 87
   React.useEffect(() => {
85 88
     if (!readOnly) {
86 89
       fixedLocation().then((res) => {
@@ -104,9 +107,7 @@ export default (props) => {
104 107
       // markers={markers}
105 108
       >
106 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 112
       </Map>
112 113
     </View >

+ 6
- 0
src/components/map/style.module.less Näytä tiedosto

@@ -17,5 +17,11 @@
17 17
       right: var(--main-space);
18 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 Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 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 5
 import Map from '@/components/map';
6 6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7 7
 import { getTaCheckAnswer } from '@/services/tacheckanswer';
@@ -57,6 +57,9 @@ export default (props) => {
57 57
         location={answer?.location}
58 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 63
       <CellGroup>
61 64
         {
62 65
           checkType == 'loc' && (