Browse Source

修改地图编辑

master
邓宏 2 years ago
parent
commit
732ce77139
  1. 2
      common/utils.js
  2. 13
      uni_modules/d-form/components/d-form/d-form.vue

2
common/utils.js

@ -1,4 +1,4 @@
export var computeArea=function(val){
export var computeArea=function(val,reat){
var longitude={
min: Math.min(...val.map(v=>v.longitude)),
max: Math.max(...val.map(v=>v.longitude)),

13
uni_modules/d-form/components/d-form/d-form.vue

@ -248,7 +248,7 @@
:insert="false"
lunar
@confirm="$emit('input',$event.fulldate)"/>
<view v-if="type=='map'" class="amap" :class="{show:showMap}">
<map id="amap"/>
</view>
@ -404,11 +404,6 @@ import {computeArea} from '@/common/utils'
setPickerCol.bind(this.$refs.picker)(this.columns[0]||[],this.value,1)
})
}
this.$nextTick(()=>{
uni.$u.getRect(".amap").then(res=>{
console.log(res,'---res----')
})
})
},
methods:{
async afterRead(e){
@ -459,10 +454,9 @@ import {computeArea} from '@/common/utils'
var amap=uni.createMapContext("amap",this)
this.maps=amap.$getAppMap()
this.maps.setMapType(plus.maps.MapType.MAPTYPE_SATELLITE)
this.maps.centerAndZoom(new plus.maps.Point(102.712251,25.040609),10)
if(this.value.length>0){
var bound=computeArea(this.value)
var bound=computeArea(this.value,this.reat)
for(var i=0;i<this.value.length;i++){
this.maps.addOverlay(this.addMarker(this.value[i]))
}
@ -470,8 +464,11 @@ import {computeArea} from '@/common/utils'
this.markerList[this.markerList.length-1].next=this.markerList[0].value
this.maps.centerAndZoom(new plus.maps.Point(bound.center.longitude, bound.center.latitude),10)
this.drawOver(true)
}else{
this.maps.centerAndZoom(new plus.maps.Point(102.712251,25.040609),10)
}
this.maps.onclick=(e)=>{
console.log("zoom",this.maps.getZoom())
this.markerList.length<=0 && this.maps.addOverlay(polyline)
if(this.value.length<=0){

Loading…
Cancel
Save