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,9 +318,12 @@ const _processContentData = (list) => { @@ -316,9 +318,12 @@ 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]) { 323 + _.forEach(related.relatedReco, function(data, key) {
  324 +
  325 + _.forEach(result, function(list, index) {
  326 + if(data.id === list.productSkn) {
322 data = _.assign(data, { 327 data = _.assign(data, {
323 link: config.siteUrl + '/product/list/pro_' + 328 link: config.siteUrl + '/product/list/pro_' +
324 result[index].productId + '_' + data.productSkc + '/' + 329 result[index].productId + '_' + data.productSkc + '/' +
@@ -327,13 +332,32 @@ const _processContentData = (list) => { @@ -327,13 +332,32 @@ const _processContentData = (list) => {
327 data = _.assign(data, result[index]); 332 data = _.assign(data, result[index]);
328 } 333 }
329 }); 334 });
330 - result.splice(0, recoLength.length); 335 +
  336 + if (!data.name) {
  337 + delete related.relatedReco[key];
  338 + }
  339 +
  340 + });
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) {
335 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 + });
336 data = _.assign(data, result[index]); 353 data = _.assign(data, result[index]);
  354 + }
  355 + });
  356 +
  357 + if (!data.name) {
  358 + delete related.relatedGroup[key];
  359 + }
  360 +
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 }