...
|
...
|
@@ -31,27 +31,29 @@ class NewRecommend extends Page { |
|
|
}
|
|
|
|
|
|
getRecommend() {
|
|
|
this.ajax({
|
|
|
url: '/product/new-recommend/getRecommend',
|
|
|
}).then((result) => {
|
|
|
if (result) {
|
|
|
if (result.goods.length > 0) {
|
|
|
let goodsData = {
|
|
|
goods: result.goods
|
|
|
};
|
|
|
let $goodsData = $(this.view.goodsRender(goodsData));
|
|
|
|
|
|
this.selector.$goodsContainer.append($goodsData);
|
|
|
lazyLoad($goodsData.find('img.lazy'));
|
|
|
window.rePosFooter();
|
|
|
} else {
|
|
|
this.selector.$recommendC.remove();
|
|
|
if (this.selector.$recommendC.data('switch') !== true) {
|
|
|
this.ajax({
|
|
|
url: '/product/new-recommend/getRecommend',
|
|
|
}).then((result) => {
|
|
|
if (result) {
|
|
|
if (result.goods.length > 0) {
|
|
|
let goodsData = {
|
|
|
goods: result.goods
|
|
|
};
|
|
|
let $goodsData = $(this.view.goodsRender(goodsData));
|
|
|
|
|
|
this.selector.$goodsContainer.append($goodsData);
|
|
|
lazyLoad($goodsData.find('img.lazy'));
|
|
|
window.rePosFooter();
|
|
|
} else {
|
|
|
this.selector.$recommendC.remove();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
console.error(error);
|
|
|
this.selector.$recommendC.remove();
|
|
|
});
|
|
|
}).catch(error => {
|
|
|
console.error(error);
|
|
|
this.selector.$recommendC.remove();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|