|
@@ -6,7 +6,7 @@ const _ = require('lodash'); |
|
@@ -6,7 +6,7 @@ const _ = require('lodash'); |
6
|
* @param newParam 要拼接的 参数
|
6
|
* @param newParam 要拼接的 参数
|
7
|
* @returns {string}
|
7
|
* @returns {string}
|
8
|
*/
|
8
|
*/
|
9
|
-const handleFilterUrl = (originParam, newParam, delParam) => {
|
9
|
+const handleFilterUrl = (baseUrl, originParam, newParam, delParam) => {
|
10
|
let dest = '?';
|
10
|
let dest = '?';
|
11
|
let tempOriginParam = {};
|
11
|
let tempOriginParam = {};
|
12
|
|
12
|
|
|
@@ -15,17 +15,17 @@ const handleFilterUrl = (originParam, newParam, delParam) => { |
|
@@ -15,17 +15,17 @@ const handleFilterUrl = (originParam, newParam, delParam) => { |
15
|
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
|
15
|
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
|
16
|
delete tempOriginParam.uid;
|
16
|
delete tempOriginParam.uid;
|
17
|
|
17
|
|
18
|
- _.forEach(tempOriginParam, info => {
|
|
|
19
|
- if (!delParam[info.key] && info.value) {
|
18
|
+ _.forEach(tempOriginParam, (value, key) => {
|
|
|
19
|
+ if (!delParam[key] && value) {
|
20
|
// NOTE: 这里会对 query 进行编码,因为 query 有可以能是中文
|
20
|
// NOTE: 这里会对 query 进行编码,因为 query 有可以能是中文
|
21
|
- if (info.key === 'query') {
|
|
|
22
|
- info.value = encodeURIComponent(info.value);
|
21
|
+ if (key === 'query') {
|
|
|
22
|
+ value = encodeURIComponent(value);
|
23
|
}
|
23
|
}
|
24
|
- dest += `${info.key}=${info.value}&`;
|
24
|
+ dest += `${key}=${value}&`;
|
25
|
}
|
25
|
}
|
26
|
});
|
26
|
});
|
27
|
|
27
|
|
28
|
- return _.trim(dest, '&');
|
28
|
+ return (baseUrl || '') + _.trim(dest, '&');
|
29
|
};
|
29
|
};
|
30
|
|
30
|
|
31
|
module.exports = (total, params = {}, baseUrl = '') => {
|
31
|
module.exports = (total, params = {}, baseUrl = '') => {
|
|
@@ -92,6 +92,7 @@ module.exports = (total, params = {}, baseUrl = '') => { |
|
@@ -92,6 +92,7 @@ module.exports = (total, params = {}, baseUrl = '') => { |
92
|
});
|
92
|
});
|
93
|
offsetPage++;
|
93
|
offsetPage++;
|
94
|
}
|
94
|
}
|
|
|
95
|
+
|
95
|
if (nextLimit >= 2) {
|
96
|
if (nextLimit >= 2) {
|
96
|
pages = _.concat(pages, {
|
97
|
pages = _.concat(pages, {
|
97
|
num: '...'
|
98
|
num: '...'
|