...
|
...
|
@@ -68,25 +68,6 @@ const handleFilterUrl = (originParam, newParam, delParam) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 校验分类参数是否一致
|
|
|
* @param {[type]} params [description]
|
|
|
* @param {[type]} origin [description]
|
|
|
* @param {[type]} param [description]
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
const _checkSortEqual = (rp, params) => {
|
|
|
let status = true;
|
|
|
|
|
|
_.forEach(rp, (value, key) => {
|
|
|
if (status && params[key] !== value) {
|
|
|
status = false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return status;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 处理选中数据
|
|
|
* @param {[type]} params [description]
|
|
|
* @param {[type]} origin [description]
|
...
|
...
|
@@ -521,8 +502,7 @@ exports.handleSortData = (origin, params, originParams, baseUrl) => { |
|
|
};
|
|
|
|
|
|
let list = [],
|
|
|
allCount = 0,
|
|
|
selectSort = {};
|
|
|
allCount = 0;
|
|
|
|
|
|
let all = [{
|
|
|
name: '全部品类',
|
...
|
...
|
@@ -533,7 +513,7 @@ exports.handleSortData = (origin, params, originParams, baseUrl) => { |
|
|
baseUrl = baseUrl || '';
|
|
|
|
|
|
_.forEach(origin, value => {
|
|
|
let equalCategory = _checkSortEqual(value.relation_parameter, originParams);
|
|
|
let equalCategory = `${originParams.category_id}` === `${value.category_id}`;
|
|
|
let category = {
|
|
|
name: value.category_name,
|
|
|
num: value.node_count,
|
...
|
...
|
@@ -541,8 +521,12 @@ exports.handleSortData = (origin, params, originParams, baseUrl) => { |
|
|
{
|
|
|
name: `全部${value.category_name}`,
|
|
|
num: value.node_count,
|
|
|
href: `${baseUrl}${handleFilterUrl(params, value.relation_parameter)}`,
|
|
|
childActive: _checkSortEqual(value.relation_parameter, originParams)
|
|
|
href: `${baseUrl}${handleFilterUrl(params, {category_id: value.category_id}, {
|
|
|
msort: true,
|
|
|
misort: true,
|
|
|
sort: true
|
|
|
})}`,
|
|
|
childActive: equalCategory
|
|
|
}
|
|
|
]
|
|
|
};
|
...
|
...
|
@@ -551,28 +535,24 @@ exports.handleSortData = (origin, params, originParams, baseUrl) => { |
|
|
|
|
|
if (equalCategory) {
|
|
|
category.active = true;
|
|
|
Object.assign(selectSort, {
|
|
|
name: value.category_name,
|
|
|
params: value.relation_parameter
|
|
|
});
|
|
|
}
|
|
|
|
|
|
_.forEach(value.sub, subValue => {
|
|
|
let child = {
|
|
|
name: subValue.category_name,
|
|
|
num: subValue.node_count,
|
|
|
href: `${baseUrl}${handleFilterUrl(params, subValue.relation_parameter)}`,
|
|
|
childActive: _checkSortEqual(subValue.relation_parameter, originParams)
|
|
|
href: `${baseUrl}${handleFilterUrl(params, {category_id: subValue.category_id}, {
|
|
|
msort: true,
|
|
|
misort: true,
|
|
|
sort: true
|
|
|
})}`,
|
|
|
childActive: `${originParams.category_id}` === `${subValue.category_id}`
|
|
|
};
|
|
|
|
|
|
category.childList.push(child);
|
|
|
|
|
|
if (child.childActive) {
|
|
|
category.active = true;
|
|
|
Object.assign(selectSort, {
|
|
|
name: subValue.category_name,
|
|
|
params: subValue.relation_parameter
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -1064,7 +1044,7 @@ exports.handlePathNavData = (data, params, page, channel) => { |
|
|
_.forEach(data, sort => {
|
|
|
let navList = [];
|
|
|
|
|
|
if (_checkSortEqual(sort.relation_parameter, params)) {
|
|
|
if (`${params.category_id}` === `${sort.category_id}`) {
|
|
|
navList = [{
|
|
|
name: sort.category_name,
|
|
|
pathTitle: sort.category_name
|
...
|
...
|
@@ -1073,7 +1053,7 @@ exports.handlePathNavData = (data, params, page, channel) => { |
|
|
|
|
|
if (!_.isEmpty(sort.sub)) {
|
|
|
_.forEach(sort.sub, misort => {
|
|
|
if (_checkSortEqual(misort.relation_parameter, params)) {
|
|
|
if (`${params.category_id}` === `${misort.category_id}`) {
|
|
|
navList = [{
|
|
|
name: sort.category_name,
|
|
|
href: handleFilterUrl(sort.relation_parameter),
|
...
|
...
|
|