Commit c8e58b43 authored by zhengke's avatar zhengke

修改

parent 08669180
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
hotelImage: "http://imgfile.oytour.com/static/location_hotel.png", hotelImage: "http://imgfile.oytour.com/static/location_hotel.png",
scenicImage: "http://imgfile.oytour.com/static/location_scenic.png", scenicImage: "http://imgfile.oytour.com/static/location_scenic.png",
planeImage: "http://imgfile.oytour.com/static/location_plane.png" planeImage: "http://imgfile.oytour.com/static/location_plane.png"
} },
myScenArr:[]
} }
}, },
watch: { watch: {
...@@ -152,20 +153,32 @@ ...@@ -152,20 +153,32 @@
//每天 //每天
else { else {
/* 循环标出所有坐标 */ /* 循环标出所有坐标 */
this.myScenArr=[];
for (var i = 0; i < waypoints.length - 1; i++) { for (var i = 0; i < waypoints.length - 1; i++) {
var currentItem = waypoints[i]; var currentItem = waypoints[i];
var nextItem = waypoints[i + 1]; var nextItem = waypoints[i + 1];
if (currentItem && currentItem.trafficType == 4) { if (currentItem && currentItem.trafficType == 4) {
this.drawWalkRoute(currentItem.location, nextItem.location); this.drawWalkRoute(currentItem.location, nextItem.location);
this.addMarker(currentItem, i + 1), this.addMarker(currentItem, i + 1),
this.addMarker(nextItem, i + 2); this.addMarker(nextItem, i + 2);
} else { } else {
var newArray = []; var newArray = [];
newArray.push(currentItem); newArray.push(currentItem);
newArray.push(nextItem); newArray.push(nextItem);
this.drawDrivingRute(newArray); 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;
}
} }
}, },
//画驾车路线图 //画驾车路线图
...@@ -178,6 +191,12 @@ ...@@ -178,6 +191,12 @@
} }
}, },
addMarker(obj, title) { 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 loc = obj.location.split(',');
//生成标记图标 //生成标记图标
var image = {} var image = {}
...@@ -232,8 +251,9 @@ ...@@ -232,8 +251,9 @@
}); });
//景点 //景点
if (type == 2) { if (type == 2) {
console.log(obj,'objjjjjj');
let infowindow = new google.maps.InfoWindow({ 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) 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