...
|
...
|
@@ -231,7 +231,6 @@ export function getArticleContent(reload = false) { |
|
|
return new DetailService(app.serviceHost).getArticleContent(articleId)
|
|
|
.then(json => {
|
|
|
let payload = parseArticleContent(json);
|
|
|
|
|
|
payload.map((item, i) => {
|
|
|
if (item.template_name == 'goods') {
|
|
|
dispatch(goodsProductBySkns(item, i));
|
...
|
...
|
@@ -253,9 +252,6 @@ export function getArticleContent(reload = false) { |
|
|
|
|
|
function parseArticleContent(json) {
|
|
|
let contents = [];
|
|
|
let goodsSkns = [];
|
|
|
let groupGoodsSkns = [];
|
|
|
|
|
|
json && json.map((item, i) => {
|
|
|
for (let i in item) {
|
|
|
if (item.hasOwnProperty(i)) {
|
...
|
...
|
@@ -338,11 +334,14 @@ function productBySknsFailure(error) { |
|
|
export function goodsProductBySkns(item, contentIndex) {
|
|
|
return (dispatch, getState) => {
|
|
|
let skns = [];
|
|
|
let productImages = {};
|
|
|
// 遍历取得SKN
|
|
|
item.data.map((item2) => {
|
|
|
|
|
|
item.data && item.data.map((item2) => {
|
|
|
skns.push(item2.id);
|
|
|
productImages[item2.id] = item2.src;
|
|
|
});
|
|
|
|
|
|
item.dataGlobal && item.dataGlobal.map((item9) => {
|
|
|
skns.push(item9.id);
|
|
|
});
|
|
|
|
|
|
if (!skns) {
|
...
|
...
|
@@ -358,17 +357,13 @@ export function goodsProductBySkns(item, contentIndex) { |
|
|
// 最多显示4个------------ 逛最开始的逻辑 改版后产品确认暂时不需要
|
|
|
//let result = json.product_list.slice(0, 4);
|
|
|
json.product_list.map((item3, i3) => {
|
|
|
let src = productImages[item3.product_skn];
|
|
|
if (src) {
|
|
|
if (item3.tags.includes('is_soon_sold_out')) {
|
|
|
item3.tags = ['is_soon_sold_out'];
|
|
|
} else {
|
|
|
item3.tags = [];
|
|
|
}
|
|
|
item3.default_images = helper.image(src, 235, 314);
|
|
|
productList.push(item3);
|
|
|
if (item3.tags.includes('is_soon_sold_out')) {
|
|
|
item3.tags = ['is_soon_sold_out'];
|
|
|
} else {
|
|
|
item3.tags = [];
|
|
|
}
|
|
|
|
|
|
item3.default_images = helper.image(item3.default_images, 235, 314);
|
|
|
productList.push(item3);
|
|
|
});
|
|
|
dispatch(productBySknsSuccess({
|
|
|
productList,
|
...
|
...
|
@@ -384,13 +379,11 @@ export function goodsProductBySkns(item, contentIndex) { |
|
|
export function goodsGroupProductBySkns(item, contentIndex) {
|
|
|
return (dispatch, getState) => {
|
|
|
let skns = [];
|
|
|
let productImages = {};
|
|
|
|
|
|
// 遍历取得SKN
|
|
|
item.data.map((item2) => {
|
|
|
item2.list.map((item3) => {
|
|
|
skns.push(item3.id);
|
|
|
productImages[item3.id] = item3.src;
|
|
|
});
|
|
|
});
|
|
|
|
...
|
...
|
@@ -405,15 +398,12 @@ export function goodsGroupProductBySkns(item, contentIndex) { |
|
|
.then(json => {
|
|
|
let result = json.product_list;
|
|
|
result.map((item4) => {
|
|
|
let src = productImages[item4.product_skn];
|
|
|
if (src) {
|
|
|
if (item4.tags.includes('is_soon_sold_out')) {
|
|
|
item4.tags = ['is_soon_sold_out'];
|
|
|
} else {
|
|
|
item4.tags = [];
|
|
|
}
|
|
|
item4.default_images = helper.image(src, 235, 314);
|
|
|
if (item4.tags.includes('is_soon_sold_out')) {
|
|
|
item4.tags = ['is_soon_sold_out'];
|
|
|
} else {
|
|
|
item4.tags = [];
|
|
|
}
|
|
|
item4.default_images = helper.image(item4.default_images, 235, 314);
|
|
|
});
|
|
|
|
|
|
let productList = []
|
...
|
...
|
@@ -451,12 +441,14 @@ export function goodsGroupProductBySkns(item, contentIndex) { |
|
|
export function recommendProductBySkns(item, contentIndex) {
|
|
|
return (dispatch, getState) => {
|
|
|
let skns = [];
|
|
|
let productImages = {};
|
|
|
// 遍历取得SKN
|
|
|
|
|
|
item.data.map((item2) => {
|
|
|
item.data && item.data.map((item2) => {
|
|
|
skns.push(item2.product_skn);
|
|
|
productImages[item2.product_skn] = item2.pic_url;
|
|
|
});
|
|
|
|
|
|
item.dataGlobal && item.dataGlobal.map((item9) => {
|
|
|
skns.push(item9.product_skn);
|
|
|
});
|
|
|
|
|
|
if (!skns) {
|
...
|
...
|
@@ -473,17 +465,13 @@ export function recommendProductBySkns(item, contentIndex) { |
|
|
// 最多显示10个
|
|
|
let result = json.product_list.slice(0, 10);
|
|
|
result.map((item3, i3) => {
|
|
|
let src = productImages[item3.product_skn];
|
|
|
if (src) {
|
|
|
if (item3.tags.includes('is_soon_sold_out')) {
|
|
|
item3.tags = ['is_soon_sold_out'];
|
|
|
} else {
|
|
|
item3.tags = [];
|
|
|
}
|
|
|
item3.default_images = helper.image(src, 235, 314);
|
|
|
productList.push(item3);
|
|
|
if (item3.tags.includes('is_soon_sold_out')) {
|
|
|
item3.tags = ['is_soon_sold_out'];
|
|
|
} else {
|
|
|
item3.tags = [];
|
|
|
}
|
|
|
|
|
|
item3.default_images = helper.image(item3.default_images, 235, 314);
|
|
|
productList.push(item3);
|
|
|
});
|
|
|
dispatch(productBySknsSuccess({
|
|
|
productList,
|
...
|
...
|
@@ -962,13 +950,7 @@ export function getPraiseForArtivle() { |
|
|
fetchInfo(id,uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
ReactNative.NativeModules.YH_CommonHelper.login()
|
|
|
.then(uid => {
|
|
|
fetchInfo(id,uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
});
|
|
|
fetchInfo(id,'');
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
|