|
@@ -72,6 +72,10 @@ Page({ |
|
@@ -72,6 +72,10 @@ Page({ |
|
72
|
totalHeight: getApp().system.windowHeight,
|
72
|
totalHeight: getApp().system.windowHeight,
|
|
73
|
kindHeight: getApp().system.windowHeight - 68
|
73
|
kindHeight: getApp().system.windowHeight - 68
|
|
74
|
})
|
74
|
})
|
|
|
|
75
|
+ setTimeout(()=>{
|
|
|
|
76
|
+ this.initScrollHeightList();
|
|
|
|
77
|
+ },1000)
|
|
|
|
78
|
+
|
|
75
|
},
|
79
|
},
|
|
76
|
|
80
|
|
|
77
|
/**
|
81
|
/**
|
|
@@ -260,39 +264,44 @@ Page({ |
|
@@ -260,39 +264,44 @@ Page({ |
|
260
|
})
|
264
|
})
|
|
261
|
},
|
265
|
},
|
|
262
|
getClassNameFlag:true,
|
266
|
getClassNameFlag:true,
|
|
263
|
- async bindscroll(e){
|
267
|
+ bindscroll(e){
|
|
264
|
if(!this.getClassNameFlag) return;
|
268
|
if(!this.getClassNameFlag) return;
|
|
265
|
- console.log(e);
|
|
|
|
266
|
this.getClassNameFlag=false;
|
269
|
this.getClassNameFlag=false;
|
|
267
|
- let activeId=await this.getClassName();
|
|
|
|
268
|
- this.getClassNameFlag=true;
|
|
|
|
269
|
- this.setData({
|
|
|
|
270
|
- activeId:activeId,
|
270
|
+ console.log('this.scrollHeightList',this.scrollHeightList)
|
|
|
|
271
|
+ let maxMX=9999999;
|
|
|
|
272
|
+ let activeId='';
|
|
|
|
273
|
+ Object.keys(this.scrollHeightList).forEach(tid=>{
|
|
|
|
274
|
+ let mx=parseInt(e.detail.scrollTop)-parseInt(this.scrollHeightList[tid].top)
|
|
|
|
275
|
+ if(mx>-100){
|
|
|
|
276
|
+ if(mx<maxMX) {
|
|
|
|
277
|
+ maxMX=mx;
|
|
|
|
278
|
+ activeId=tid;
|
|
|
|
279
|
+ }
|
|
|
|
280
|
+ }
|
|
271
|
})
|
281
|
})
|
|
|
|
282
|
+ if(activeId){
|
|
|
|
283
|
+ console.log(activeId, this.scrollHeightList[activeId].dataset.name)
|
|
|
|
284
|
+ this.setData({
|
|
|
|
285
|
+ activeId:activeId,
|
|
|
|
286
|
+ })
|
|
|
|
287
|
+ this.selectComponent("#menu").activeMenuID(activeId);
|
|
|
|
288
|
+ }
|
|
|
|
289
|
+ this.getClassNameFlag=true;
|
|
272
|
},
|
290
|
},
|
|
273
|
- getClassName(){
|
291
|
+ scrollHeightList:{},
|
|
|
|
292
|
+ initScrollHeightList(scroll){
|
|
|
|
293
|
+ //if(Object.keys(this.scrollHeightList).length>0) return;
|
|
274
|
let that=this;
|
294
|
let that=this;
|
|
275
|
return new Promise(function(success,fail){
|
295
|
return new Promise(function(success,fail){
|
|
276
|
- let activeId='';
|
|
|
|
277
|
- let activeTop=-100000;
|
|
|
|
278
|
var query = wx.createSelectorQuery();
|
296
|
var query = wx.createSelectorQuery();
|
|
279
|
query.selectAll('.list-model-masonry').boundingClientRect()
|
297
|
query.selectAll('.list-model-masonry').boundingClientRect()
|
|
280
|
query.exec(function (res) {
|
298
|
query.exec(function (res) {
|
|
281
|
for(let i=0;i<res[0].length;i++){
|
299
|
for(let i=0;i<res[0].length;i++){
|
|
282
|
let x=res[0][i];
|
300
|
let x=res[0][i];
|
|
283
|
- if(x.top<150){
|
|
|
|
284
|
- console.log(x)
|
|
|
|
285
|
- if(x.top>activeTop){
|
|
|
|
286
|
- activeTop=x.top
|
|
|
|
287
|
- activeId=x.id
|
|
|
|
288
|
- }
|
|
|
|
289
|
- }
|
|
|
|
290
|
- }
|
|
|
|
291
|
- console.log('class_name-activeId',activeId,activeTop);
|
|
|
|
292
|
- if(activeTop>32){
|
|
|
|
293
|
- activeId='';
|
301
|
+ //x.top=parseInt(scroll.detail.scrollTop)+parseInt(x.top);
|
|
|
|
302
|
+ that.scrollHeightList[x.id]=x;
|
|
294
|
}
|
303
|
}
|
|
295
|
- success(activeId)
|
304
|
+ success()
|
|
296
|
})
|
305
|
})
|
|
297
|
})
|
306
|
})
|
|
298
|
},
|
307
|
},
|