//重置地图
init(){
var self = this;
this.wSize = {
wHeight: window.innerHeight-,
wWidth: window.innerWidth
}
//获取本市位置
var citylocation = new qq.maps.CityService({
complete : function(result){
self.map.setCenter(result.detail.latLng);
}
});
citylocation.searchLocalCity();
var center = new qq.maps.LatLng(39.914850, 116.403765);
this.map = new qq.maps.Map(document.getElementById("container"),
{
center: center,
zoom:
}
);
// qq.maps.event.addDomListener(this.map, 'click', function(event) {
// self.addMarker(event.latLng);
// });
},
//获取位置信息
workersPos(){
console.log(this.city3,this.value)
var self = this;
axios.get('http://work.121soft.cn:8089/lbs/lbs/public/index.php/api/servicer/getsonmap',{
params:{
rid:this.city3,
sid:this.value
}
}).then((response)=>{
console.log(response);
this.workersInfor = response.data.data;
this.setMarker();
}).catch((response)=>{
console.log(response)
})
},
        //移除覆盖物
deleteOverlays() {
if (this.markersArray) {
for (i in this.markersArray) {
this.markersArray[i].setMap(null);
}
this.markersArray.length = ;
}
},
//设置覆盖物
setMarker(){
this.deleteOverlays();
var self = this;
this.latlngs2 = [];
for (var prop in this.workersInfor) {
this.latlngs2.push('new qq.maps.LatLng('+this.workersInfor[prop].lat+','+this.workersInfor[prop].lng+')');
}
console.log(this.workersInfor)
for(var i = ;i < this.latlngs2.length; i++) {
(function(n){
var marker = new qq.maps.Marker({
position: eval(self.latlngs2[n]),
map: self.map
});
self.markersArray.push(marker);
})(i);
}
},
05-26 15:07