...
|
...
|
@@ -463,9 +463,10 @@ exports.handleOptsData = (params, total, extra) => { |
|
|
* @param origin 分类原始数据,一般是接口返回数据中的 group_sort 字段
|
|
|
* @param params 当前 URL 中已有的参数
|
|
|
* @param extra 可以任意传值用来处理特殊情况
|
|
|
* @param {string} [baseUrl] 需要跳转非当前页面传的相对路径(可不传,默认为空字符串)
|
|
|
* @returns {{}}
|
|
|
*/
|
|
|
exports.handleSortData = (origin, params, originParams) => {
|
|
|
exports.handleSortData = (origin, params, originParams, baseUrl) => {
|
|
|
let leftContent = {
|
|
|
sort: {misort: []},
|
|
|
checked: []
|
...
|
...
|
@@ -474,11 +475,13 @@ exports.handleSortData = (origin, params, originParams) => { |
|
|
let list = [],
|
|
|
allCount = 0;
|
|
|
|
|
|
baseUrl = baseUrl || '';
|
|
|
|
|
|
leftContent.allSort = {};
|
|
|
leftContent.allSort.all = [{
|
|
|
name: '全部品类',
|
|
|
num: allCount,
|
|
|
href: handleFilterUrl(params, {}, {msort: true, misort: true})
|
|
|
href: `${baseUrl}${handleFilterUrl(params, {}, {msort: true, misort: true})}`
|
|
|
}];
|
|
|
|
|
|
_.forEach(origin, value => {
|
...
|
...
|
@@ -489,12 +492,12 @@ exports.handleSortData = (origin, params, originParams) => { |
|
|
{
|
|
|
name: `全部${value.sort_name}`,
|
|
|
num: value.count,
|
|
|
href: handleFilterUrl(params, {msort: value.sort_id}, {misort: true}),
|
|
|
href: `${baseUrl}${handleFilterUrl(params, {msort: value.sort_id}, {misort: true})}`,
|
|
|
childActive: (params.msort === value.sort_id) && !params.misort,
|
|
|
sortId: value.sort_id
|
|
|
}
|
|
|
],
|
|
|
href: handleFilterUrl(params, {msort: value.sort_id}, {misort: true}),
|
|
|
href: `${baseUrl}${handleFilterUrl(params, {msort: value.sort_id}, {misort: true})}`,
|
|
|
active: params.msort === value.sort_id,
|
|
|
sortId: value.sort_id
|
|
|
};
|
...
|
...
|
@@ -505,7 +508,7 @@ exports.handleSortData = (origin, params, originParams) => { |
|
|
category.childList.push({
|
|
|
name: subValue.sort_name,
|
|
|
num: subValue.count,
|
|
|
href: handleFilterUrl(params, {msort: value.sort_id, misort: subValue.sort_id}),
|
|
|
href: `${baseUrl}${handleFilterUrl(params, {msort: value.sort_id, misort: subValue.sort_id})}`,
|
|
|
childActive: params.misort === subValue.sort_id,
|
|
|
sortId: subValue.sort_id
|
|
|
});
|
...
|
...
|
|