Authored by 郭成尧

'左侧分类选中处理'

@@ -109,21 +109,21 @@ const handleFilterUrl = (originParam, newParam) => { @@ -109,21 +109,21 @@ const handleFilterUrl = (originParam, newParam) => {
109 let newParamArray = _.keys(newParam); 109 let newParamArray = _.keys(newParam);
110 110
111 // 判断参数是否已经存在 111 // 判断参数是否已经存在
112 - let isExist = !_.isEmpty(_.find(originParamArray, function (o) { 112 + let isExist = !_.isEmpty(_.find(originParamArray, function(o) {
113 return o === newParamArray[0]; 113 return o === newParamArray[0];
114 })); 114 }));
115 115
116 if (isExist) { 116 if (isExist) {
117 tempOriginParam = Object.assign(tempOriginParam, originParam); 117 tempOriginParam = Object.assign(tempOriginParam, originParam);
118 118
119 - _.forEach(newParam, function (value, key) { 119 + _.forEach(newParam, function(value, key) {
120 tempOriginParam[key] = value; 120 tempOriginParam[key] = value;
121 }); 121 });
122 } else { 122 } else {
123 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam); 123 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
124 } 124 }
125 125
126 - _.forEach(tempOriginParam, function (value, key) { 126 + _.forEach(tempOriginParam, function(value, key) {
127 dest = dest + key + '=' + value + '&'; 127 dest = dest + key + '=' + value + '&';
128 }); 128 });
129 129
@@ -193,8 +193,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -193,8 +193,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
193 if (!_.isEmpty(params.sort)) { 193 if (!_.isEmpty(params.sort)) {
194 194
195 // 是否有分类筛选参数,如果有 195 // 是否有分类筛选参数,如果有
196 - _.forEach(params.sort.split(','), function (sortParam) {  
197 - _.forEach(origin, function (value) { 196 + _.forEach(params.sort.split(','), function(sortParam) {
  197 + _.forEach(origin, function(value) {
198 198
199 // 判断是否在这组数据里面 199 // 判断是否在这组数据里面
200 if (!_.isEmpty(_.find(value.sort_id.split(','), o => { 200 if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
@@ -202,7 +202,7 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -202,7 +202,7 @@ const handleSalebreakingYardsSortData = (origin, params) => {
202 }))) { 202 }))) {
203 203
204 // 如果在某组数据里面,组合数据退出循环 204 // 如果在某组数据里面,组合数据退出循环
205 - _.forEach(value.sub, function (subValue) { 205 + _.forEach(value.sub, function(subValue) {
206 let size = {}; 206 let size = {};
207 207
208 size.checked = 208 size.checked =
@@ -217,8 +217,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -217,8 +217,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
217 }); 217 });
218 }); 218 });
219 } else { // 如果没有筛选参数,返回所有分类 219 } else { // 如果没有筛选参数,返回所有分类
220 - _.forEach(origin, function (value) {  
221 - _.forEach(value.sub, function (subValue) { 220 + _.forEach(origin, function(value) {
  221 + _.forEach(value.sub, function(subValue) {
222 let size = {}; 222 let size = {};
223 223
224 size.checked = (parseInt(params.size, 10) === parseInt(subValue.size_id, 10)) ? true : false; 224 size.checked = (parseInt(params.size, 10) === parseInt(subValue.size_id, 10)) ? true : false;
@@ -282,7 +282,7 @@ exports.handleSaleFilterData = (origin, params) => { @@ -282,7 +282,7 @@ exports.handleSaleFilterData = (origin, params) => {
282 if (!_.isEmpty(origin.brand)) { 282 if (!_.isEmpty(origin.brand)) {
283 let count = 0; 283 let count = 0;
284 284
285 - _.forEach(origin.brand, function (value) { 285 + _.forEach(origin.brand, function(value) {
286 let brand = {}; 286 let brand = {};
287 287
288 brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10)) ? true : false; 288 brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10)) ? true : false;
@@ -308,13 +308,13 @@ exports.handleSaleFilterData = (origin, params) => { @@ -308,13 +308,13 @@ exports.handleSaleFilterData = (origin, params) => {
308 } 308 }
309 309
310 // 来排排序 310 // 来排排序
311 - dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function (o) { 311 + dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function(o) {
312 return o.index; 312 return o.index;
313 }); 313 });
314 314
315 // 处理 价格 筛选数据 315 // 处理 价格 筛选数据
316 if (!_.isEmpty(origin.priceRange)) { 316 if (!_.isEmpty(origin.priceRange)) {
317 - _.forEach(origin.priceRange, function (value, key) { 317 + _.forEach(origin.priceRange, function(value, key) {
318 let price = { 318 let price = {
319 checked: (params.price === key) ? true : false, 319 checked: (params.price === key) ? true : false,
320 href: handleFilterUrl(params, {price: key}), 320 href: handleFilterUrl(params, {price: key}),
@@ -520,7 +520,7 @@ exports.handleSaleSortData = (origin, params, extra) => { @@ -520,7 +520,7 @@ exports.handleSaleSortData = (origin, params, extra) => {
520 leftContent.allSort.list.push(perAllSort); 520 leftContent.allSort.list.push(perAllSort);
521 521
522 522
523 - _.forEach(origin, function (value) { 523 + _.forEach(origin, function(value) {
524 524
525 let category = {}; 525 let category = {};
526 526
@@ -529,7 +529,7 @@ exports.handleSaleSortData = (origin, params, extra) => { @@ -529,7 +529,7 @@ exports.handleSaleSortData = (origin, params, extra) => {
529 category.childList = []; 529 category.childList = [];
530 category.href = handleFilterUrl(params, {sort: value.relation_parameter.sort}); 530 category.href = handleFilterUrl(params, {sort: value.relation_parameter.sort});
531 category.active = false; 531 category.active = false;
532 - _.forEach(value.sub, function (subValue) { 532 + _.forEach(value.sub, function(subValue) {
533 category.childList.push({ 533 category.childList.push({
534 name: subValue.category_name, 534 name: subValue.category_name,
535 num: subValue.node_count, 535 num: subValue.node_count,
@@ -559,7 +559,7 @@ exports.handleSaleActivityData = (origin, channel) => { @@ -559,7 +559,7 @@ exports.handleSaleActivityData = (origin, channel) => {
559 559
560 dest.big = []; 560 dest.big = [];
561 dest.normal = []; 561 dest.normal = [];
562 - _.forEach(origin, function (value, key) { 562 + _.forEach(origin, function(value, key) {
563 let activity = {}; 563 let activity = {};
564 564
565 activity.link = 565 activity.link =
@@ -604,9 +604,9 @@ exports.handleSaleBannerData = (origin) => { @@ -604,9 +604,9 @@ exports.handleSaleBannerData = (origin) => {
604 var dest = {}; 604 var dest = {};
605 605
606 dest.list = []; 606 dest.list = [];
607 - _.forEach(origin, function (value) { 607 + _.forEach(origin, function(value) {
608 if (value.template_name === 'focus') { 608 if (value.template_name === 'focus') {
609 - _.forEach(value.data, function (subValue) { 609 + _.forEach(value.data, function(subValue) {
610 let banner = {}; 610 let banner = {};
611 611
612 banner.bannerHeight = 450; 612 banner.bannerHeight = 450;
@@ -631,9 +631,9 @@ exports.handleSaleBannerSmallData = (origin) => { @@ -631,9 +631,9 @@ exports.handleSaleBannerSmallData = (origin) => {
631 var dest = []; 631 var dest = [];
632 let count = 0; 632 let count = 0;
633 633
634 - _.forEach(origin, function (value) { 634 + _.forEach(origin, function(value) {
635 if (value.template_name === 'small_pic') { 635 if (value.template_name === 'small_pic') {
636 - _.forEach(value.data, function (picList) { 636 + _.forEach(value.data, function(picList) {
637 if (count++ < 3) { 637 if (count++ < 3) {
638 let smallPic = {}; 638 let smallPic = {};
639 639