...
|
...
|
@@ -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: '...'
|
|
|
});
|
...
|
...
|
|