李志伟 3 anos atrás
pai
commit
d9729e4466

src/assets/machinery/orangeMachiner.png → src/assets/machinery/orangeMachinery.png Ver arquivo


+ 7
- 0
src/pages/index/components/User/index.jsx Ver arquivo

@@ -44,6 +44,9 @@ export default (props) => {
44 44
   const signOut = () => { 
45 45
     Taro.reLaunch({ url: '/pages/index/index?tab=2' });
46 46
   }
47
+  const handleMap = () => { 
48
+    Taro.reLaunch({ url: '/pages/machineryMap/index' });
49
+  }
47 50
   return (
48 51
     <ScrollView scrollY style={{ height: '100%' }}>
49 52
       {
@@ -102,6 +105,10 @@ export default (props) => {
102 105
         <View className='userBox'>
103 106
           <MyCell icon={feedback} action={goto} user handleAction={handleFeedback}>意见反馈</MyCell>
104 107
         </View>
108
+
109
+        <View className='userBox'>
110
+          <MyCell icon={feedback} action={goto} user handleAction={handleMap}>农机地图</MyCell>
111
+        </View>
105 112
         {
106 113
           isLogin && <View className='signOut' onClick={signOut}>退出登录</View>
107 114
         }

+ 7
- 0
src/pages/machineryMap/index.config.js Ver arquivo

@@ -0,0 +1,7 @@
1
+export default {
2
+  navigationBarTitleText: '我的农机',
3
+  navigationStyle: 'custom',
4
+  styleIsolation: 'shared',
5
+  enableShareAppMessage: true,
6
+  disableScroll: true,
7
+}

+ 69
- 0
src/pages/machineryMap/index.jsx Ver arquivo

@@ -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
+            当前位置:&nbsp;&nbsp;邓州市陈楼
62
+          </View>
63
+        </View>
64
+        }
65
+        
66
+      </View>
67
+    </View>
68
+  )
69
+})

+ 41
- 0
src/pages/machineryMap/style.less Ver arquivo

@@ -0,0 +1,41 @@
1
+.machineryMap{
2
+  height: 100%;
3
+  .map{
4
+    width: 100vw;
5
+    height: 100%;
6
+  }  
7
+  .showModel{
8
+    position: absolute;
9
+    bottom: 0;
10
+    width: 100%;
11
+    box-sizing: border-box;
12
+    background: #FFFFFF;
13
+    border-radius: 40px 40px 0px 0px;
14
+    padding: 60px 30px;
15
+    font-weight: bold;
16
+    font-size: 30px;
17
+    color: #222222;
18
+    .title{
19
+      display: flex;
20
+      align-items: center;
21
+      margin-bottom: 40px;
22
+      .name{
23
+        font-size: 36px;
24
+      }
25
+      .action{
26
+        color: #666666;
27
+        position: absolute;
28
+        right: 30px;
29
+      }
30
+    }
31
+    .position{
32
+      display: flex;
33
+      align-items: center;
34
+      .picon{
35
+        width: 34px;
36
+        height: 34px;
37
+        margin-right: 16px;    
38
+      }
39
+    }
40
+  }
41
+}

+ 4
- 0
src/routes.js Ver arquivo

@@ -22,6 +22,10 @@ const mainPages = [
22 22
     title: '农机列表',
23 23
     page: 'pages/machineryList/index',
24 24
   },
25
+  {
26
+    title: '农机地图',
27
+    page: 'pages/machineryMap/index',
28
+  },
25 29
   {
26 30
     title: '查看详情',
27 31
     page: 'pages/machineryDetail/index',