|
@@ -0,0 +1,69 @@
|
|
1
|
+import Taro from "@tarojs/taro"
|
|
2
|
+import { useState } from "react"
|
|
3
|
+import { View, Map,Image } from "@tarojs/components"
|
|
4
|
+import withLayout from '@/layouts'
|
|
5
|
+import CustomNav from "@/components/CustomNav"
|
|
6
|
+import m1 from '@/assets/machinery/greenMachinery.png'
|
|
7
|
+import m2 from '@/assets/machinery/orangeMachinery.png'
|
|
8
|
+import picon from '@/assets/comm/position.png'
|
|
9
|
+import './style.less'
|
|
10
|
+
|
|
11
|
+export default withLayout((props) => {
|
|
12
|
+ const [show,setShow]=useState(false)
|
|
13
|
+ const markers=[
|
|
14
|
+ {
|
|
15
|
+ id:1,
|
|
16
|
+ longitude:112.105348,
|
|
17
|
+ latitude:32.697352,
|
|
18
|
+ iconPath:m1,
|
|
19
|
+ width:50,
|
|
20
|
+ height:50
|
|
21
|
+ },
|
|
22
|
+ {
|
|
23
|
+ id:2,
|
|
24
|
+ longitude:112.120295,
|
|
25
|
+ latitude:32.686656,
|
|
26
|
+ iconPath:m2,
|
|
27
|
+ width:50,
|
|
28
|
+ height:50
|
|
29
|
+ }
|
|
30
|
+ ]
|
|
31
|
+ const handleClick=(e)=>{
|
|
32
|
+ console.log(e.markerId)
|
|
33
|
+ setShow(true)
|
|
34
|
+ }
|
|
35
|
+ const goDetail=()=>{
|
|
36
|
+ Taro.navigateTo({ url: '/pages/machineryDetail/index' });
|
|
37
|
+ }
|
|
38
|
+ return (
|
|
39
|
+ <View className='page-index'>
|
|
40
|
+ <View className='index-navbar'>
|
|
41
|
+ <CustomNav title='我的农机' />
|
|
42
|
+ </View>
|
|
43
|
+ <View className='index-container machineryMap'>
|
|
44
|
+ <Map
|
|
45
|
+ longitude={112.116846}
|
|
46
|
+ latitude={32.688935}
|
|
47
|
+ markers={markers}
|
|
48
|
+ className='map'
|
|
49
|
+ onMarkerTap={handleClick}
|
|
50
|
+ onRegionChange={()=>setShow(false)}
|
|
51
|
+ />
|
|
52
|
+ {
|
|
53
|
+ show&&
|
|
54
|
+ <View className='showModel'>
|
|
55
|
+ <View className='title'>
|
|
56
|
+ <View className='name'>收割机001--S001</View>
|
|
57
|
+ <View className='action' onClick={goDetail}>详情 {">"}{">"}</View>
|
|
58
|
+ </View>
|
|
59
|
+ <View className='position'>
|
|
60
|
+ <Image src={picon} className='picon' />
|
|
61
|
+ 当前位置: 邓州市陈楼
|
|
62
|
+ </View>
|
|
63
|
+ </View>
|
|
64
|
+ }
|
|
65
|
+
|
|
66
|
+ </View>
|
|
67
|
+ </View>
|
|
68
|
+ )
|
|
69
|
+})
|