Commit 208f0066eb40ed972ccfce372031ccd5f8f7491c

Authored by vking
1 parent ce94e9d8

fix 橱窗与地图数据不匹配

Showing 1 changed file with 29 additions and 3 deletions
@@ -471,7 +471,7 @@ Page({ @@ -471,7 +471,7 @@ Page({
471 this.selectComponent('#list').getList(param); 471 this.selectComponent('#list').getList(param);
472 this.param=param; 472 this.param=param;
473 let now_sid=[]; 473 let now_sid=[];
474 - App.Customer.SellerList(param).then(res => { 474 + App.Customer.SellerList(param).then(async res => {
475 this.mapData.region.southwest.latitude=''; 475 this.mapData.region.southwest.latitude='';
476 if (res.ret == 200) { 476 if (res.ret == 200) {
477 let sellersList=res.data; 477 let sellersList=res.data;
@@ -562,7 +562,7 @@ Page({ @@ -562,7 +562,7 @@ Page({
562 mk.display=''; 562 mk.display='';
563 } 563 }
564 }) 564 })
565 - obj.markers=this.setLocationMarker(obj.markers); 565 + obj.markers=await this.setLocationMarker(obj.markers);
566 this.setData(obj) 566 this.setData(obj)
567 if(now_sid.length>0) { 567 if(now_sid.length>0) {
568 setTimeout(() => { 568 setTimeout(() => {
@@ -710,7 +710,33 @@ Page({ @@ -710,7 +710,33 @@ Page({
710 } 710 }
711 ds.setA2LHeight(e.type=='hide'?0:40); 711 ds.setA2LHeight(e.type=='hide'?0:40);
712 }, 712 },
713 - setLocationMarker(markers){ 713 + async setMapRegion(){
  714 + return new Promise((success,fail)=>{
  715 + if(this.mapCtx){
  716 + this.mapCtx.getRegion({
  717 + success:(res)=>{
  718 + if(res.southwest.latitude) {
  719 + this.mapData.region = res
  720 + success()
  721 + }
  722 + },
  723 + fail:()=>{
  724 + fail()
  725 + }
  726 + })
  727 + }else{
  728 + fail()
  729 + }
  730 + })
  731 + },
  732 + async setLocationMarker(markers){
  733 + try{
  734 + await this.setMapRegion();
  735 + }catch (e){
  736 + this.timeoutGetMarkers()
  737 + return []
  738 + }
  739 +
714 let map = this.mapData; 740 let map = this.mapData;
715 let mks=[] 741 let mks=[]
716 let matchPosNum=1 742 let matchPosNum=1