Authored by 郭成尧

'recommendProducts'

... ... @@ -204,7 +204,6 @@
const editorialId = $('#app').data('editorialId');
this.id = editorialId;
let loadDeferred = null;
$.get(`/editorial/editorial_${editorialId}.json`).then(result => {
const article = result[0],
... ... @@ -212,7 +211,7 @@
brands = result[2],
other = result[3];
let goods, prodMap = {};
let goods = {};
if (article && article.code === 200 && article.data) {
this.article = article.data;
... ... @@ -237,27 +236,19 @@
}
// 延时读取商品价格、名称等信息
loadDeferred = () => {
if (!goods || !goods.length) {
return;
}
$.get('/product/search_product.json', {
ids: goods.map((item)=> {
return item.id;
}).join(',')
}).then((data)=> {
if (data.data) {
this.$set('recommendProducts', data.data.productList);
}
});
};
});
$(window).on('scroll', ()=> {
if ($(window).scrollTop() > 100 && loadDeferred) {
loadDeferred();
loadDeferred = null;
if (!goods || !goods.length) {
return;
}
$.get('/product/search_product.json', {
ids: goods.map((item)=> {
return item.id;
}).join(',')
}).then((data) => {
if (data.data) {
this.$set('recommendProducts', data.data.productList);
}
});
});
}
};
... ...