Authored by 于良

Merge branch 'guang' of http://git.yoho.cn/mobile/YH_RNComponent into guang

... ... @@ -12,6 +12,7 @@ import MoreLink from './MoreLink';
import GoodsGroupHeader from './GoodsGroupHeader';
import GoodsGroupList from './GoodsGroupList';
import Small_pic from './Small_pic';
import Weixin from './Weixin';
import ReactNative, {
View,
... ... @@ -73,10 +74,6 @@ export default class Detail extends Component {
return (
<Small_pic resource={rowData}/>
);
}else if (template_name == 'weixinPublic') {
return (
<Text>weixinPublic</Text>
);
}else if (template_name == 'goods_group') {
let {resource} = this.props;
let {goods_group_Filter} = resource;
... ... @@ -98,6 +95,10 @@ export default class Detail extends Component {
<MoreLink resource={rowData} onPressMoreLink={this.props.onPressMoreLink}/>
);
}
}else if (sectionID == 'weixin') {
return (
<Weixin resource={rowData} onPressWeixin={this.props.onPressWeixin}/>
);
}else if (sectionID == 'detailBrand') {
return (
<DetailBrand resource={rowData}/>
... ... @@ -127,6 +128,7 @@ export default class Detail extends Component {
let dataSource = {
detailList: list.size?list.toArray():[],
weixin: [weixin],
detailBrand: [brand],
detailOtherArticle: [otherArticle],
};
... ...
... ... @@ -62,7 +62,7 @@ let styles = StyleSheet.create({
Small_pic: {
flexDirection: 'row',
flex: 1,
backgroundColor: 'red'
backgroundColor: 'white'
},
thumb: {
... ...
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import {getSlicedUrl} from '../../../classify/utils/Utils';
const {
AppRegistry,
StyleSheet,
Text,
View,
Image,
ListView,
Dimensions,
TouchableOpacity,
} = ReactNative;
export default class Weixin extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
}
render() {
let {resource} = this.props;
let data = resource.get('data')?resource.get('data').toJS():null;
if (!data) {
return null;
}
let url1 = data.length>0?data[0].src:null;
let url2 = data.length>1?data[1].src:null;
let text1 = data.length>0?data[0].wechat_id:null;
let text2 = data.length>1?data[1].wechat_id:null;
if (!url1 || !url2) {
return null;
}
let url3 = getSlicedUrl(url1, 640, 640, 2);
let url4 = getSlicedUrl(url2, 640, 640, 2);
return (
<View style={styles.SmallImage}>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.onPressWeixin && this.props.onPressWeixin(text1);
}}>
<View style={{width: width/2-30,height: 100,marginLeft: 20,backgroundColor:'transparent',marginTop: 20,marginBottom: 20}}>
<Image source={{uri: url3}} style={{width: width/2-30,height: 100,backgroundColor:'transparent'}} ></Image>
</View>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.onPressWeixin && this.props.onPressWeixin(text2);
}}>
<View style={{width: width/2-30,height: 100,marginLeft: 10,backgroundColor:'transparent',marginTop: 20,marginBottom: 20}}>
<Image source={{uri: url4}} style={{width: width/2-30,height: 100,marginLeft: 10,backgroundColor:'transparent'}} ></Image>
</View>
</TouchableOpacity>
</View>
);
}
};
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
SmallImage: {
flexDirection: 'row',
flex: 1,
backgroundColor: '#e5e5e5'
},
thumb: {
}
});
... ...
... ... @@ -53,6 +53,7 @@ class DetailContainer extends Component {
this._onPressAuthor = this._onPressAuthor.bind(this);
this._onPressMoreLink = this._onPressMoreLink.bind(this);
this._onPressProduct = this._onPressProduct.bind(this);
this._onPressWeixin = this._onPressWeixin.bind(this);
}
... ... @@ -91,6 +92,10 @@ class DetailContainer extends Component {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
_onPressWeixin(data) {
ReactNative.NativeModules.YH_CommonHelper.copyWechatIdToClipboard(data);
}
_onPressProduct(product) {
let productSkn = product && product.get('product_skn', 0);
if (!productSkn) {
... ... @@ -100,7 +105,7 @@ class DetailContainer extends Component {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
render() {
let {detail} = this.props;
... ... @@ -117,6 +122,7 @@ class DetailContainer extends Component {
onPressAuthor={this._onPressAuthor}
onPressMoreLink={this._onPressMoreLink}
onPressProduct={this._onPressProduct}
onPressWeixin={this._onPressWeixin}
/>
</View>
);
... ...
... ... @@ -68,7 +68,7 @@ export default class BrandArticleList extends Component {
<ListView
contentContainerStyle={styles.contentContainer}
dataSource={this.dataSource.cloneWithRows(articleList.toArray())}
dataSource={this.dataSource.cloneWithRows(articleList)}
renderRow={this._renderRow}
enableEmptySections = {true}
renderSeparator={this._renderSeparator}
... ...
... ... @@ -145,13 +145,12 @@ class DetailContainer extends Component {
/>
);
case 'articleList':
return null;
// return(
// <BrandArticleList
// articleList={detail.get('articleList')}
// onPressArticle={this._onPressArticle}
// onPressArticleLike={this._onPressArticleLike} />
// )
return(
<BrandArticleList
articleList={rowData}
onPressArticle={this._onPressArticle}
onPressArticleLike={this._onPressArticleLike} />
);
default:
return null;
... ...