Przeglądaj źródła

更新 地图坐标逻辑

wzh 3 lat temu
rodzic
commit
c5fbe9044d

+ 16 - 18
miniprogram/pages/sharePage/sharePage.js

@@ -24,14 +24,8 @@ Page({
       dottedLine: true,
       color: "#eb2f06"
     }],
-    markers: [{
-      id: 999,
-      latitude: '',
-      longitude: '',
-      iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
-      height: 20,
-      width: 20
-    }],
+    markers: [],
+    points: [],
     pageSize: 20,
     latitude: 31.891992,
     longitude: 120.551369,
@@ -71,15 +65,25 @@ Page({
       } = points[points.length - 1]
       this.data.latitude = latitude
       this.data.longitude = longitude
-      this.data.markers[0].latitude = latitude
-      this.data.markers[0].longitude = longitude
       this.data.polyline[0].points = points
+      let id = 1
+      for (let i of points) {
+        this.data.markers.push({
+          id: id + 1,
+          latitude: i.latitude,
+          longitude: i.longitude,
+          iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
+          height: 20,
+          width: 20
+        })
+      }
 
       this.setData({
         polyline: this.data.polyline,
         markers: this.data.markers,
-        latitude: this.data.latitude,
-        longitude: this.data.longitude,
+        // latitude: this.data.latitude,
+        // longitude: this.data.longitude,
+        points
       })
 
     }
@@ -255,12 +259,6 @@ Page({
     let res = await postApi("/voyage/share", {
       voyageId
     })
-    // res.data.result.transInfos.forEach(item => {
-    //   item.createTime = this.subTimeStr(item.createTime)
-    // })
-    // res.data.result.loadingInfos.forEach(item => {
-    //   item.createTime = this.subTimeStr(item.createTime)
-    // })
     this.setData({
       ...res.data.result
     })

+ 1 - 1
miniprogram/pages/sharePage/sharePage.wxml

@@ -1,4 +1,4 @@
-<map scale="8" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}" style="width: 100%;height: 400rpx;" name="map"></map>
+<map enable-zoom="{{false}}" enable-scroll="{{false}}" markers="{{markers}}" include-points="{{points}}" 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="{{2}}" style="color:{{tab==2?'#0d8fcc':''}};border-bottom:{{tab==2?'2rpx solid #0d8fcc':''}}">航次信息</view>
   <view class="tabsview" bindtap="changeTab" data-tab="{{3}}" style="color:{{tab==3?'#0d8fcc':''}};border-bottom:{{tab==3?'2rpx solid #0d8fcc':''}}">单据信息</view>

+ 16 - 12
miniprogram/pages/voyages/detail/detail.js

@@ -24,14 +24,8 @@ Page({
       dottedLine: true,
       color: "#eb2f06"
     }],
-    markers: [{
-      id: 999,
-      latitude: '',
-      longitude: '',
-      iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
-      height: 20,
-      width: 20
-    }],
+    markers: [],
+    points: [],
     pageSize: 20,
     latitude: 31.891992,
     longitude: 120.551369,
@@ -71,15 +65,25 @@ Page({
       } = points[points.length - 1]
       this.data.latitude = latitude
       this.data.longitude = longitude
-      this.data.markers[0].latitude = latitude
-      this.data.markers[0].longitude = longitude
       this.data.polyline[0].points = points
+      let id = 1
+      for (let i of points) {
+        this.data.markers.push({
+          id: id + 1,
+          latitude: i.latitude,
+          longitude: i.longitude,
+          iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
+          height: 20,
+          width: 20
+        })
+      }
 
       this.setData({
         polyline: this.data.polyline,
         markers: this.data.markers,
-        latitude: this.data.latitude,
-        longitude: this.data.longitude,
+        // latitude: this.data.latitude,
+        // longitude: this.data.lo fngitude,
+        points
       })
 
     }

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

@@ -1,4 +1,4 @@
-<map scale="8" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}" style="width: 100%;height: 400rpx;" name="map"></map>
+<map enable-zoom="{{false}}" enable-scroll="{{false}}" markers="{{markers}}" include-points="{{points}}" 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>