...
|
...
|
@@ -9,6 +9,7 @@ import innerScroll from 'js/plugin/inner-scroll'; |
|
|
import sharePlugin from 'js/common/share';
|
|
|
const querystring = require('querystring');
|
|
|
let groupListItem = require('hbs/activity/group/group-list-product.hbs');
|
|
|
let resources = require('hbs/activity/group/resources.hbs');
|
|
|
const yoho = require('js/yoho-app');
|
|
|
|
|
|
class Group extends Page {
|
...
|
...
|
@@ -106,7 +107,7 @@ class Group extends Page { |
|
|
|
|
|
$(window).scroll(() => {
|
|
|
window.requestAnimationFrame(() => {
|
|
|
self.scrollHandler();
|
|
|
// self.scrollHandler();
|
|
|
});
|
|
|
setTimeout(() => {
|
|
|
let afterScroll = window.scrollY;
|
...
|
...
|
@@ -261,9 +262,11 @@ class Group extends Page { |
|
|
}
|
|
|
}
|
|
|
|
|
|
guessLikeTabChange(e) {
|
|
|
async guessLikeTabChange(e) {
|
|
|
let that = this;
|
|
|
let $this = $(e.currentTarget);
|
|
|
let query = $this.data('query');
|
|
|
let code = $this.data('code');
|
|
|
let index = $this.data('index');
|
|
|
let tabName = $this.data('tab-name');
|
|
|
let templateName = $this.data('template-name');
|
...
|
...
|
@@ -298,26 +301,33 @@ class Group extends Page { |
|
|
let lastDom = document.getElementById(`tab-${index - 2}`);
|
|
|
|
|
|
$('.wapper').animate({scrollLeft: lastDom && lastDom.offsetLeft || 0});
|
|
|
|
|
|
if (document.getElementById('fixedTab').offsetTop) {
|
|
|
this.scrollSmoothTo(document.getElementById('fixedTab').offsetTop);
|
|
|
this.scrollSmoothTo(document.getElementById('resources').offsetTop);
|
|
|
|
|
|
// if (document.getElementById('fixedTab').offsetTop) {
|
|
|
// this.scrollSmoothTo(document.getElementById('fixedTab').offsetTop);
|
|
|
// } else {
|
|
|
// this.scrollSmoothTo(document.getElementById('goodsContainer').offsetTop);
|
|
|
// }
|
|
|
|
|
|
|
|
|
if (code) {
|
|
|
this.fetchResources({
|
|
|
code: code
|
|
|
}).then(res => {
|
|
|
that.renderFloor(res);
|
|
|
$('.guess-tab').children('div').removeClass('guess-tab-active');
|
|
|
$this.children('div').addClass('guess-tab-active');
|
|
|
$('.guess-tab').children('.guess-like-tab').removeClass('guess-like-tab-active');
|
|
|
$this.children('.guess-like-tab').addClass('guess-like-tab-active');
|
|
|
});
|
|
|
} else {
|
|
|
this.scrollSmoothTo(document.getElementById('goodsContainer').offsetTop);
|
|
|
$('.floors').html('');
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/activity/group/goods-tab',
|
|
|
data: queryObject,
|
|
|
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 || []);
|
|
|
}
|
|
|
this.fetchGoodsList(queryObject).then(data => {
|
|
|
that.renderMoreData(data.filterList || []);
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
scrollSmoothTo(position) {
|
...
|
...
|
@@ -376,6 +386,7 @@ class Group extends Page { |
|
|
}
|
|
|
|
|
|
loadMoreData() {
|
|
|
let that = this;
|
|
|
let newNavType = this.judgeNavType(this.newFilterTab);
|
|
|
let newNav = this.newNavInfo[newNavType];
|
|
|
|
...
|
...
|
@@ -388,17 +399,41 @@ class Group extends Page { |
|
|
|
|
|
newNav.end = true;
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/activity/group/goods-tab',
|
|
|
data: newQueryObject,
|
|
|
success: (data) => {
|
|
|
this.renderMoreData(data.filterList || [], true);
|
|
|
newNav.end = false;
|
|
|
},
|
|
|
error: () => {
|
|
|
newNav.end = false;
|
|
|
}
|
|
|
this.fetchGoodsList(newQueryObject).then(data => {
|
|
|
that.renderMoreData(data.filterList || [], true);
|
|
|
newNav.end = false;
|
|
|
}).catch(() => {
|
|
|
newNav.end = false;
|
|
|
});
|
|
|
}
|
|
|
fetchResources(query) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/activity/group/resources',
|
|
|
data: query,
|
|
|
success: (data) => {
|
|
|
resolve(data);
|
|
|
},
|
|
|
error: () => {
|
|
|
reject();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
fetchGoodsList(query) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/activity/group/goods-tab',
|
|
|
data: query,
|
|
|
success: (data) => {
|
|
|
resolve(data);
|
|
|
},
|
|
|
error: () => {
|
|
|
reject();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -526,7 +561,8 @@ class Group extends Page { |
|
|
slidesPerGroup: 3,
|
|
|
autoplay: speed,
|
|
|
autoplayDisableOnInteraction: false,
|
|
|
pagination: '.swiper-pagination',
|
|
|
pagination: '.swiper-pagination1',
|
|
|
paginationType: 'fraction',
|
|
|
paginationClickable: true,
|
|
|
loop: true
|
|
|
});
|
...
|
...
|
@@ -692,7 +728,13 @@ class Group extends Page { |
|
|
lazyLoad(groupListContent.find('img.lazy'));
|
|
|
}
|
|
|
}
|
|
|
renderFloor(data) {
|
|
|
let resourceHtml = resources(data);
|
|
|
|
|
|
$('.floors').html(resourceHtml);
|
|
|
this.swiperTop();
|
|
|
this.swiperGroup();
|
|
|
}
|
|
|
renderMoreData(list, isLoad) {
|
|
|
let appendHtml = '';
|
|
|
|
...
|
...
|
@@ -709,6 +751,7 @@ class Group extends Page { |
|
|
// 筛选初始化
|
|
|
filterInit() {
|
|
|
$('.guess-scroll').find('div:first-child').children('div').addClass('guess-tab-active');
|
|
|
$('.guess-scroll').find('div:first-child').children('.guess-like-tab').addClass('guess-like-tab-active');
|
|
|
let first = $('.guess-scroll').find('div:first-child');
|
|
|
|
|
|
this.tabName = first.data('tab-name');
|
...
|
...
|
|