Authored by 刘传洋

modify

... ... @@ -259,14 +259,14 @@ exports.handleOptsData = (params, total, extra) => {
// 上下翻页数据处理
dest.pageCounts = [{
href: handleFilterUrl(params, {limit: 200}),
count: 200
href: handleFilterUrl(params, {limit: 60}),
count: 60
}, {
href: handleFilterUrl(params, {limit: 100}),
count: 100
}, {
href: handleFilterUrl(params, {limit: 60}),
count: 60
href: handleFilterUrl(params, {limit: 200}),
count: 200
}];
dest.curPage = _.isEmpty(params.page) ? 1 : params.page; // 当前页码数
... ... @@ -577,6 +577,7 @@ exports.handleFilterData = (origin, params) => {
// 处理颜色选中数据
if (color.checked) {
color['href'] = handleFilterUrl(params, null, {color: value.color_id});
dest.checkedConditions.conditions.push(color);
}
... ... @@ -595,6 +596,7 @@ exports.handleFilterData = (origin, params) => {
// 处理颜色年龄段数据
if (ageLevel.checked) {
ageLevel['href'] = handleFilterUrl(params, null, {ageLevel: value.id});
dest.checkedConditions.conditions.push(ageLevel);
}
... ... @@ -1037,3 +1039,22 @@ exports.handleFilterUrl = handleFilterUrl;
* @type {[type]}
*/
exports.handleCheckedData = handleCheckedData;
exports.handleNextPage = (params, total) => {
let href;
let currentPage = parseInt((_.isEmpty(params.page) ? 1 : params.page), 10); // 当前页
let perPageCount = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10); // 每页商品数
let totalPage = parseInt(total / perPageCount, 10) + 1; // 总页数
if (currentPage === totalPage) {
return null;
} else {
href = handleFilterUrl(params, {page: currentPage + 1});
}
return {
href : href,
src : '//img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
}
}
\ No newline at end of file
... ...
... ... @@ -18,11 +18,13 @@ const searchHandler = require('./search-handler');
*/
exports.getSearchData = (params) => {
let mlimit = params && params.limit && params.limit > 0 ? params.limit - 1 : 59;
// 调用接口
let apiMethod = [
headerModel.requestHeaderData(),
searchApi.getSortList(),
searchApi.getProductList(params)
searchApi.getProductList(Object.assign({}, params, {limit : mlimit}))
];
// 搜索店铺
... ... @@ -54,7 +56,9 @@ exports.getSearchData = (params) => {
totalCount: result[2].data.total,
footPager: searchHandler.handlePagerData(result[2].data.total, params),
goods: productProcess.processProductList(result[2].data.product_list,
Object.assign({showDiscount: false}, params))
Object.assign({showDiscount: false}, params)),
latestWalk: 7,
hasNextPage : searchHandler.handleNextPage(params, result[2].data.total)
});
}
return finalResult;
... ...
<div class="product-page yoho-page">
<div class="product-list-page search-page product-page yoho-page">
{{# search}}
{{> list/list}}
... ...
... ... @@ -76,5 +76,7 @@
{{> product/standard-content}}
{{> product/latest-walk}}
</div>
</div>
... ...
... ... @@ -19,13 +19,13 @@ module.exports = {
api: 'http://api-test1.yohops.com:9999/',
// api: 'http://testapi.yoho.cn:28078/',
//api: 'http://testapi.yoho.cn:28078/',
service: 'http://service-test1.yohops.com:9999/',
// service: 'http://service.yoho.yohoops.org/',
// service: 'http://testservice.yoho.cn:28077/',
//service: 'http://testservice.yoho.cn:28077/',
search: 'http://192.168.102.216:8080/yohosearch/'
},
subDomains: {
... ...
<script id="latest-walk-tpl" type="text/html">
\{{# latestWalk}}
<div class="good">
<a href="\{{href}}" target="_blank">
<img class="lazy" data-original="\{{img}}" />
</a>
<a class="name" href="\{{href}}" target="_blank">\{{name}}</a>
<p class="price">
<span class="market-price">\{{marketPrice}}</span>
<span class="sale-price">\{{salePrice}}</span>
</p>
</div>
\{{/ latestWalk}}
</script>
\ No newline at end of file
... ...
{{#if latestWalk}}
<input id="latest-walk-count" type="hidden" value="{{latestWalk}}">
<div class="latest-walk">
<h2>最近浏览的商品</h2>
<div id="latest-walk-goods" class="goods clearfix"></div>
</div>
{{> product/latest-walk-tpl}}
{{/if}}
\ No newline at end of file
... ...
... ... @@ -11,6 +11,7 @@ var product = require('./index/product');
require('../common');
require('../plugins/filter');
require('../plugins/sort-pager');
require('./detail/latest-walk');
product.init(4);
... ...