Merge branch 'release/guang'
Showing
1 changed file
with
24 additions
and
21 deletions
@@ -72,32 +72,35 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | @@ -72,32 +72,35 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | ||
72 | 72 | ||
73 | // 通过SKN获取商品信息 | 73 | // 通过SKN获取商品信息 |
74 | productDetailModel.productInfoBySkns(skns).then((product) => { | 74 | productDetailModel.productInfoBySkns(skns).then((product) => { |
75 | - if (product.data && product.data.product_list) { | ||
76 | - let d = []; | 75 | + if (product && product.data) { |
76 | + if (product.data.product_list) { | ||
77 | + let d = []; | ||
77 | 78 | ||
78 | - for (let o = 0; o < product.data.product_list.length; o++) { | ||
79 | - let goods = product.data.product_list[o]; | 79 | + for (let o = 0; o < product.data.product_list.length; o++) { |
80 | + let goods = product.data.product_list[o]; | ||
80 | 81 | ||
81 | - // 最多显示4个 | ||
82 | - if (o > 3) { | ||
83 | - break; | 82 | + // 最多显示4个 |
83 | + if (o > 3) { | ||
84 | + break; | ||
85 | + } | ||
86 | + d.push(guangProcess.formatProduct(goods, false, true, true, 235, 314, isApp, true, gender)); | ||
84 | } | 87 | } |
85 | - d.push(guangProcess.formatProduct(goods, false, true, true, 235, 314, isApp, true, gender)); | 88 | + d.forEach(p => { |
89 | + if (arr[p.id]) { | ||
90 | + p.thumb = helpers.image(arr[p.id], 235, 314); | ||
91 | + reco.push(p); | ||
92 | + } | ||
93 | + }); | ||
86 | } | 94 | } |
87 | - d.forEach(p => { | ||
88 | - if (arr[p.id]) { | ||
89 | - p.thumb = helpers.image(arr[p.id], 235, 314); | ||
90 | - reco.push(p); | ||
91 | - } | ||
92 | - }); | ||
93 | - } | ||
94 | 95 | ||
95 | - // 多个商品 | ||
96 | - if (product.data.product_list.length > 1) { | ||
97 | - build.relatedReco = reco; | ||
98 | - } else if (product.data.product_list.length === 1) { // 单个商品 | ||
99 | - build.relatedReco = reco[0]; | 96 | + // 多个商品 |
97 | + if (product.data.product_list.length && (product.data.product_list.length > 1)) { | ||
98 | + build.relatedReco = reco; | ||
99 | + } else if (product.data.product_list.length === 1) { // 单个商品 | ||
100 | + build.relatedReco = reco[0]; | ||
101 | + } | ||
100 | } | 102 | } |
103 | + | ||
101 | contents.push(build); | 104 | contents.push(build); |
102 | joinContentFunc(++i, len); | 105 | joinContentFunc(++i, len); |
103 | }); | 106 | }); |
@@ -120,7 +123,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | @@ -120,7 +123,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | ||
120 | 123 | ||
121 | // 通过SKN获取商品信息 | 124 | // 通过SKN获取商品信息 |
122 | productDetailModel.productInfoBySkns(skns).then((product) => { | 125 | productDetailModel.productInfoBySkns(skns).then((product) => { |
123 | - if (product.data.product_list) { | 126 | + if (product && product.data && product.data.product_list) { |
124 | let g = []; | 127 | let g = []; |
125 | 128 | ||
126 | product.data.product_list.forEach(_ => { | 129 | product.data.product_list.forEach(_ => { |
-
Please register or login to post a comment