...
|
...
|
@@ -53,6 +53,20 @@ class Group extends Page { |
|
|
end: false
|
|
|
}
|
|
|
};
|
|
|
this.newNavInfo = {
|
|
|
first: {
|
|
|
page: 1,
|
|
|
end: false,
|
|
|
reload: false,
|
|
|
isScrollLoad: false,
|
|
|
},
|
|
|
other: {
|
|
|
reload: true,
|
|
|
page: 1,
|
|
|
end: false,
|
|
|
isScrollLoad: false,
|
|
|
},
|
|
|
};
|
|
|
this.beforeScroll = document.body.scrollTop; // 滚动前位置记录
|
|
|
this.selectedChannel = ($('#fixedTab').data('group') || '1') === '1' ? 'newGroup' : 'normalGroup';
|
|
|
|
...
|
...
|
@@ -70,6 +84,9 @@ class Group extends Page { |
|
|
}
|
|
|
};
|
|
|
|
|
|
// guess-tab-active
|
|
|
this.newFilterTab = this.selector.guessLike.find('.guess-tab-active');
|
|
|
|
|
|
// 筛选页条件存储
|
|
|
this.filterPage = {
|
|
|
newGroup: {},
|
...
|
...
|
@@ -136,13 +153,25 @@ class Group extends Page { |
|
|
let floorsContentHeight = this.selector.floorsContentHeight + 5;
|
|
|
let goodsContainerHeight = this.selector.groupListContent.height();
|
|
|
let navType = this.judgeType(this.filterTab[this.selectedChannel].$pre);
|
|
|
let newNavType = this.judgeNavType(this.newFilterTab);
|
|
|
let nav = this.navInfo[navType];
|
|
|
let newNav = this.newNavInfo[newNavType];
|
|
|
|
|
|
if (($(window).scrollTop() - floorsContentHeight) > goodsContainerHeight * 0.6) {
|
|
|
nav.reload = false;
|
|
|
nav.isScrollLoad = true;
|
|
|
if (!nav.end) {
|
|
|
this.search();
|
|
|
if (nav) {
|
|
|
nav.reload = false;
|
|
|
nav.isScrollLoad = true;
|
|
|
if (!nav.end) {
|
|
|
this.search();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (newNav) {
|
|
|
newNav.reload = false;
|
|
|
newNav.isScrollLoad = true;
|
|
|
if (!newNav.end) {
|
|
|
this.loadMoreData();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -197,10 +226,14 @@ class Group extends Page { |
|
|
let $this = $(e.currentTarget);
|
|
|
let query = $this.data('query');
|
|
|
let queryObject = {};
|
|
|
let newNavType = this.judgeNavType(this.newFilterTab);
|
|
|
let newNav = this.newNavInfo[newNavType];
|
|
|
|
|
|
query.forEach(item => {
|
|
|
queryObject = Object.assign(queryObject, item);
|
|
|
});
|
|
|
|
|
|
newNav.query = queryObject;
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/activity/group/goods-tab',
|
...
|
...
|
@@ -216,6 +249,38 @@ class Group extends Page { |
|
|
});
|
|
|
}
|
|
|
|
|
|
loadMoreData() {
|
|
|
let newNavType = this.judgeNavType(this.newFilterTab);
|
|
|
let newNav = this.newNavInfo[newNavType];
|
|
|
|
|
|
console.log(newNav);
|
|
|
newNav.page++;
|
|
|
|
|
|
let newQueryObject = {
|
|
|
...newNav.query,
|
|
|
page: newNav.page
|
|
|
};
|
|
|
|
|
|
console.log(newNav.page);
|
|
|
|
|
|
newNav.end = true;
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/activity/group/goods-tab',
|
|
|
data: newQueryObject,
|
|
|
success: (data) => {
|
|
|
// $('.filter-mask').remove();
|
|
|
// $('.group').append(data);
|
|
|
// $('.guess-scroll').find('')
|
|
|
// $('.guess-tab').children('div').removeClass('guess-tab-active');
|
|
|
// $this.children('div').addClass('guess-tab-active');
|
|
|
this.renderMoreData(data.filterList || [], true);
|
|
|
newNav.end = false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 筛选tab切换
|
|
|
filterTabChange(e) {
|
|
|
let $this = $(e.currentTarget);
|
...
|
...
|
@@ -336,7 +401,7 @@ class Group extends Page { |
|
|
if (list.data('prd-list-length') > 0) {
|
|
|
new Swiper('.swiper-container', {
|
|
|
slidesPerView: 3,
|
|
|
spaceBetween: 20,
|
|
|
spaceBetween: 10,
|
|
|
slidesPerGroup: 3,
|
|
|
autoplay: speed,
|
|
|
autoplayDisableOnInteraction: false,
|
...
|
...
|
@@ -362,6 +427,18 @@ class Group extends Page { |
|
|
}
|
|
|
}
|
|
|
|
|
|
judgeNavType(dom) {
|
|
|
let navType;
|
|
|
|
|
|
if (dom.hasClass('first')) {
|
|
|
navType = 'first';
|
|
|
} else {
|
|
|
navType = 'other';
|
|
|
}
|
|
|
|
|
|
return navType;
|
|
|
}
|
|
|
|
|
|
// 判断导航类型
|
|
|
judgeType(dom) {
|
|
|
let navType;
|
...
|
...
|
@@ -494,13 +571,17 @@ class Group extends Page { |
|
|
}
|
|
|
}
|
|
|
|
|
|
renderMoreData(list) {
|
|
|
renderMoreData(list, isLoad) {
|
|
|
let appendHtml = '';
|
|
|
|
|
|
list.forEach(item => {
|
|
|
appendHtml += groupListItem(item);
|
|
|
});
|
|
|
$('.new-goods-list').html(appendHtml);
|
|
|
if (isLoad) {
|
|
|
$('.new-goods-list').append(appendHtml);
|
|
|
} else {
|
|
|
$('.new-goods-list').html(appendHtml);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 筛选初始化
|
...
|
...
|
|