Browse Source

优化清运地图

chenrui 4 years ago
parent
commit
7ff429af2a
4 changed files with 24 additions and 7 deletions
  1. 1 1
      components/uni-navbar/uni-navbar.vue
  2. 2 2
      pages.json
  3. 1 1
      pages/index/index.vue
  4. 20 3
      pages/index/map.vue

+ 1 - 1
components/uni-navbar/uni-navbar.vue

@@ -6,7 +6,7 @@
 			</view>
 			<view v-if="isMap" class="navbar-action_item last map-bar" @tap="toMap">
 				<u-image class="map-icon" width="24rpx" height="36rpx" src="/static/map-icon.png"></u-image>
-				<view class="item-label">配送地图</view>
+				<view class="item-label">清运地图</view>
 			</view>
 	  </view>
 	  <view class='navbar-title' :style="{'top': navTop+'px'}">

+ 2 - 2
pages.json

@@ -18,7 +18,7 @@
 		{
 			"path": "pages/index/index", // 待清运
 			"style": {
-				"navigationBarTitleText": "待清运",
+				"navigationBarTitleText": "待清运清单",
 				"enablePullDownRefresh": false,
 				"navigationStyle": "custom"
 			}
@@ -26,7 +26,7 @@
 		{
 			"path": "pages/index/map",
 			"style": {
-				"navigationBarTitleText": "配送地图"
+				"navigationBarTitleText": "清运地图"
 			}
 		},
 		{

+ 1 - 1
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="unclear-container">
-		<uni-navbar pageName="待清运" :isBack="false" :isMap="true"></uni-navbar>
+		<uni-navbar pageName="待清运清单" :isBack="false" :isMap="true"></uni-navbar>
 		<scroll-view class="scroll-con" scroll-y :scroll-top="scrollTop" @scrolltolower="onreachBottom">
 			<!-- 列表数据 -->
 			<view class="cell-item-con">

+ 20 - 3
pages/index/map.vue

@@ -9,6 +9,7 @@
 			show-location
 			:markers="markers"
 			:polyline="polyline"
+			@markertap="markertap"
 			style="width: 100%; height:100%;">
 		</map>
 	</view>
@@ -42,13 +43,14 @@
 				    }
 				})
 			},
-			// 
+			// 标注点信息
 			getCleanWay(){
 				getCleanWay({ lng: this.longitude, lat: this.latitude }).then(res => {
 					if(res.status == 200){
 						this.markers = []
-						res.data.map(item => {
+						res.data.map((item, index) => {
 							this.markers.push({
+								id: index+1,
 								latitude: item.lat,
 								longitude: item.lng,
 								width: '60rpx',
@@ -76,7 +78,8 @@
 								{latitude: null, longitude: null},
 								{latitude: null, longitude: null}
 							],
-							width: 4,
+							arrowLine: true,
+							width: 6,
 							color: '#07c160'
 						})
 						if(index==0){
@@ -92,6 +95,20 @@
 						}
 					})
 				}
+			},
+			//  点击标注点,调用第三方地图查看规划路线
+			markertap(e){
+				this.markers.map(item => {
+					if(item.id == e.detail.markerId){
+						uni.openLocation({
+							latitude: item.latitude,
+							longitude: item.longitude,
+							success: function () {
+								console.log('success');
+							}
+						})
+					}
+				})
 			}
 		}
 	}