|
@@ -114,6 +114,7 @@ Page({ |
|
@@ -114,6 +114,7 @@ Page({ |
|
114
|
titleBarHeight:h,
|
114
|
titleBarHeight:h,
|
|
115
|
})
|
115
|
})
|
|
116
|
this.getPos(systemInfo);
|
116
|
this.getPos(systemInfo);
|
|
|
|
117
|
+ this.getMarkers();
|
|
117
|
},
|
118
|
},
|
|
118
|
|
119
|
|
|
119
|
/**
|
120
|
/**
|
|
@@ -168,12 +169,10 @@ Page({ |
|
@@ -168,12 +169,10 @@ Page({ |
|
168
|
this.mapCtx.getRegion({
|
169
|
this.mapCtx.getRegion({
|
|
169
|
success:(res)=>{
|
170
|
success:(res)=>{
|
|
170
|
console.log('regionchange.getRegion',res)
|
171
|
console.log('regionchange.getRegion',res)
|
|
171
|
- if(res.southwest.latitude!=this.mapData.region.southwest.latitude) {
|
172
|
+ //if(res.southwest.latitude!=this.mapData.region.southwest.latitude) {
|
|
172
|
this.mapData.region = res
|
173
|
this.mapData.region = res
|
|
173
|
- setTimeout(()=>{
|
|
|
|
174
|
- this.getMarkers();
|
|
|
|
175
|
- },300)
|
|
|
|
176
|
- }
|
174
|
+ this.getMarkers();
|
|
|
|
175
|
+ //}
|
|
177
|
},
|
176
|
},
|
|
178
|
})
|
177
|
})
|
|
179
|
}).catch((e) => {
|
178
|
}).catch((e) => {
|
|
@@ -266,10 +265,10 @@ Page({ |
|
@@ -266,10 +265,10 @@ Page({ |
|
266
|
this.mapCtx.getRegion({
|
265
|
this.mapCtx.getRegion({
|
|
267
|
success:(res)=>{
|
266
|
success:(res)=>{
|
|
268
|
console.log('mapUpdated.getRegion',res)
|
267
|
console.log('mapUpdated.getRegion',res)
|
|
269
|
- if(res.southwest.latitude!=this.mapData.region.southwest.latitude){
|
268
|
+ //if(res.southwest.latitude!=this.mapData.region.southwest.latitude){
|
|
270
|
this.mapData.region=res
|
269
|
this.mapData.region=res
|
|
271
|
//this.getMarkers();
|
270
|
//this.getMarkers();
|
|
272
|
- }
|
271
|
+ //}
|
|
273
|
|
272
|
|
|
274
|
},
|
273
|
},
|
|
275
|
})
|
274
|
})
|
|
@@ -312,11 +311,30 @@ Page({ |
|
@@ -312,11 +311,30 @@ Page({ |
|
312
|
}
|
311
|
}
|
|
313
|
this.setData(obj)
|
312
|
this.setData(obj)
|
|
314
|
},
|
313
|
},
|
|
|
|
314
|
+ hasInRegionFlag:false,
|
|
|
|
315
|
+ hasInRegion(){//定位是否在地图视野内
|
|
|
|
316
|
+ if(this.hasInRegionFlag) return true;
|
|
|
|
317
|
+ if(!this.user.latitude) return false;//用户无定位
|
|
|
|
318
|
+ if(this.user.latitude==23.099994 && this.user.longitude==113.324520) return false;//默认位置
|
|
|
|
319
|
+ let map = this.mapData;
|
|
|
|
320
|
+ if(!map.region.northeast.latitude || !map.region.northeast.longitude) return false;//未获得视野
|
|
|
|
321
|
+ if(!map.region.southwest.latitude || !map.region.southwest.longitude) return false;//未获得视野
|
|
|
|
322
|
+ ///判断定位 首次 进入视野
|
|
|
|
323
|
+ if(this.user.latitude>map.region.southwest.latitude
|
|
|
|
324
|
+ && this.user.longitude>map.region.southwest.longitude
|
|
|
|
325
|
+ && this.user.latitude<map.region.northeast.latitude
|
|
|
|
326
|
+ && this.user.longitude<map.region.northeast.longitude){
|
|
|
|
327
|
+ this.hasInRegionFlag=true;
|
|
|
|
328
|
+ return true;
|
|
|
|
329
|
+ }
|
|
|
|
330
|
+ return false;
|
|
|
|
331
|
+ },
|
|
315
|
async getMarkers(){
|
332
|
async getMarkers(){
|
|
316
|
let cmap=this.data.map;
|
333
|
let cmap=this.data.map;
|
|
317
|
let map = this.mapData;
|
334
|
let map = this.mapData;
|
|
318
|
//console.log('getMarkers',map.region);
|
335
|
//console.log('getMarkers',map.region);
|
|
319
|
- if(!map.region.northeast.latitude) {
|
336
|
+ if(!this.hasInRegion()) {
|
|
|
|
337
|
+ console.log('FAIL:::',this.user,map)
|
|
320
|
return setTimeout(()=>{
|
338
|
return setTimeout(()=>{
|
|
321
|
this.getMarkers();
|
339
|
this.getMarkers();
|
|
322
|
},300)
|
340
|
},300)
|