Commit 2ae0bf4bb483a1c67524880e2a9f79d2f062c506

Authored by wangfan
1 parent 577234db

地图优化

Showing 1 changed file with 12 additions and 3 deletions
@@ -201,7 +201,6 @@ Page({ @@ -201,7 +201,6 @@ Page({
201 console.log('regionchange.getScale', res, this.data.map.scale) 201 console.log('regionchange.getScale', res, this.data.map.scale)
202 }, 202 },
203 }) 203 })
204 -  
205 this.mapCtx.getCenterLocation({ 204 this.mapCtx.getCenterLocation({
206 success:(res)=>{ 205 success:(res)=>{
207 console.log('regionchange.getCenterLocation',res) 206 console.log('regionchange.getCenterLocation',res)
@@ -218,11 +217,21 @@ Page({ @@ -218,11 +217,21 @@ Page({
218 console.log('regionchange.getRegion',res) 217 console.log('regionchange.getRegion',res)
219 if(res.southwest.latitude!=this.mapData.region.southwest.latitude) { 218 if(res.southwest.latitude!=this.mapData.region.southwest.latitude) {
220 this.mapData.region = res 219 this.mapData.region = res
221 - this.getMarkers(); 220 + this.timeoutGetMarkers();
222 } 221 }
223 }, 222 },
224 }) 223 })
225 }, 224 },
  225 + setTimeoutGetMarkers:'',
  226 + timeoutGetMarkers(){//延时获取
  227 + if(this.setTimeoutGetMarkers){
  228 + clearTimeout(this.setTimeoutGetMarkers);
  229 + this.setTimeoutGetMarkers='';
  230 + }
  231 + this.setTimeoutGetMarkers=setTimeout(()=>{
  232 + this.getMarkers();
  233 + },1200)
  234 + },
226 mapUpdated(e){ 235 mapUpdated(e){
227 console.log('mapUpdated', e) 236 console.log('mapUpdated', e)
228 this.getClassNameFlag=true; 237 this.getClassNameFlag=true;
@@ -351,7 +360,7 @@ Page({ @@ -351,7 +360,7 @@ Page({
351 lat: this.user.latitude, 360 lat: this.user.latitude,
352 lng: this.user.longitude, 361 lng: this.user.longitude,
353 offset: 0, 362 offset: 0,
354 - rows: 10000, 363 + rows: 50,
355 distance: 100000, 364 distance: 100000,
356 map:JSON.stringify({...this.mapData.region,scale:this.mapData.scale}) 365 map:JSON.stringify({...this.mapData.region,scale:this.mapData.scale})
357 } 366 }