Authored by 陈峰

commit

@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 10
11 <script> 11 <script>
12 import {pxToRem} from '../../../utils/helpers.js'; 12 import {pxToRem} from '../../../utils/helpers.js';
13 - import {foreach, get} from 'lodash'; 13 + import {forEach, get} from 'lodash';
14 import {createNamespacedHelpers} from 'vuex'; 14 import {createNamespacedHelpers} from 'vuex';
15 const {mapActions} = createNamespacedHelpers('user'); 15 const {mapActions} = createNamespacedHelpers('user');
16 16
@@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
71 } 71 }
72 }, 72 },
73 created() { 73 created() {
74 - foreach(defaultOption, (value, key) => { 74 + forEach(defaultOption, (value, key) => {
75 if (!this.option.hasOwnProperty(key)) { 75 if (!this.option.hasOwnProperty(key)) {
76 this.option[key] = value; 76 this.option[key] = value;
77 } 77 }
1 -import { get, foreach, keyby, uniq, remove, clonedeep } from 'lodash'; 1 +import { get, forEach, keyBy, uniq, remove, cloneDeep } from 'lodash';
2 2
3 let domainList = { 3 let domainList = {
4 '01': [ 4 '01': [
@@ -89,14 +89,14 @@ export function processArticleDetail(articleContent) { @@ -89,14 +89,14 @@ export function processArticleDetail(articleContent) {
89 89
90 // 普通商品 90 // 普通商品
91 if (tagList.length > 0) { 91 if (tagList.length > 0) {
92 - foreach(tagList, (tag, tagIndex) => { 92 + forEach(tagList, (tag, tagIndex) => {
93 tagList[tagIndex].href = '//m.yohobuy.com/product/' + tag.product_skn + '.html'; 93 tagList[tagIndex].href = '//m.yohobuy.com/product/' + tag.product_skn + '.html';
94 }); 94 });
95 } 95 }
96 96
97 // 全球购商品 97 // 全球购商品
98 if (tagListGlobal.length > 0) { 98 if (tagListGlobal.length > 0) {
99 - foreach(tagListGlobal, tagGlobal => { 99 + forEach(tagListGlobal, tagGlobal => {
100 tagList.push(Object.assign(tagGlobal, { 100 tagList.push(Object.assign(tagGlobal, {
101 href: '//m.yohobuy.com/product/global/' + tagGlobal.product_skn + '.html', 101 href: '//m.yohobuy.com/product/global/' + tagGlobal.product_skn + '.html',
102 noCart: true 102 noCart: true
@@ -106,7 +106,7 @@ export function processArticleDetail(articleContent) { @@ -106,7 +106,7 @@ export function processArticleDetail(articleContent) {
106 106
107 // 限定商品 107 // 限定商品
108 if (tagListLimit.length > 0) { 108 if (tagListLimit.length > 0) {
109 - foreach(tagListLimit, tagLimit => { 109 + forEach(tagListLimit, tagLimit => {
110 tagList.push(Object.assign(tagLimit, { 110 tagList.push(Object.assign(tagLimit, {
111 href: '//m.yohobuy.com/product/' + tagLimit.product_skn + '.html', 111 href: '//m.yohobuy.com/product/' + tagLimit.product_skn + '.html',
112 noCart: true 112 noCart: true
@@ -148,18 +148,18 @@ export function processArticleDetail(articleContent) { @@ -148,18 +148,18 @@ export function processArticleDetail(articleContent) {
148 let goodsDataLimit = get(value, 'goods.dataLimit', []); 148 let goodsDataLimit = get(value, 'goods.dataLimit', []);
149 149
150 // 普通商品 150 // 普通商品
151 - foreach(goodsData, (item) => { 151 + forEach(goodsData, (item) => {
152 allgoods.push(item.id); 152 allgoods.push(item.id);
153 }); 153 });
154 154
155 // 全球购商品 155 // 全球购商品
156 - foreach(goodsDataGlobal, (item) => { 156 + forEach(goodsDataGlobal, (item) => {
157 allgoods.push(item.id); 157 allgoods.push(item.id);
158 goodsData.push(item); 158 goodsData.push(item);
159 }); 159 });
160 160
161 // 限定商品 161 // 限定商品
162 - foreach(goodsDataLimit, (item) => { 162 + forEach(goodsDataLimit, (item) => {
163 allgoods.push(item.id); 163 allgoods.push(item.id);
164 goodsData.push(item); 164 goodsData.push(item);
165 }); 165 });
@@ -201,7 +201,7 @@ export function processArticleDetail(articleContent) { @@ -201,7 +201,7 @@ export function processArticleDetail(articleContent) {
201 function processProductList(list) { 201 function processProductList(list) {
202 const pruductList = []; 202 const pruductList = [];
203 203
204 - foreach(list, (product) => { 204 + forEach(list, (product) => {
205 if (!product) { 205 if (!product) {
206 return; 206 return;
207 } 207 }
@@ -281,7 +281,7 @@ function processProductList(list) { @@ -281,7 +281,7 @@ function processProductList(list) {
281 } 281 }
282 282
283 const _goodsArrayToObj = (goodsArray) => { 283 const _goodsArrayToObj = (goodsArray) => {
284 - return keyby(goodsArray, value => { 284 + return keyBy(goodsArray, value => {
285 return value.product_skn; 285 return value.product_skn;
286 }); 286 });
287 }; 287 };
@@ -292,18 +292,18 @@ const _goodsArrayToObj = (goodsArray) => { @@ -292,18 +292,18 @@ const _goodsArrayToObj = (goodsArray) => {
292 export function pushGoodsInfo(finalDetail, goodsList) { 292 export function pushGoodsInfo(finalDetail, goodsList) {
293 let goodsObj = _goodsArrayToObj(processProductList(goodsList)); 293 let goodsObj = _goodsArrayToObj(processProductList(goodsList));
294 294
295 - foreach(finalDetail, (value, key) => { 295 + forEach(finalDetail, (value, key) => {
296 if (value.relatedReco) { 296 if (value.relatedReco) {
297 let goodsIds = []; 297 let goodsIds = [];
298 298
299 - foreach(value.relatedReco.goods, relatedGoods => { 299 + forEach(value.relatedReco.goods, relatedGoods => {
300 goodsIds.push(relatedGoods.id); 300 goodsIds.push(relatedGoods.id);
301 }); 301 });
302 302
303 goodsIds = uniq(goodsIds); 303 goodsIds = uniq(goodsIds);
304 finalDetail[key].relatedReco.goods = []; 304 finalDetail[key].relatedReco.goods = [];
305 305
306 - foreach(goodsIds, (item, subKey) => { 306 + forEach(goodsIds, (item, subKey) => {
307 if (goodsObj[item]) { 307 if (goodsObj[item]) {
308 finalDetail[key].relatedReco.goods[subKey] = goodsObj[item]; 308 finalDetail[key].relatedReco.goods[subKey] = goodsObj[item];
309 } else { 309 } else {
@@ -321,13 +321,13 @@ export function pushGoodsInfo(finalDetail, goodsList) { @@ -321,13 +321,13 @@ export function pushGoodsInfo(finalDetail, goodsList) {
321 } 321 }
322 322
323 if (value.collocation) { 323 if (value.collocation) {
324 - foreach(value.collocation, (item, subKey) => {  
325 - foreach(item.goods, (thItem, thKey) => { 324 + forEach(value.collocation, (item, subKey) => {
  325 + forEach(item.goods, (thItem, thKey) => {
326 if (thItem) { 326 if (thItem) {
327 finalDetail[key].collocation[subKey].goods[thKey] = goodsObj[thItem.id]; 327 finalDetail[key].collocation[subKey].goods[thKey] = goodsObj[thItem.id];
328 328
329 if (goodsObj[thItem.id]) { 329 if (goodsObj[thItem.id]) {
330 - let newGoods = clonedeep(goodsObj[thItem.id]); 330 + let newGoods = cloneDeep(goodsObj[thItem.id]);
331 331
332 newGoods.default_images = thItem.src; 332 newGoods.default_images = thItem.src;
333 finalDetail[key].collocation[subKey].goods[thKey] = newGoods; 333 finalDetail[key].collocation[subKey].goods[thKey] = newGoods;
@@ -26,8 +26,7 @@ @@ -26,8 +26,7 @@
26 "kebabCase": true 26 "kebabCase": true
27 }, 27 },
28 "lodash": { 28 "lodash": {
29 - "transform": "lodash/${member}",  
30 - "kebabCase": true 29 + "transform": "lodash/${member}"
31 } 30 }
32 }, 31 },
33 "dependencies": { 32 "dependencies": {