From 05e12ffc0cd7ca5cc0469cc7b69f9a524d722d1c Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 13 Jan 2022 17:46:52 +0800
Subject: [PATCH] 忽略模型文件

---
 src/components/campusNav/index.vue |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/components/campusNav/index.vue b/src/components/campusNav/index.vue
index 8a92a73..94b259f 100644
--- a/src/components/campusNav/index.vue
+++ b/src/components/campusNav/index.vue
@@ -250,6 +250,14 @@
                         output: 'json'
                     }
                 }).then(res => {
+                    if (res.data.info == 'OVER_DIRECTION_RANGE') {
+                        this.$message({
+                            message: '超出步行范围!',
+                            type: 'warning',
+                            duration: 3000
+                        })
+                    }
+
                     res.data.route.paths[0].steps.forEach(item => {
                         item.polyline = item.polyline.split(';')
 
@@ -266,8 +274,6 @@
 
                         routes += lineArr
                     })
-
-                    console.log(routes, 123)
 
                     routes = routes.substr(0, routes.length - 1)
 
@@ -318,8 +324,8 @@
             } else {
                 axios.get('https://restapi.amap.com/v3/direction/driving', {
                     params: {
-                        origin: `${startLog + ',' + startLat}`,
-                        destination: `${endLog + ',' + endLat}`,
+                        origin: `${origin[0].toFixed(6) + ',' + origin[1].toFixed(6)}`,
+                        destination: `${destination[0].toFixed(6) + ',' + destination[1].toFixed(6)}`,
                         key: '4b3e1db3211054ce5b466407cbb9d221',
                         strategy: 2,
                         extensions: 'all',
@@ -327,8 +333,20 @@
                     }
                 }).then(res => {
                     res.data.route.paths[0].steps.forEach(item => {
-                        item.polyline += ';'
-                        routes += item.polyline
+                        item.polyline = item.polyline.split(';')
+
+                        var lineArr = []
+
+                        item.polyline.forEach(it => {
+                            it = it.split(',')
+                            lineArr.push(this.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(','))
+                        })
+
+                        lineArr = lineArr.join(';')
+
+                        lineArr += ';'
+
+                        routes += lineArr
                     })
 
                     routes = routes.substr(0, routes.length - 1)

--
Gitblit v1.9.3