|
@@ -152,6 +152,7 @@ export default {
|
|
|
});
|
|
});
|
|
|
this.productInfo = data;
|
|
this.productInfo = data;
|
|
|
this.classIndex = 0;
|
|
this.classIndex = 0;
|
|
|
|
|
+ this.scroll_into_view = 'class_'+0;
|
|
|
this.scrollPushList();
|
|
this.scrollPushList();
|
|
|
// console.log(this.filterProductInfo)
|
|
// console.log(this.filterProductInfo)
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -164,7 +165,18 @@ export default {
|
|
|
* **/
|
|
* **/
|
|
|
scrollPushList(){
|
|
scrollPushList(){
|
|
|
let list = copyObject(this.productInfo);
|
|
let list = copyObject(this.productInfo);
|
|
|
|
|
+ let classList = [];
|
|
|
|
|
+ for (let i=0;i<list.length;i++){
|
|
|
|
|
+ if(i<2){
|
|
|
|
|
|
|
|
|
|
+ classList.push({...list[i],isActive:true});
|
|
|
|
|
+ }else{
|
|
|
|
|
+ classList.push({...list[i],isActive:false});
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.filterProductInfo = classList
|
|
|
|
|
+ console.log(classList)
|
|
|
|
|
+ return
|
|
|
if(this.$util.isEmpty(this.filterProductInfo)){ //第一次进入无数据
|
|
if(this.$util.isEmpty(this.filterProductInfo)){ //第一次进入无数据
|
|
|
let classList = [];
|
|
let classList = [];
|
|
|
list.forEach(ele=>{
|
|
list.forEach(ele=>{
|
|
@@ -510,20 +522,24 @@ export default {
|
|
|
*/
|
|
*/
|
|
|
swichClass(cur) {
|
|
swichClass(cur) {
|
|
|
this.isCut = true;
|
|
this.isCut = true;
|
|
|
- // let cur = e.currentTarget.dataset.current;
|
|
|
|
|
- // if (this.classIndex == cur) {
|
|
|
|
|
- // return false;
|
|
|
|
|
- // } else {}
|
|
|
|
|
- clearInterval(this.timeFun)
|
|
|
|
|
|
|
+ console.log(cur,this.filterProductInfo.length-1);
|
|
|
|
|
+
|
|
|
|
|
+ this.filterProductInfo[cur].isActive = true;
|
|
|
|
|
+ if(cur==this.filterProductInfo.length-1){
|
|
|
|
|
+ this.filterProductInfo[cur-1].isActive = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(cur!=0&&cur!=this.filterProductInfo.length-1){
|
|
|
|
|
+ this.filterProductInfo[cur-1].isActive = true;
|
|
|
|
|
+ this.filterProductInfo[cur+1].isActive = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // clearInterval(this.timeFun)
|
|
|
this.scroll_into_view = '';
|
|
this.scroll_into_view = '';
|
|
|
this.$nextTick(()=>{
|
|
this.$nextTick(()=>{
|
|
|
this.scroll_into_view = 'class_'+cur;
|
|
this.scroll_into_view = 'class_'+cur;
|
|
|
this.classIndex = cur;
|
|
this.classIndex = cur;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- this.scrollPushList();
|
|
|
|
|
|
|
+ // this.scrollPushList();
|
|
|
//解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
|
|
//解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
|
|
|
uni.setStorageSync("resolve","last");
|
|
uni.setStorageSync("resolve","last");
|
|
|
setTimeout(()=>{
|
|
setTimeout(()=>{
|
|
@@ -564,19 +580,24 @@ export default {
|
|
|
let node2 = this.top_list[i+1];
|
|
let node2 = this.top_list[i+1];
|
|
|
if(node2 && top_page >= node1 && top_page < node2){
|
|
if(node2 && top_page >= node1 && top_page < node2){
|
|
|
this.classIndex = i;
|
|
this.classIndex = i;
|
|
|
- this.scrollPushList();
|
|
|
|
|
|
|
+ this.filterProductInfo[this.classIndex].isActive = true;
|
|
|
|
|
+ this.filterProductInfo[this.classIndex+1].isActive = true;
|
|
|
|
|
+ // this.scrollPushList();
|
|
|
break;
|
|
break;
|
|
|
}else if(node2 && top_page === node2){
|
|
}else if(node2 && top_page === node2){
|
|
|
this.classIndex = i + 1;
|
|
this.classIndex = i + 1;
|
|
|
- this.scrollPushList();
|
|
|
|
|
|
|
+ this.filterProductInfo[this.classIndex].isActive = true;
|
|
|
|
|
+ this.filterProductInfo[this.classIndex+1].isActive = true;
|
|
|
|
|
+ // this.scrollPushList();
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- console.log(this.classIndex,'this.classIndex----')
|
|
|
|
|
|
|
+ // console.log(this.classIndex,'this.classIndex----')
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
scroll_bottom(){
|
|
scroll_bottom(){
|
|
|
this.classIndex = this.filterProductInfo.length-1
|
|
this.classIndex = this.filterProductInfo.length-1
|
|
|
- this.scrollPushList();
|
|
|
|
|
|
|
+ this.filterProductInfo[this.classIndex].isActive = true;
|
|
|
|
|
+ // this.scrollPushList();
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 搜索对应花材
|
|
* 搜索对应花材
|
|
@@ -588,7 +609,7 @@ export default {
|
|
|
if(this.py.length <=1){
|
|
if(this.py.length <=1){
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- clearInterval(this.timeFun)
|
|
|
|
|
|
|
+ // clearInterval(this.timeFun)
|
|
|
let commonChildList = [];
|
|
let commonChildList = [];
|
|
|
list.forEach(ele => {
|
|
list.forEach(ele => {
|
|
|
//过滤常用
|
|
//过滤常用
|
|
@@ -601,13 +622,13 @@ export default {
|
|
|
let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) == 0;
|
|
let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) == 0;
|
|
|
if (hasName || hasPy) {
|
|
if (hasName || hasPy) {
|
|
|
if(this.$util.isEmpty(commonChildList)){
|
|
if(this.$util.isEmpty(commonChildList)){
|
|
|
- commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,child:[obj]}];
|
|
|
|
|
|
|
+ commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,isActive:true,child:[obj]}];
|
|
|
}else{
|
|
}else{
|
|
|
commonChildList.forEach(res => {
|
|
commonChildList.forEach(res => {
|
|
|
if(res.classId==ele.classId){
|
|
if(res.classId==ele.classId){
|
|
|
res.child.push(obj)
|
|
res.child.push(obj)
|
|
|
}else{
|
|
}else{
|
|
|
- commonChildList.push({classId: ele.classId, className: ele.className,child:[obj]});
|
|
|
|
|
|
|
+ commonChildList.push({classId: ele.classId, className: ele.className,isActive:true,child:[obj]});
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -620,9 +641,11 @@ export default {
|
|
|
list = this.$util.unique(commonChildList)
|
|
list = this.$util.unique(commonChildList)
|
|
|
this.filterProductInfo = list;
|
|
this.filterProductInfo = list;
|
|
|
this.classIndex = 0;
|
|
this.classIndex = 0;
|
|
|
|
|
+ this.scroll_into_view = 'class_'+0;
|
|
|
}else{
|
|
}else{
|
|
|
this.filterProductInfo = '';
|
|
this.filterProductInfo = '';
|
|
|
this.classIndex = 0;
|
|
this.classIndex = 0;
|
|
|
|
|
+ this.scroll_into_view = 'class_'+0;
|
|
|
this.scrollPushList();
|
|
this.scrollPushList();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|