Authored by 郭成尧

'筛选链接处理'

... ... @@ -12,33 +12,16 @@ const helpers = require(`${library}/helpers`);
const queryString = require('querystring');
/**
* 处理用于筛选的 URL
* @param {[type]} originParam [description]
* @param {[type]} newParam [description]
* @return {[type]} [description]
* 处理用于筛选的 URL , 拼接 URL 参数
* @param originParam 当前 URL 中的参数
* @param newParam 要拼接的 参数
* @returns {string}
*/
const handleFilterUrl = (originParam, newParam) => {
let dest = '?';
let tempOriginParam = {};
// 创建 originParam、newParam 键的数组
let originParamArray = _.keys(originParam);
let newParamArray = _.keys(newParam);
// 判断参数是否已经存在
let isExist = !_.isEmpty(_.find(originParamArray, function(o) {
return o === newParamArray[0];
}));
if (isExist) {
tempOriginParam = Object.assign(tempOriginParam, originParam);
_.forEach(newParam, function(value, key) {
tempOriginParam[key] = value;
});
} else {
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
}
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
_.forEach(tempOriginParam, function(value, key) {
dest = dest + key + '=' + value + '&';
... ...
... ... @@ -78,24 +78,7 @@ const handleFilterUrl = (originParam, newParam) => {
let dest = '?';
let tempOriginParam = {};
// 创建 originParam、newParam 键的数组
let originParamArray = _.keys(originParam);
let newParamArray = _.keys(newParam);
// 判断参数是否已经存在
let isExist = !_.isEmpty(_.find(originParamArray, function(o) {
return o === newParamArray[0];
}));
if (isExist) {
tempOriginParam = Object.assign(tempOriginParam, originParam);
_.forEach(newParam, function(value, key) {
tempOriginParam[key] = value;
});
} else {
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
}
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
_.forEach(tempOriginParam, function(value, key) {
dest = dest + key + '=' + value + '&';
... ...