Commit c8e58b43 authored by zhengke's avatar zhengke

修改

parent 08669180
......@@ -48,7 +48,8 @@
hotelImage: "http://imgfile.oytour.com/static/location_hotel.png",
scenicImage: "http://imgfile.oytour.com/static/location_scenic.png",
planeImage: "http://imgfile.oytour.com/static/location_plane.png"
}
},
myScenArr:[]
}
},
watch: {
......@@ -152,9 +153,11 @@
//每天
else {
/* 循环标出所有坐标 */
this.myScenArr=[];
for (var i = 0; i < waypoints.length - 1; i++) {
var currentItem = waypoints[i];
var nextItem = waypoints[i + 1];
if (currentItem && currentItem.trafficType == 4) {
this.drawWalkRoute(currentItem.location, nextItem.location);
this.addMarker(currentItem, i + 1),
......@@ -164,9 +167,19 @@
newArray.push(currentItem);
newArray.push(nextItem);
this.drawDrivingRute(newArray);
if(waypoints[i].type==2){
this.myScenArr.push(waypoints[i]);
}
}
}
for(var i=0;i<this.myScenArr.length-1;i++){
var locationStart = this.myScenArr[i].location.split(',');
var locationEnd = this.myScenArr[i+1].location.split(',');
let distance = this.CalcDistance(locationStart[0],locationStart[1],locationEnd[0],locationEnd[1]);
this.myScenArr[i].distance=distance;
}
}
},
//画驾车路线图
drawDrivingRute(array) {
......@@ -178,6 +191,12 @@
}
},
addMarker(obj, title) {
console.log(obj,'objjjjj');
this.myScenArr.forEach(x=>{
if((x.type==obj.type)&&(x.name==obj.name)){
obj.distance=x.distance
}
})
var loc = obj.location.split(',');
//生成标记图标
var image = {}
......@@ -232,8 +251,9 @@
});
//景点
if (type == 2) {
console.log(obj,'objjjjjj');
let infowindow = new google.maps.InfoWindow({
content: '<div>' + obj.name + '</div>',
content: '<div>' + obj.name + '</div><br/><div>'+obj.distance+'<div>',
size: new google.maps.Size(50, 50)
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment