Authored by htoooth

Merge branch 'feature/searchLess' into release/5.5

... ... @@ -20,6 +20,7 @@ const config = global.yoho.config;
*/
const index = (req, res, next) => {
let params = req.query;
let resData = {
title: '潮流商品搜索 | YOHO!BUY 有货',
keywords: 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,' +
... ... @@ -43,6 +44,7 @@ const index = (req, res, next) => {
return res.render('search/no-result', resData);
}
res.render('search/index', resData);
});
}).catch(next);
};
... ...
... ... @@ -40,6 +40,7 @@ const transPrice = (price) => {
* @return {[type]} [description]
*/
exports.getSearchData = (params, channel) => {
let searchParams = searchHandler.getSearchParams(params);
switch (channel) {
... ... @@ -114,7 +115,7 @@ exports.getSearchData = (params, channel) => {
hasNextPage: searchHandler.handleNextPage(params, result[2].data.total),
shopEntry: result[3],
name: params.query,
suggest: (termsSuggestion.length !== 0) ? termsSuggestion.splice(0, 3) : false,
suggest: (termsSuggestion.length !== 0) ? termsSuggestion.slice(0, 3) : false,
changedQuery: result[2].data.isChangedQuery === 'Y',
suggestFirst: finalResult.search.suggestFirst,
suggestSecond: finalResult.search.suggestSecond
... ...
... ... @@ -67,16 +67,15 @@
</div>
{{/unless}}
{{/if}}
{{/if_cond}}
{{#if changedQuery}}
<div class="search-suggest-less">
没有找到&nbsp;"<em>{{name}}</em>"&nbsp;相关的商品,
为您推荐&nbsp;"<a href="/?query={{suggestFirst}}">{{suggestFirst}}</a>"&nbsp;的搜索结果。或者试试{{#suggestSecond}}&nbsp;"<a href="/?query={{.}}">{{.}}</a>"&nbsp;{{/suggestSecond}}
</div>
{{/if}}
{{#if changedQuery}}
<div class="search-suggest-less">
没有找到&nbsp;"<em>{{name}}</em>"&nbsp;相关的商品,
为您推荐&nbsp;"<a href="/?query={{suggestFirst}}">{{suggestFirst}}</a>"&nbsp;的搜索结果。{{#if suggestSecond}}或者试试{{#suggestSecond}}&nbsp;"<a href="/?query={{.}}">{{.}}</a>"&nbsp;{{/suggestSecond}}{{/if}}
</div>
{{/if}}
{{/if_cond}}
{{> list/top-coupon}}
... ...