Authored by 王水玲

Merge branch 'feature/wsl5.3' into release/2.0

... ... @@ -32,15 +32,7 @@ var recommmendProduct = {
params: params
});
// 最近预览
_this.getProducts({
url: '/product/recentPreview',
index: 1,
params: {
limit: 20
}
});
// tab切换
$dom.find('.head-tab').on('click', function() {
var index = $(this).index(),
$tabCont = $('.tab-cont-' + index);
... ... @@ -48,6 +40,9 @@ var recommmendProduct = {
$('.head-tab').removeClass('active');
$(this).addClass('active');
$tabCont.removeClass('hide').siblings().addClass('hide');
_this.lazyImage();
_this.isShowChangeBtn($tabCont.find('.goods-group').length);
});
_this.$changeBtn.on('click', function() {
... ... @@ -84,9 +79,10 @@ var recommmendProduct = {
},
getProducts: function(obj) {
var _this = this;
var $headTab = $('.head-tab');
$.get(obj.url, obj.params, function(result) {
var curTab = $('.head-tab').eq(obj.index);
var curTab = $headTab.eq(obj.index);
if (result.length) {
if (_this.$recommendHeader.hasClass('hide')) {
... ... @@ -99,20 +95,30 @@ var recommmendProduct = {
_this.$dom.find('.tab-cont-' + obj.index).html(recProduct({result: result}));
_this.lazyImage();
_this.isShowChangeBtn.bind(result.length);
_this.isShowChangeBtn(result.length);
if (obj.index === 1) {
if (obj.index === 1 && $headTab.eq(0).hasClass('hide')) {
curTab.click();
}
}
if (obj.index === 0) {
// 最近预览
_this.getProducts({
url: '/product/recentPreview',
index: 1,
params: {
limit: 20
}
});
}
});
},
isShowChangeBtn: function(currGoodsLen) {
if (currGoodsLen <= 1) {
this.$changeBtn.hide();
recommmendProduct.$changeBtn.hide();
} else {
this.$changeBtn.show();
recommmendProduct.$changeBtn.show();
}
},
lazyImage: function() {
... ...