Authored by 徐炜

Merge branch 'prod-list-optimization' into feature/prod-list-opt

# Conflicts:
#	apps/product/controllers/list.js
#	apps/product/controllers/search.js
#	public/js/product/search/list.js
... ... @@ -231,7 +231,7 @@ const category = (req, res, next) => {
navTitle: req.query.title || req.query.sort_name
}),
goodList: params,
firstPageGoodsList: firstScreenGoodsList,
firstPageGoodsList: firstScreenGoodsList.list,
showDownloadApp: true,
pageFooter: true,
category: true
... ...
... ... @@ -115,7 +115,7 @@ const list = (req, res, next) => {
}),
title: title,
goodList: params,
firstPageGoodsList: result[2] || [],
firstPageGoodsList: result[2].list || [],
pageFooter: true
});
}).catch(next);
... ... @@ -179,6 +179,12 @@ const search = (req, res, next) => {
params.isApp = req.yoho.isApp;
searchModel.getSearchData(params).then((result) => {
if (parseInt(params.page) === 1 && parseInt(params.start) > 0) {
// 首屏渲染时,使用 'start' 参数裁减已渲染数据
result.list = result.list.slice(params.start || 0);
}
if (result.list && result.list.length > 0) {
res.render('search/page', {
layout: false,
... ... @@ -189,11 +195,6 @@ const search = (req, res, next) => {
res.json(result);
}
if (parseInt(params.page) === 1 && parseInt(params.start) > 0) {
// 首屏渲染时,使用 'start' 参数裁减已渲染数据
result = result.slice(params.start || 0);
}
res.render('search/page', {
layout: false,
new: result
... ...