zhongtianhaoyuan vor 1 Jahr
Ursprung
Commit
edb3cacc0e
1 geänderte Dateien mit 38 neuen und 13 gelöschten Zeilen
  1. 38 13
      src/components/mapdrag/indexMap.vue

+ 38 - 13
src/components/mapdrag/indexMap.vue

@@ -61,8 +61,9 @@ export default {
       // this.loadmap();
     },
   },
+
   methods: {
-    paging(value1,value2){
+    paging(value1, value2) {
       this.currentPage = value1
       this.pageSize = value2
       this.infoList()
@@ -73,12 +74,21 @@ export default {
         travelpathbd({ orderId: that.orderid })
           .then((response) => {
             that.path1 = [];
-            var patharr = JSON.parse(response.data.longitudeLatitude) 
+            var patharr = JSON.parse(response.data.longitudeLatitude)
             // console.log(JSON.parse(response.data.longitudeLatitude),11111111)
             for (let i = 0; i < patharr.length; i++) {
-              that.path1.push([patharr[i].lon, patharr[i].lat]);
+              if (patharr[i].lon && patharr[i].lat) {
+                that.path1.push([patharr[i].lon, patharr[i].lat]);
+              }
             }
             that.path = that.path1;
+            if (that.path.length == 0) {
+              that.$notify({
+                title: '提示',
+                message: '未获取到北斗轨迹',
+                type: 'warning'
+              });
+            }
             that.loadmap();
           })
           .catch(() => {
@@ -99,6 +109,13 @@ export default {
               }
             }
             that.path = that.path2;
+            if (that.path.length == 0) {
+              that.$notify({
+                title: '提示',
+                message: '未获取到平台轨迹',
+                type: 'warning'
+              });
+            }
             that.loadmap();
           })
           .catch(() => {
@@ -182,14 +199,15 @@ export default {
             path: this.path,
           },
         ]);
-
         //对第一条线路(即索引 0)创建一个巡航器
-        let trajectory = pathSimplifierIns.createPathNavigator(0, {
-          loop: true, //循环播放
-          speed: 100, //巡航速度,单位千米/小时
-        });
+        if (this.path.length > 0) {
+          let trajectory = pathSimplifierIns.createPathNavigator(0, {
+            loop: true, //循环播放
+            speed: 100, //巡航速度,单位千米/小时
+          });
+          trajectory.start();
+        }
 
-        trajectory.start();
       });
     },
   },
@@ -199,17 +217,24 @@ export default {
     this.$nextTick(function () {
       travelpathbd({ orderId: that.orderid })
         .then((response) => {
+          console.log("data",response)
           that.path1 = [];
           if (response.data) {
             var patharr = JSON.parse(response.data.longitudeLatitude);
-            // console.log(JSON.parse(response.data.longitudeLatitude),11111111)
             for (let i = 0; i < patharr.length; i++) {
-              that.path1.push([patharr[i].longitude, patharr[i].latitude]);
+              if (patharr[i].lon && patharr[i].lat) {
+                that.path1.push([patharr[i].lon, patharr[i].lat]);
+              }
             }
-
             that.path = that.path1;
           }
-
+          if (that.path.length == 0) {
+            that.$notify({
+              title: '提示',
+              message: '未获取到北斗轨迹',
+              type: 'warning'
+            });
+          }
           that.loadmap();
         })
         .catch(() => {