Authored by 徐炜

商品列表页优化

... ... @@ -13,6 +13,7 @@ const _ = require('lodash');
const crypto = global.yoho.crypto;
const helpers = global.yoho.helpers;
const productProcess = require(`${utils}/product-process`);
const searchModel = require(`${mRoot}/search`);
/**
* 从 useragent 获取 uid
... ... @@ -211,19 +212,24 @@ const shopFav = (req, res) => {
};
// 品类落地页
const category = (req, res) => {
const category = (req, res, next) => {
let params = Object.assign({}, req.query);
res.render('search/goods-list', {
module: 'product',
page: 'search-list',
pageHeader: headerModel.setNav({
navTitle: req.query.title || req.query.sort_name
}),
goodList: params,
showDownloadApp: true,
pageFooter: true
});
// 获取第一页数据
searchModel.getSearchData(Object.assign({page: 1, limit: 6}, params)).then((firstPageGoodsList) => {
res.render('search/goods-list', {
_noLazy: true, // 首屏不使用lazyload
module: 'product',
page: 'search-list',
pageHeader: headerModel.setNav({
navTitle: req.query.title || req.query.sort_name
}),
goodList: params,
firstPageGoodsList: firstPageGoodsList,
showDownloadApp: true,
pageFooter: true
});
}).catch(next);
};
/**
... ...
... ... @@ -132,6 +132,7 @@ const list = (req, res, next) => {
*/
const index = (req, res, next) => {
let title = '搜索';
((render) => {
if (_.get(req, 'app.locals.wap.search.removeHotSearch', false)) {
render([]);
... ...
<div class="good-list-page yoho-page">
{{#firstPageGoodsList}}
{{> common/goods}}
{{/firstPageGoodsList}}
{{> search/list}}
</div>
... ...
{{#if this}} {{!-- 剔除值为false的项 --}}
<div class="good-info {{#if @root.sale_vip_login}}sale-vip{{/if}}" data-good-id="{{product_id}}" data-id="{{product_skn}}" data-bp-id="guang_goodList_{{product_name}}_false">
<div class="good-info {{#if @root.sale_vip_login}}sale-vip{{/if}}" data-good-id="{{product_id}}"
data-id="{{product_skn}}" data-bp-id="guang_goodList_{{product_name}}_false">
<div class="tag-container clearfix">
{{# tags}}
{{# is_new}}
... ... @@ -27,7 +28,11 @@
</div>
<div class="good-detail-img">
<a class="good-thumb" href="{{url}}">
<img class="lazy" data-original="{{image default_images 235 314}}">
{{#if @root._noLazy}}
<img src="{{image default_images 235 314}}" width="470" height="628"/>
{{else}}
<img class="lazy" data-original="{{image default_images 235 314}}"/>
{{/if}}
</a>
{{# is_soon_sold_out}}
<p class="few-tag">即将售罄</p>
... ...