|
...
|
...
|
@@ -72,6 +72,10 @@ Page({ |
|
|
|
totalHeight: getApp().system.windowHeight,
|
|
|
|
kindHeight: getApp().system.windowHeight - 68
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.initScrollHeightList();
|
|
|
|
},1000)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -260,39 +264,44 @@ Page({ |
|
|
|
})
|
|
|
|
},
|
|
|
|
getClassNameFlag:true,
|
|
|
|
async bindscroll(e){
|
|
|
|
bindscroll(e){
|
|
|
|
if(!this.getClassNameFlag) return;
|
|
|
|
console.log(e);
|
|
|
|
this.getClassNameFlag=false;
|
|
|
|
let activeId=await this.getClassName();
|
|
|
|
this.getClassNameFlag=true;
|
|
|
|
this.setData({
|
|
|
|
activeId:activeId,
|
|
|
|
console.log('this.scrollHeightList',this.scrollHeightList)
|
|
|
|
let maxMX=9999999;
|
|
|
|
let activeId='';
|
|
|
|
Object.keys(this.scrollHeightList).forEach(tid=>{
|
|
|
|
let mx=parseInt(e.detail.scrollTop)-parseInt(this.scrollHeightList[tid].top)
|
|
|
|
if(mx>-100){
|
|
|
|
if(mx<maxMX) {
|
|
|
|
maxMX=mx;
|
|
|
|
activeId=tid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if(activeId){
|
|
|
|
console.log(activeId, this.scrollHeightList[activeId].dataset.name)
|
|
|
|
this.setData({
|
|
|
|
activeId:activeId,
|
|
|
|
})
|
|
|
|
this.selectComponent("#menu").activeMenuID(activeId);
|
|
|
|
}
|
|
|
|
this.getClassNameFlag=true;
|
|
|
|
},
|
|
|
|
getClassName(){
|
|
|
|
scrollHeightList:{},
|
|
|
|
initScrollHeightList(scroll){
|
|
|
|
//if(Object.keys(this.scrollHeightList).length>0) return;
|
|
|
|
let that=this;
|
|
|
|
return new Promise(function(success,fail){
|
|
|
|
let activeId='';
|
|
|
|
let activeTop=-100000;
|
|
|
|
var query = wx.createSelectorQuery();
|
|
|
|
query.selectAll('.list-model-masonry').boundingClientRect()
|
|
|
|
query.exec(function (res) {
|
|
|
|
for(let i=0;i<res[0].length;i++){
|
|
|
|
let x=res[0][i];
|
|
|
|
if(x.top<150){
|
|
|
|
console.log(x)
|
|
|
|
if(x.top>activeTop){
|
|
|
|
activeTop=x.top
|
|
|
|
activeId=x.id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log('class_name-activeId',activeId,activeTop);
|
|
|
|
if(activeTop>32){
|
|
|
|
activeId='';
|
|
|
|
//x.top=parseInt(scroll.detail.scrollTop)+parseInt(x.top);
|
|
|
|
that.scrollHeightList[x.id]=x;
|
|
|
|
}
|
|
|
|
success(activeId)
|
|
|
|
success()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
...
|
...
|
|