Authored by 孙凯

add guangdetail global product review by zhanglixia

... ... @@ -20,6 +20,7 @@ import RecommentProducts from './RecommentProducts';
import Comments from './Comments';
import CommentsTitle from './CommentsTitle';
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
import YH_Video from '../../../common/components/YH_Video';
import ReactNative, {
View,
... ... @@ -144,6 +145,16 @@ export default class Detail extends Component {
return (
<SingleImage resource={rowData} onPressLink={this.props.onPressLink} onPressShopCar={this.props.onPressShopCar} onPressProduct={this.props.onPressTagProduct}/>
);
}else if (template_name == 'video') {
let data = rowData?rowData.get('data'):null;
let url = data?data.get('src'):''; //'http://w2.dwstatic.com/1/5/1525/127352-100-1434554639.mp4';
let title = data?data.get('video_intro'):'';
return (
<View style={{width: width - 20,height: 315,backgroundColor: 'white'}}>
<YH_Video style={{width: width - 20,height: 300}} url={url} title={title} />
<View style={styles.placeholder}/>
</View>
);
}else if (template_name == 'small_pic') {
return (
<SmallPic resource={rowData}/>
... ...
... ... @@ -48,7 +48,6 @@ export default class GoodsCell extends React.Component {
let backgroundWidth = width;
let showMoreViewHeigth = (this.state.moreProduct && listSize > 2)?60:0;
let backgroundHeight = Math.ceil(list.size) * (rowHeight+1) + showMoreViewHeigth;
return(
<View style={{width: backgroundWidth, height:backgroundHeight, backgroundColor:'white'}}>
{list.map((value, i) => {
... ... @@ -62,6 +61,8 @@ export default class GoodsCell extends React.Component {
let originPriceStr = '¥ ' + originPrice.toFixed(2); // 拼接的原价
let product_skn = product.product_skn;
let prd_id = product.product_id;
let isGlobal = product.is_global=='Y'?true:false;
return (
<TouchableOpacity
key={product_skn + '_key_' + i}
... ... @@ -85,7 +86,7 @@ export default class GoodsCell extends React.Component {
activeOpacity={0.5}
onPress={() => {
let pos_id = 106;
this.props.onPressShopCar && this.props.onPressShopCar(product.product_skn,prd_id,pos_id);
this.props.onPressShopCar && this.props.onPressShopCar(product.product_skn,prd_id,pos_id,isGlobal);
}}
>
<Image source={require('../../image/jgwc_bt.png')} style={styles.button} resizeMode={'contain'}></Image>
... ...
... ... @@ -57,7 +57,13 @@ export default class SingleImage extends React.Component {
let imageHeight = template_name.get('height');
let imageWidth = template_name.get('width');
let tagList = template_name?template_name.get('tagList'):null;
tagList = tagList?tagList.toJS():[];
tagList = tagList?tagList.toJS():[];
let tagListGlobal = template_name?template_name.get('tagListGlobal'):null;
tagListGlobal = tagListGlobal?tagListGlobal.toJS():[];
tagList = tagList.concat(tagListGlobal);
if (tagList.constructor != Array) {
tagList = [];
}
... ... @@ -97,7 +103,7 @@ export default class SingleImage extends React.Component {
<Image source={require('../../image/KA_dian.png')} style={styles.icon} resizeMode={'contain'}></Image>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
let pos_id = 102;
this.props.onPressProduct && this.props.onPressProduct(value.product_skn,i,pos_id);
this.props.onPressProduct && this.props.onPressProduct(value.product_skn,i,pos_id,value.is_global);
}}>
<View style={styles.tagView}>
<Text style={{
... ... @@ -110,7 +116,7 @@ export default class SingleImage extends React.Component {
<TouchableOpacity style={styles.button} activeOpacity={0.5} onPress={() => {
let pos_id = 105;
let product_id = value.product_id?value.product_id:'';
this.props.onPressShopCar && this.props.onPressShopCar(value.product_skn,product_id,pos_id);
this.props.onPressShopCar && this.props.onPressShopCar(value.product_skn,product_id,pos_id,value.is_global=='Y'?true:false);
}}>
<Image source={require('../../image/dian_gwc_bt.png')} style={styles.image} resizeMode={'contain'}></Image>
</TouchableOpacity>
... ...
... ... @@ -176,11 +176,18 @@ class DetailContainer extends Component {
let {articleId} = detail;
let productSkn = product && product.get('product_skn', 0);
let is_global = product && product.get('is_global', 'N');
if (!productSkn) {
return;
}
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
if (is_global == 'Y') {
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.globalpurchase","params":{"skn":"${productSkn}"}}`;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
try {
... ... @@ -197,12 +204,16 @@ class DetailContainer extends Component {
}
}
_onPressTagProduct(product_skn,rowID,pos_id) {
_onPressTagProduct(product_skn,rowID,pos_id,is_global) {
if (!product_skn) {
return;
}
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${product_skn}"}}`;
if (is_global == 'Y') {
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.globalpurchase","params":{"skn":"${product_skn}"}}`;
}
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
try {
... ... @@ -221,11 +232,12 @@ class DetailContainer extends Component {
}
}
_onPressShopCar(product_skn,prd_id,pos_id) {
_onPressShopCar(product_skn,prd_id,pos_id,isGlobal) {
let param = {
pruduct_skn: product_skn,
fromPage: 'YH_GuangDetailViewController',
pos_id: pos_id,
isGlobal: isGlobal,
}
ReactNative.NativeModules.YH_CommonHelper.showChooseInfoView(param)
... ...
... ... @@ -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,'');
});
};
}
... ...
... ... @@ -90,7 +90,9 @@ export default class ProductListCell extends Component {
<View style={styles.shopTag}>
<Text style={styles.shopTagName}>进入店铺 ></Text>
</View>
<View style={styles.line}/>
<View style={styles.line}>
<Image style={styles.lineImage} source={require('../../image/jiantou_ic.png')}/>
</View>
<View style={styles.bottomView}>
<View style={styles.leftImage}>
</View>
... ... @@ -234,7 +236,7 @@ let styles = StyleSheet.create({
backgroundColor: 'rgb(211,10,35)',
width: 100,
height: 50*width/750,
marginTop: rowMarginTop + rowMarginBottom,
marginTop: rowMarginTop + rowMarginBottom + 10,
marginBottom: 0,
justifyContent: 'center',
alignItems: 'center',
... ... @@ -248,13 +250,18 @@ let styles = StyleSheet.create({
fontWeight: 'bold',
},
line: {
marginTop: 20,
marginTop: 10,
width: rowWidth - 2,
height: 10,
backgroundColor: 'white',
},
lineImage: {
width: rowWidth - 2,
height: 1,
backgroundColor: '#e0e0e0',
height: Math.ceil((rowWidth - 2) * (17/319)),
},
bottomView: {
marginTop: 20,
marginTop: 10,
width: rowWidth - 2,
height: bottomViewH,
backgroundColor: 'white',
... ... @@ -270,7 +277,7 @@ let styles = StyleSheet.create({
width: Math.ceil(rowWidth/2-21),
height: bottomViewH,
backgroundColor: '#444444',
marginLeft: 20,
marginLeft: rowWidth - 20 - 2 * Math.ceil(rowWidth/2-21),
},
activityContainer: {
width: rowWidth,
... ...