Authored by baoss

实现首页筛选tab切换及筛选弹层,增加遮盖层禁止滚动

... ... @@ -21,6 +21,6 @@
{{/each}}
</ul>
</div>
<div class="cancelBtn">取消</div>
<div class="cancel-btn">取消</div>
</div>
{{/ filter}}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@ import Swiper from 'yoho-swiper';
import $ from 'yoho-jquery';
import Page from 'js/yoho-page';
import filter from 'js/plugin/filter';
let innerScroll = require('js/plugin/inner-scroll');
// import lazyLoad from 'yoho-jquery-lazyload';
// import tip from 'js/plugin/tip';
... ... @@ -105,15 +106,18 @@ class Group extends Page {
if ($this.hasClass('active')) {
$('.filter-mask').addClass('hide');
$this.removeClass('active');
} else {
$this.addClass('active');
filter.showFilter();
innerScroll.disableScroll($('body'));
}
} else {
this.selector.filterTab.children('li').removeClass('active');
$this.addClass('active');
this.filterTab[currentChannel].$pre = $this;
// 不为筛选tab时直接查询数据
this.search();
}
// 最新和人气
... ... @@ -130,9 +134,6 @@ class Group extends Page {
nav.order = nav.order === 's_p_asc' ? 's_p_desc' : 's_p_asc'; // 切换排序
this.filterTab[currentChannel].order = nav.order;
}
this.search();
}
groupTabChange(e) {
... ... @@ -162,6 +163,7 @@ class Group extends Page {
this.selector.filterTab.children('li').removeClass('active');
filterTab.$pre.addClass('active');
// 价格筛选状态设置
if (filterTab.$pre.hasClass('price')) {
navInfo.price.order = filterTab.order;
... ... @@ -172,6 +174,9 @@ class Group extends Page {
filterTab.$pre.find('.icon > .down').addClass('cur');
}
}
// 重置筛选页面条件
filter.resetFilter();
this.search();
}
... ... @@ -200,7 +205,7 @@ class Group extends Page {
search() {
let params = this.filterTab[this.selectedChannel];
console.log(params, this.navInfo.price);
console.log('searchParam', params);
// let setting;
... ... @@ -224,11 +229,14 @@ class Group extends Page {
// 筛选初始化
filterInit() {
let $filterMask;
let requestParams = this.filterTab[this.selectedChannel];
let requestParams = {
...this.filterTab[this.selectedChannel]
};
let filterTab = this.selector.filterTab;
let search = this.search.bind(this);
delete requestParams.$pre;
console.log(requestParams);
console.log('initParam', requestParams);
$.ajax({
type: 'GET',
url: '/activity/group/filter',
... ... @@ -242,9 +250,10 @@ class Group extends Page {
// 初始化filter&注册filter回调
filter.initFilter({
fCbFn: this.search,
fCbFn: search,
hCbFn: function() {
filterTab.children('.filter').removeClass('active');
innerScroll.enableScroll($('body'));
},
missStatus: true
});
... ...
... ... @@ -80,7 +80,7 @@
top: 0;
right: 0;
left: 0;
z-index: 2;
z-index: 9999;
height: 100%;
background: rgba(0, 0, 0, 0.1);
}
... ... @@ -93,7 +93,7 @@
height: 80px;
line-height: 80px;
text-align: center;
z-index: 2;
z-index: 9999;
background-color: #444;
color: #fff;
}
... ... @@ -104,7 +104,7 @@
right: 0;
left: 0;
bottom: 80px;
z-index: 2;
z-index: 9999;
background: #fff;
color: #000;
font-size: 28px;
... ... @@ -159,7 +159,7 @@
overflow: auto;
-webkit-overflow-scrolling: touch;
width: 50%;
height: 880px;
height: 100%;
> li {
overflow: hidden;
... ...
... ... @@ -158,12 +158,24 @@ exports.processFilter = (list, options) => {
item = _sortListByField(item, 'name');
}
// 测试数据
// let example = [];
// for (let i = 0; i < 12; i++) {
// example.push({
// itemId: '1,3',
// itemName: 'MEN'
// });
// }
// item.itemList
_.forEach(item.itemList, (sub) => {
let subs = {};
subs.dataId = sub.itemId;
subs.name = sub.itemName;
// if (key === 'discount') {
// subs.dataId = sub._key;
// } else if (key === 'priceRange') {
... ... @@ -195,7 +207,6 @@ exports.processFilter = (list, options) => {
classify.subs.push(subs);
});
filters.classify[filtersType[key].sortNum] = classify;
});
... ...