Authored by 周少峰

Merge branch 'hotfix/brandSeries'

... ... @@ -492,7 +492,7 @@ const getAdnav = (params) => {
if (result[1].code === 200 && result[1].data) {
dest.picTitle = brandFolderSeries;
Object.assign(dest.list, searchHandler.handleFolderData(result[0].data));
Object.assign(dest.list, searchHandler.handleSeriesData(result[1].data));
}
... ...
... ... @@ -731,9 +731,9 @@ exports.handlePagerData = (total, params) => {
pages: []
};
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; // 总页数
let currentPage = parseInt(_.get(params, 'page', 1), 10); // 当前页
let perPageCount = parseInt(_.get(params, 'limit', 60), 10); // 每页商品数
let totalPage = Math.ceil(total / perPageCount); // 总页数
if (currentPage === 1) {
// 当前页为 1,一定没有上一页
... ... @@ -773,11 +773,14 @@ exports.handlePagerData = (total, params) => {
}
} else if (currentPage > totalPage - 2) {
for (let i = totalPage; i >= totalPage - 4; i--) {
pages.push({
url: handleFilterUrl(params, {page: i}),
num: i,
cur: currentPage === i
});
if (i > 0) {
pages.push({
url: handleFilterUrl(params, {page: i}),
num: i,
cur: currentPage === i
});
}
}
pages = _.sortBy(pages, ['num']);
}
... ... @@ -795,7 +798,7 @@ exports.handlePagerData = (total, params) => {
num: '...'
});
}
if (currentPage < totalPage - 2) {
if (currentPage < totalPage - 2 && totalPage > 5) {
nextPages.push({
num: '...'
});
... ...
... ... @@ -1249,7 +1249,7 @@ exports.handleBrandBanner = (data) => {
};
/**
* 处理品牌系列
* 处理品牌系列folder_id
* @type {[type]}
*/
exports.handleFolderData = (data) => {
... ... @@ -1266,6 +1266,23 @@ exports.handleFolderData = (data) => {
};
/**
* 处理品牌系列series
* @type {[type]}
*/
exports.handleSeriesData = (data) => {
let dest = [];
_.forEach(data, (value) => {
dest.push({
href: '?series=' + value.id,
src: value.series_banner
});
});
return dest;
};
/**
* 筛选类链接处理的对外接口
* @type {[type]}
*/
... ...