Parcourir la source

新增 航次轨迹;船舶marker

wzh il y a 3 ans
Parent
commit
8a712a38da

+ 24 - 7
miniprogram/pages/voyages/detail/detail.js

@@ -18,7 +18,13 @@ Page({
     truckLoadList: [],
     shipDischargeTotal: 0,
     truckLoadTotal: 0,
-    polyline: {},
+    polyline: [{
+      points: [],
+      width: 2,
+      dottedLine: true,
+      color: "#eb2f06"
+    }],
+    markers: [],
     pageSize: 20
   },
   changeTab(e) {
@@ -50,18 +56,29 @@ Page({
         longitude: i.longitude
       })
     }
-    let polyline = {
-      points,
-      color: "#ff454d",
-      width: 50
-    }
+    let {
+      latitude,
+      longitude
+    } = points[points.length - 1]
+    let markers = [{
+      id: 999,
+      latitude,
+      longitude,
+      iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/web-static/ship-red-icon.png",
+      height: 20,
+      width: 20
+    }]
+    this.data.polyline[0].points = points
     this.setData({
       coordinates,
       medias,
       policys,
       voyage,
       waybills,
-      polyline
+      polyline: this.data.polyline,
+      latitude,
+      longitude,
+      markers
     })
   },
 

+ 1 - 1
miniprogram/pages/voyages/detail/detail.wxml

@@ -1,4 +1,4 @@
-<map scale="8" latitude="31.923534" longitude="120.551381" polyline="{{polyline}}" style="width: 100%;height: 400rpx;" name="map"></map>
+<map scale="8" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}" polyline="{{polyline}}" style="width: 100%;height: 400rpx;" name="map"></map>
 <view class="df aic jcsb p20" style="border-bottom: 1px solid #999;border-top: 1px solid #999;">
   <view class="tabsview" bindtap="changeTab" data-tab="{{1}}" style="color:{{tab==1?'#0d8fcc':''}};border-bottom:{{tab==1?'2rpx solid #0d8fcc':''}}">航次信息</view>
   <view class="tabsview" bindtap="changeTab" data-tab="{{2}}" style="color:{{tab==2?'#0d8fcc':''}};border-bottom:{{tab==2?'2rpx solid #0d8fcc':''}}">航次详情</view>