fangmingyue 2 år sedan
förälder
incheckning
1bbe2a1d29
2 ändrade filer med 13 tillägg och 6 borttagningar
  1. 8
    5
      src/components/map/index.jsx
  2. 5
    1
      src/components/map/style.module.less

+ 8
- 5
src/components/map/index.jsx Visa fil

@@ -1,6 +1,7 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3
-import { View, Map } from '@tarojs/components';
3
+import { View, Map, CoverView } from '@tarojs/components';
4
+import { Icon } from '@antmjs/vantui'
4 5
 import { getLocation } from '@/utils/authorize';
5 6
 import iconPath from '@/assets/icons/marker.png';
6 7
 import style from './style.module.less';
@@ -18,7 +19,7 @@ export default (props) => {
18 19
     markers,
19 20
     lngLat,
20 21
   ] = React.useMemo(() => {
21
-    const loc = location || currentPos || '116.354259,31.415587';    
22
+    const loc = location || currentPos || '116.354259,31.415587';
22 23
     const [longitude, latitude] = loc.split(',');
23 24
 
24 25
     const mks = [{
@@ -35,7 +36,7 @@ export default (props) => {
35 36
       [longitude, latitude]
36 37
     ]
37 38
   }, [location, currentPos]);
38
-  
39
+
39 40
   React.useEffect(() => {
40 41
     getLocation().then((res) => {
41 42
       setCurPos([res.longitude, res.latitude].join(','));
@@ -56,14 +57,16 @@ export default (props) => {
56 57
       onLocChange(loc);
57 58
     }
58 59
   }, [location, currentPos]);
59
-  
60
+
60 61
   return (
61 62
     <View className={style['map-wrapper']}>
62 63
       <Map
63 64
         longitude={lngLat[0]}
64 65
         latitude={lngLat[1]}
65 66
         markers={markers}
66
-      ></Map>
67
+      >
68
+        <CoverView className={style['control']}><Icon name="aim" size="26px" color="rgb(18,183,245)" /></CoverView>
69
+      </Map>
67 70
     </View>
68 71
   )
69 72
 }

+ 5
- 1
src/components/map/style.module.less Visa fil

@@ -1,4 +1,3 @@
1
-
2 1
 .map-wrapper {
3 2
   width: 100%;
4 3
   height: 0;
@@ -11,5 +10,10 @@
11 10
     position: absolute;
12 11
     top: 0;
13 12
     left: 0;
13
+    .control {
14
+      position: absolute;
15
+      bottom: 14%;
16
+      right: 4%;
17
+    }
14 18
   }
15 19
 }