|
...
|
...
|
@@ -146,7 +146,8 @@ Page({ |
|
|
|
this.systemInfo=systemInfo
|
|
|
|
this.selectComponent('#getpos').getPos();
|
|
|
|
if(!this.hasClickMoveToLocation){
|
|
|
|
this.getMarkers();
|
|
|
|
//this.getMarkers();
|
|
|
|
this.timeoutGetMarkers();
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
...
|
...
|
@@ -241,14 +242,9 @@ Page({ |
|
|
|
this.mapCtx.getRegion({
|
|
|
|
success:(res)=>{
|
|
|
|
console.log('regionchange.getRegion',res.southwest.latitude,this.mapData.region.southwest.latitude,res)
|
|
|
|
if((res.southwest.latitude!=this.mapData.region.southwest.latitude)
|
|
|
|
|| this.data.hasSuggestion
|
|
|
|
|| this.hasClickMoveToLocation
|
|
|
|
) {
|
|
|
|
this.hasClickMoveToLocation=false
|
|
|
|
this.mapData.region = res
|
|
|
|
this.timeoutGetMarkers();
|
|
|
|
}
|
|
|
|
this.hasClickMoveToLocation=false
|
|
|
|
this.mapData.region = res
|
|
|
|
this.timeoutGetMarkers();
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
...
|
...
|
@@ -351,10 +347,10 @@ Page({ |
|
|
|
hasInRegionFlag:false,
|
|
|
|
hasInRegion(){//定位是否在地图视野内
|
|
|
|
let map = this.mapData;
|
|
|
|
if(!map.region.northeast.latitude || !map.region.northeast.longitude) return false;//未获得视野
|
|
|
|
if(!map.region.southwest.latitude || !map.region.southwest.longitude) return false;//未获得视野
|
|
|
|
if(this.hasInRegionFlag) return true;
|
|
|
|
if(!this.user.latitude) return false;//用户无定位
|
|
|
|
if(!map.region.northeast.latitude || !map.region.northeast.longitude) return {flag:false,msg:'未获得视野'};//未获得视野
|
|
|
|
if(!map.region.southwest.latitude || !map.region.southwest.longitude) return {flag:false,msg:'未获得视野'};//未获得视野
|
|
|
|
if(this.hasInRegionFlag) return {flag:true,msg:'二次获取'};
|
|
|
|
if(!this.user.latitude) return {flag:false,msg:'用户无定位'};//用户无定位
|
|
|
|
//if(this.user.latitude==def_latitude && this.user.longitude==def_longitude) return false;//默认位置
|
|
|
|
///判断定位 首次 进入视野
|
|
|
|
if((this.user.latitude>map.region.southwest.latitude
|
|
...
|
...
|
@@ -362,7 +358,7 @@ Page({ |
|
|
|
&& this.user.latitude<map.region.northeast.latitude
|
|
|
|
&& this.user.longitude<map.region.northeast.longitude) || this.data.hasSuggestion){
|
|
|
|
this.hasInRegionFlag=true;
|
|
|
|
return true;
|
|
|
|
return {flag:true,msg:'用户首次或搜索地标'};
|
|
|
|
}else{
|
|
|
|
//视野不匹配
|
|
|
|
this.mapCtx.getRegion({
|
|
...
|
...
|
@@ -372,14 +368,15 @@ Page({ |
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return {flag:false,msg:'视野不匹配'};
|
|
|
|
},
|
|
|
|
async getMarkers(){
|
|
|
|
let cmap=this.data.map;
|
|
|
|
let map = this.mapData;
|
|
|
|
//console.log('getMarkers',map.region);
|
|
|
|
if(!this.hasInRegion()) {
|
|
|
|
//console.log('FAIL:::',this.user,map)
|
|
|
|
let region=this.hasInRegion();
|
|
|
|
console.log('this.hasInRegion',region)
|
|
|
|
if(!region.flag) {
|
|
|
|
return setTimeout(()=>{
|
|
|
|
this.getMarkers();
|
|
|
|
},300)
|
...
|
...
|
|