Authored by zhangxiaoru

editorial

@@ -214,6 +214,7 @@ const _getRelatedData = (idList) => { @@ -214,6 +214,7 @@ const _getRelatedData = (idList) => {
214 productSkn: idList, 214 productSkn: idList,
215 method: 'h5.product.batch' 215 method: 'h5.product.batch'
216 }).then((result) => { 216 }).then((result) => {
  217 + // console.log(result)
217 let productList = []; 218 let productList = [];
218 219
219 if (result && result.code === 200) { 220 if (result && result.code === 200) {
@@ -224,7 +225,8 @@ const _getRelatedData = (idList) => { @@ -224,7 +225,8 @@ const _getRelatedData = (idList) => {
224 name: data.product_name, 225 name: data.product_name,
225 price: data.sales_price, 226 price: data.sales_price,
226 productId: data.product_id, 227 productId: data.product_id,
227 - cnAlphabet: data.cn_alphabet 228 + cnAlphabet: data.cn_alphabet,
  229 + productSkn: data.product_skn
228 }); 230 });
229 }); 231 });
230 return productList; 232 return productList;
@@ -316,24 +318,46 @@ const _processContentData = (list) => { @@ -316,24 +318,46 @@ const _processContentData = (list) => {
316 318
317 return _getRelatedData(idList).then((result) => { 319 return _getRelatedData(idList).then((result) => {
318 320
  321 +
319 if (related.relatedReco) { 322 if (related.relatedReco) {
320 - _.forEach(related.relatedReco, function(data, index) {  
321 - if (result[index]) {  
322 - data = _.assign(data, {  
323 - link: config.siteUrl + '/product/list/pro_' +  
324 - result[index].productId + '_' + data.productSkc + '/' +  
325 - result[index].cnAlphabet + '.html'  
326 - });  
327 - data = _.assign(data, result[index]); 323 + _.forEach(related.relatedReco, function(data, key) {
  324 +
  325 + _.forEach(result, function(list, index) {
  326 + if(data.id === list.productSkn) {
  327 + data = _.assign(data, {
  328 + link: config.siteUrl + '/product/list/pro_' +
  329 + result[index].productId + '_' + data.productSkc + '/' +
  330 + result[index].cnAlphabet + '.html'
  331 + });
  332 + data = _.assign(data, result[index]);
  333 + }
  334 + });
  335 +
  336 + if (!data.name) {
  337 + delete related.relatedReco[key];
328 } 338 }
  339 +
329 }); 340 });
330 - result.splice(0, recoLength.length);  
331 } 341 }
332 342
333 if (related.relatedGroup) { 343 if (related.relatedGroup) {
334 - _.forEach(related.relatedGroup, function(data, index) { 344 + _.forEach(related.relatedGroup, function(data, key) {
  345 +
  346 + _.forEach(result, function(list, index) {
  347 + if(data.id === list.productSkn) {
  348 + data = _.assign(data, {
  349 + link: config.siteUrl + '/product/list/pro_' +
  350 + result[index].productId + '_' + data.productSkc + '/' +
  351 + result[index].cnAlphabet + '.html'
  352 + });
  353 + data = _.assign(data, result[index]);
  354 + }
  355 + });
  356 +
  357 + if (!data.name) {
  358 + delete related.relatedGroup[key];
  359 + }
335 360
336 - data = _.assign(data, result[index]);  
337 361
338 }); 362 });
339 } 363 }
@@ -237,8 +237,6 @@ $('.left').click(function() { @@ -237,8 +237,6 @@ $('.left').click(function() {
237 $goods.animate({left: '+=930px'}); 237 $goods.animate({left: '+=930px'});
238 }); 238 });
239 239
240 -console.log($('.chapter-left').find('a').text().length);  
241 -  
242 if (pre.text().length > 20) { 240 if (pre.text().length > 20) {
243 pre.text(pre.text().substring(0, 19) + '...'); 241 pre.text(pre.text().substring(0, 19) + '...');
244 } 242 }