Commit f6206f900fdcd9b304c17769bb5e407a364b9a97

Authored by wangfan
1 parent 72c0d02a

C端调整

Showing 1 changed file with 14 additions and 17 deletions
@@ -146,7 +146,8 @@ Page({ @@ -146,7 +146,8 @@ Page({
146 this.systemInfo=systemInfo 146 this.systemInfo=systemInfo
147 this.selectComponent('#getpos').getPos(); 147 this.selectComponent('#getpos').getPos();
148 if(!this.hasClickMoveToLocation){ 148 if(!this.hasClickMoveToLocation){
149 - this.getMarkers(); 149 + //this.getMarkers();
  150 + this.timeoutGetMarkers();
150 } 151 }
151 152
152 }, 153 },
@@ -241,14 +242,9 @@ Page({ @@ -241,14 +242,9 @@ Page({
241 this.mapCtx.getRegion({ 242 this.mapCtx.getRegion({
242 success:(res)=>{ 243 success:(res)=>{
243 console.log('regionchange.getRegion',res.southwest.latitude,this.mapData.region.southwest.latitude,res) 244 console.log('regionchange.getRegion',res.southwest.latitude,this.mapData.region.southwest.latitude,res)
244 - if((res.southwest.latitude!=this.mapData.region.southwest.latitude)  
245 - || this.data.hasSuggestion  
246 - || this.hasClickMoveToLocation  
247 - ) {  
248 - this.hasClickMoveToLocation=false  
249 - this.mapData.region = res  
250 - this.timeoutGetMarkers();  
251 - } 245 + this.hasClickMoveToLocation=false
  246 + this.mapData.region = res
  247 + this.timeoutGetMarkers();
252 }, 248 },
253 }) 249 })
254 }, 250 },
@@ -351,10 +347,10 @@ Page({ @@ -351,10 +347,10 @@ Page({
351 hasInRegionFlag:false, 347 hasInRegionFlag:false,
352 hasInRegion(){//定位是否在地图视野内 348 hasInRegion(){//定位是否在地图视野内
353 let map = this.mapData; 349 let map = this.mapData;
354 - if(!map.region.northeast.latitude || !map.region.northeast.longitude) return false;//未获得视野  
355 - if(!map.region.southwest.latitude || !map.region.southwest.longitude) return false;//未获得视野  
356 - if(this.hasInRegionFlag) return true;  
357 - if(!this.user.latitude) return false;//用户无定位 350 + if(!map.region.northeast.latitude || !map.region.northeast.longitude) return {flag:false,msg:'未获得视野'};//未获得视野
  351 + if(!map.region.southwest.latitude || !map.region.southwest.longitude) return {flag:false,msg:'未获得视野'};//未获得视野
  352 + if(this.hasInRegionFlag) return {flag:true,msg:'二次获取'};
  353 + if(!this.user.latitude) return {flag:false,msg:'用户无定位'};//用户无定位
358 //if(this.user.latitude==def_latitude && this.user.longitude==def_longitude) return false;//默认位置 354 //if(this.user.latitude==def_latitude && this.user.longitude==def_longitude) return false;//默认位置
359 ///判断定位 首次 进入视野 355 ///判断定位 首次 进入视野
360 if((this.user.latitude>map.region.southwest.latitude 356 if((this.user.latitude>map.region.southwest.latitude
@@ -362,7 +358,7 @@ Page({ @@ -362,7 +358,7 @@ Page({
362 && this.user.latitude<map.region.northeast.latitude 358 && this.user.latitude<map.region.northeast.latitude
363 && this.user.longitude<map.region.northeast.longitude) || this.data.hasSuggestion){ 359 && this.user.longitude<map.region.northeast.longitude) || this.data.hasSuggestion){
364 this.hasInRegionFlag=true; 360 this.hasInRegionFlag=true;
365 - return true; 361 + return {flag:true,msg:'用户首次或搜索地标'};
366 }else{ 362 }else{
367 //视野不匹配 363 //视野不匹配
368 this.mapCtx.getRegion({ 364 this.mapCtx.getRegion({
@@ -372,14 +368,15 @@ Page({ @@ -372,14 +368,15 @@ Page({
372 }, 368 },
373 }) 369 })
374 } 370 }
375 - return false; 371 + return {flag:false,msg:'视野不匹配'};
376 }, 372 },
377 async getMarkers(){ 373 async getMarkers(){
378 let cmap=this.data.map; 374 let cmap=this.data.map;
379 let map = this.mapData; 375 let map = this.mapData;
380 //console.log('getMarkers',map.region); 376 //console.log('getMarkers',map.region);
381 - if(!this.hasInRegion()) {  
382 - //console.log('FAIL:::',this.user,map) 377 + let region=this.hasInRegion();
  378 + console.log('this.hasInRegion',region)
  379 + if(!region.flag) {
383 return setTimeout(()=>{ 380 return setTimeout(()=>{
384 this.getMarkers(); 381 this.getMarkers();
385 },300) 382 },300)