shuishen
2022-01-13 05e12ffc0cd7ca5cc0469cc7b69f9a524d722d1c
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)