...
|
...
|
@@ -6,7 +6,7 @@ const _ = require('lodash'); |
|
|
* @param newParam 要拼接的 参数
|
|
|
* @returns {string}
|
|
|
*/
|
|
|
const handleFilterUrl = (originParam, newParam, delParam) => {
|
|
|
const handleFilterUrl = (baseUrl, originParam, newParam, delParam) => {
|
|
|
let dest = '?';
|
|
|
let tempOriginParam = {};
|
|
|
|
...
|
...
|
@@ -15,17 +15,17 @@ const handleFilterUrl = (originParam, newParam, delParam) => { |
|
|
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
|
|
|
delete tempOriginParam.uid;
|
|
|
|
|
|
_.forEach(tempOriginParam, info => {
|
|
|
if (!delParam[info.key] && info.value) {
|
|
|
_.forEach(tempOriginParam, (value, key) => {
|
|
|
if (!delParam[key] && value) {
|
|
|
// NOTE: 这里会对 query 进行编码,因为 query 有可以能是中文
|
|
|
if (info.key === 'query') {
|
|
|
info.value = encodeURIComponent(info.value);
|
|
|
if (key === 'query') {
|
|
|
value = encodeURIComponent(value);
|
|
|
}
|
|
|
dest += `${info.key}=${info.value}&`;
|
|
|
dest += `${key}=${value}&`;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return _.trim(dest, '&');
|
|
|
return (baseUrl || '') + _.trim(dest, '&');
|
|
|
};
|
|
|
|
|
|
module.exports = (total, params = {}, baseUrl = '') => {
|
...
|
...
|
@@ -92,6 +92,7 @@ module.exports = (total, params = {}, baseUrl = '') => { |
|
|
});
|
|
|
offsetPage++;
|
|
|
}
|
|
|
|
|
|
if (nextLimit >= 2) {
|
|
|
pages = _.concat(pages, {
|
|
|
num: '...'
|
...
|
...
|
|