|
|
@ -427,40 +427,51 @@ import {dataType} from 'black-knight/lib/config/tools' |
|
|
|
openMap(){ |
|
|
|
/* #ifdef APP-PLUS */ |
|
|
|
this.showMap=true |
|
|
|
|
|
|
|
if(!this.maps){ |
|
|
|
var amap=uni.createMapContext("amap",this) |
|
|
|
|
|
|
|
for(var i in plus.maps.MapStyles){ |
|
|
|
console.log(i,'-plus.maps.MapStyles-------') |
|
|
|
} |
|
|
|
this.maps=amap.$getAppMap() |
|
|
|
this.maps.setMapType(plus.maps.MapType.MAPTYPE_SATELLITE) |
|
|
|
|
|
|
|
var polyline=new plus.maps.Polyline([]) |
|
|
|
polyline.setLineWidth(8) |
|
|
|
polyline.setStrokeColor("#10C176") |
|
|
|
this.maps.addOverlay(polyline) |
|
|
|
|
|
|
|
this.maps.onclick=(e)=>{ |
|
|
|
if(this.value.length<0){ |
|
|
|
if(this.value.length<=0 && this.markerList.length<=2){ |
|
|
|
var marker=new plus.maps.Marker(new plus.maps.Point(e.longitude, e.latitude)); |
|
|
|
marker.setIcon("/static/map_point_1.png"); |
|
|
|
marker.bringToTop() |
|
|
|
marker.setDraggable(true) |
|
|
|
marker.onDrag= e=>{ |
|
|
|
console.log("-----Drag:",JSON.stringify(e.getPoint())) |
|
|
|
} |
|
|
|
this.markerList.push(marker) |
|
|
|
this.maps.addOverlay(marker); |
|
|
|
|
|
|
|
polyline.setPath(this.markerList.map(v=>{ |
|
|
|
var point=v.getPoint() |
|
|
|
return new plus.maps.Point(point.longitude, point.latitude) |
|
|
|
})) |
|
|
|
} |
|
|
|
console.log(e,'-------maps--click---------') |
|
|
|
} |
|
|
|
|
|
|
|
// var polygon=new plus.maps.Polygon([ |
|
|
|
// new plus.maps.Point(116.39524,39.925301), |
|
|
|
// new plus.maps.Point(116.400444,39.925285), |
|
|
|
// new plus.maps.Point(116.400558,39.923282), |
|
|
|
// new plus.maps.Point(116.395502,39.923082), |
|
|
|
// ]) |
|
|
|
// polygon.setLineWidth(2) |
|
|
|
// polygon.setLineWidth(3) |
|
|
|
// polygon.setStrokeColor("#10C176") |
|
|
|
// polygon.setFillColor("#10C176") |
|
|
|
// polygon.setFillOpacity(0.3) |
|
|
|
// this.maps.addOverlay(polygon) |
|
|
|
|
|
|
|
var marker=new plus.maps.Marker(new plus.maps.Point(116.396137,39.924055)); |
|
|
|
marker.setIcon("/static/map_point_1.png"); |
|
|
|
marker.bringToTop() |
|
|
|
marker.setDraggable(true) |
|
|
|
marker.onclick= e=>{ |
|
|
|
console.log('---onclick----') |
|
|
|
} |
|
|
|
marker.onDrag= e=>{ |
|
|
|
console.log("-----Drag:",JSON.stringify(e.getPoint())) |
|
|
|
} |
|
|
|
this.maps.addOverlay(marker); |
|
|
|
} |
|
|
|
/* #endif */ |
|
|
|
} |
|
|
|