|
@@ -17,7 +17,6 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
scaleNum: 10,
|
|
|
mapContext: null, //地图对象
|
|
|
startMove: false, //是否开始回放
|
|
@@ -54,25 +53,35 @@
|
|
|
methods: {
|
|
|
//模拟获取远程数据
|
|
|
getTrack() {
|
|
|
-
|
|
|
uni.request({
|
|
|
url: baseUrl + '/hyOrderTravelPath/getInfo',
|
|
|
data: {
|
|
|
- orderId: this.id
|
|
|
+ orderId: this.id,
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 9999
|
|
|
},
|
|
|
method: 'get',
|
|
|
header: {
|
|
|
'content-type': 'application/json' //'application/x-www-form-urlencoded; charset=UTF-8',
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- // console.log(res.data,11111111)
|
|
|
- if(res.data.code==200){
|
|
|
- if(res.data.data){
|
|
|
- if(res.data.data.longitudeLatitude){
|
|
|
- // console.log(JSON.parse(res.data.data.longitudeLatitude));
|
|
|
- this.polyline[0].points =JSON.parse(res.data.data.longitudeLatitude)
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ if (res.data.data) {
|
|
|
+ var patharr = []
|
|
|
+ for (let num = 0; num < res.data.data.records.length; num++) {
|
|
|
+ if(res.data.data.records[num].longitudeLatitude){
|
|
|
+ patharr.push(JSON.parse(res.data.data.records[num].longitudeLatitude));
|
|
|
+ }
|
|
|
+ // for (let i = 0; i < patharr.length; i++) {
|
|
|
+ // that.path2.push([patharr[i].longitude, patharr[i].latitude]);
|
|
|
+ // }
|
|
|
}
|
|
|
- }else{
|
|
|
+ this.polyline[0].points = patharr
|
|
|
+ // if (res.data.data.longitudeLatitude) {
|
|
|
+ // // console.log(JSON.parse(res.data.data.longitudeLatitude));
|
|
|
+ // this.polyline[0].points = JSON.parse(res.data.data.longitudeLatitude)
|
|
|
+ // }
|
|
|
+ } else {
|
|
|
uni.showToast({
|
|
|
title: '暂无运输轨迹',
|
|
|
icon: 'none',
|
|
@@ -110,11 +119,11 @@
|
|
|
// // this.polyline[0].points.push({latitude,longitude})
|
|
|
// // }
|
|
|
var that = this
|
|
|
- setTimeout(()=>{
|
|
|
- that.durationTime = Math.ceil(30000 / that.polyline[0].points.length) //默认播放全程使用30秒,计算相连两点动画时长
|
|
|
+ setTimeout(() => {
|
|
|
+ that.durationTime = Math.ceil(30000 / that.polyline[0].points.length) //默认播放全程使用30秒,计算相连两点动画时长
|
|
|
that.initMapData()
|
|
|
- },1000)
|
|
|
-
|
|
|
+ }, 1000)
|
|
|
+
|
|
|
// })
|
|
|
// .catch(res => {
|
|
|
// uni.hideLoading()
|
|
@@ -124,18 +133,13 @@
|
|
|
// duration: 2000
|
|
|
// })
|
|
|
// });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
//设置地图
|
|
|
initMapData() {
|
|
|
this.initMarkers()
|
|
|
this.mapContext = uni.createMapContext('myMap', this)
|
|
|
-
|
|
|
},
|
|
|
test() {
|
|
|
- // console.log("1111111111111111")
|
|
|
this.mapContext.includePoints({
|
|
|
points: this.polyline[0].points,
|
|
|
padding: [100, 100, 1000, 100]
|
|
@@ -149,8 +153,6 @@
|
|
|
},
|
|
|
//开始移动
|
|
|
handleStartMove() {
|
|
|
-
|
|
|
- console.log("222222")
|
|
|
this.startMove = true
|
|
|
this.movePoint()
|
|
|
},
|
|
@@ -169,7 +171,6 @@
|
|
|
})
|
|
|
return
|
|
|
*/
|
|
|
- console.log(this.mapContext)
|
|
|
this.mapContext.moveAlong({
|
|
|
duration: 10000,
|
|
|
markerId: this.markers[0].id,
|