Commit f7602d2f5b064a5bb3d5fabf18b03722623e8f52

Authored by wangfan
1 parent dfb8438b

c端预定

@@ -246,7 +246,7 @@ Page({ @@ -246,7 +246,7 @@ Page({
246 }, 246 },
247 }) 247 })
248 }, 248 },
249 - markertap(e){ 249 + markertap(e,flag=true){
250 console.log(e) 250 console.log(e)
251 let markers=this.data.markers; 251 let markers=this.data.markers;
252 let bl=1.2; 252 let bl=1.2;
@@ -269,10 +269,13 @@ Page({ @@ -269,10 +269,13 @@ Page({
269 } 269 }
270 } 270 }
271 }) 271 })
272 - this.setData({  
273 - scrollIntoView:'seller-'+e.markerId, 272 + let obj={
274 markers:markers, 273 markers:markers,
275 - }) 274 + };
  275 + if(flag){
  276 + obj.scrollIntoView='seller-'+e.markerId;
  277 + }
  278 + this.setData(obj)
276 }, 279 },
277 async getMarkers(){ 280 async getMarkers(){
278 let cmap=this.data.map; 281 let cmap=this.data.map;
@@ -414,4 +417,21 @@ Page({ @@ -414,4 +417,21 @@ Page({
414 map:map, 417 map:map,
415 }) 418 })
416 }, 419 },
  420 +
  421 + getClassNameFlag:true,
  422 + activeSellerID:'',
  423 + bindscroll(e){
  424 + if(!this.getClassNameFlag) return;
  425 + this.getClassNameFlag=false;
  426 + let w=e.detail.scrollWidth/this.sellers.length;
  427 + let i=Math.round(e.detail.scrollLeft/w);
  428 + console.log(e.detail,this.sellers,i);
  429 + if(this.activeSellerID!=this.sellers[i].id){
  430 + this.activeSellerID=this.sellers[i];
  431 + this.markertap({
  432 + markerId:this.sellers[i].id
  433 + },false)
  434 + }
  435 + this.getClassNameFlag=true;
  436 + },
417 }) 437 })
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 scroll-x 45 scroll-x
46 class="scroll-view_H" 46 class="scroll-view_H"
47 scroll-into-view="{{scrollIntoView}}" 47 scroll-into-view="{{scrollIntoView}}"
  48 + bindscroll="bindscroll"
48 > 49 >
49 <view class="flex-ll"> 50 <view class="flex-ll">
50 <view class="seller" wx:for="{{sellers}}" wx:key="{{sellers.key}}" id="seller-{{item.id}}"> 51 <view class="seller" wx:for="{{sellers}}" wx:key="{{sellers.key}}" id="seller-{{item.id}}">