Commit 4b64f30a699ab919f7b038d4447d1ed7009d35fc

Authored by vking
1 parent 25a2b9d0

new 2.0

@@ -12,6 +12,8 @@ Page({ @@ -12,6 +12,8 @@ Page({
12 map:{}, 12 map:{},
13 height:1000, 13 height:1000,
14 hasLoading:true, 14 hasLoading:true,
  15 + activeSellerID:'',//高亮商家
  16 + scrollSellerID:'',//滚动到商家
15 }, 17 },
16 user:{}, 18 user:{},
17 /** 19 /**
@@ -252,7 +254,7 @@ Page({ @@ -252,7 +254,7 @@ Page({
252 this.markertap({markerId:this.data.markers[0].id}) 254 this.markertap({markerId:this.data.markers[0].id})
253 } 255 }
254 }, 256 },
255 - markertap(e){ 257 + markertap(e,scrollTo=true){
256 if(!e.markerId || e.markerId=='local') return; 258 if(!e.markerId || e.markerId=='local') return;
257 let markers=this.data.markers 259 let markers=this.data.markers
258 this.activeSellerID = e.markerId 260 this.activeSellerID = e.markerId
@@ -284,6 +286,9 @@ Page({ @@ -284,6 +286,9 @@ Page({
284 markers: markers, 286 markers: markers,
285 activeSellerID:this.activeSellerID, 287 activeSellerID:this.activeSellerID,
286 }; 288 };
  289 + if(scrollTo){
  290 + obj.scrollSellerID=this.activeSellerID
  291 + }
287 this.setData(obj) 292 this.setData(obj)
288 }, 293 },
289 filterGroupData:{}, 294 filterGroupData:{},
@@ -297,6 +302,25 @@ Page({ @@ -297,6 +302,25 @@ Page({
297 this.selectComponent('#as').show(e.detail.seller); 302 this.selectComponent('#as').show(e.detail.seller);
298 } 303 }
299 }, 304 },
  305 + scrollEvent(e){
  306 + let idx=0
  307 + if(e.detail.scrollTop>20){
  308 + idx=parseInt(e.detail.scrollTop/162)
  309 + let ms=(e.detail.scrollTop%162)>100?1:0;
  310 + idx+=ms;
  311 + }
  312 + //console.log('scrollEvent',e,e.detail.scrollTop,idx)
  313 + //console.log('scrollEvent',this.sellers[idx].sellername)
  314 + this.debounce(()=>{
  315 + this.scrollEventActive(idx)
  316 + },300)
  317 + },
  318 + scrollEventActive(idx){
  319 + if(this.sellers[idx]){
  320 + //this.activeSellerID=this.sellers[idx].id
  321 + this.markertap({markerId:this.sellers[idx].id},false)
  322 + }
  323 + },
300 back:function() { 324 back:function() {
301 /* 325 /*
302 var mta = require('mta-wechat-analysis') 326 var mta = require('mta-wechat-analysis')
@@ -53,9 +53,10 @@ @@ -53,9 +53,10 @@
53 </block> 53 </block>
54 <block wx:else=""> 54 <block wx:else="">
55 <scroll-view class="view scroll-view" scroll-y="true" 55 <scroll-view class="view scroll-view" scroll-y="true"
56 - scroll-into-view="seller-{{activeSellerID}}" 56 + scroll-into-view="seller-{{scrollSellerID}}"
57 scroll-with-animation 57 scroll-with-animation
58 - bindscroll="scroll" style="width:100%;height: {{height-50}}px;"> 58 + bindscroll="scrollEvent"
  59 + style="width:100%;height: {{height-50}}px;">
59 <block wx:for="{{sellers}}" wx:key="sellers" > 60 <block wx:for="{{sellers}}" wx:key="sellers" >
60 <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover"> 61 <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover">
61 <seller-card class="seller-card" id="seller-{{item.id}}" 62 <seller-card class="seller-card" id="seller-{{item.id}}"