Authored by yoho-js001
Committed by 盖剑秋

Good goods recommend list UI. reviewed by Boss Yin.

@@ -36,7 +36,7 @@ export default class List extends Component { @@ -36,7 +36,7 @@ export default class List extends Component {
36 } 36 }
37 break; 37 break;
38 case 'list': { 38 case 'list': {
39 - return <ListCell resource={rowData} />; 39 + return <ListCell resource={rowData} onPressDetail={this.props.onPressDetail}/>;
40 } 40 }
41 break; 41 break;
42 } 42 }
@@ -31,17 +31,22 @@ export default class ListCell extends Component { @@ -31,17 +31,22 @@ export default class ListCell extends Component {
31 } 31 }
32 let { 32 let {
33 default_images, 33 default_images,
  34 + product_skn,
  35 + phrase,
  36 + product_name,
34 } = data; 37 } = data;
35 - 38 + default_images = default_images.replace('{width}', 240).replace('{height}', 320).replace('{mode}',2);
36 return ( 39 return (
  40 + <TouchableOpacity style={styles.container} onPress={() => {this.props.onPressDetail && this.props.onPressDetail(product_skn)}}>
37 <View style={styles.container}> 41 <View style={styles.container}>
38 <Image style={styles.image} source={{uri:default_images}}/> 42 <Image style={styles.image} source={{uri:default_images}}/>
39 43
40 <View style={styles.rightPannel}> 44 <View style={styles.rightPannel}>
41 - <Text style={styles.title}>title</Text>  
42 - <Text style={styles.phrase}>content</Text> 45 + <Text numberOfLines={2} style={styles.title}>{product_name}</Text>
  46 + <Text numberOfLines={4} style={styles.phrase}>{phrase}</Text>
43 </View> 47 </View>
44 </View> 48 </View>
  49 + </TouchableOpacity>
45 ); 50 );
46 } 51 }
47 } 52 }
@@ -46,6 +46,7 @@ function mapDispatchToProps(dispatch) { @@ -46,6 +46,7 @@ function mapDispatchToProps(dispatch) {
46 class ListContainer extends Component { 46 class ListContainer extends Component {
47 constructor(props) { 47 constructor(props) {
48 super(props); 48 super(props);
  49 + this._onPressDetail = this._onPressDetail.bind(this);
49 } 50 }
50 51
51 componentDidMount() { 52 componentDidMount() {
@@ -56,11 +57,19 @@ class ListContainer extends Component { @@ -56,11 +57,19 @@ class ListContainer extends Component {
56 57
57 } 58 }
58 59
  60 + _onPressDetail(product_skn) {
  61 + if (!product_skn) {
  62 + return;
  63 + }
  64 + ReactNative.NativeModules.YH_CommonHelper.pushGoodGoodsRecommendDetailWithProductSKN(product_skn.toString());
  65 + }
  66 +
59 render() { 67 render() {
60 let {list} = this.props; 68 let {list} = this.props;
61 return ( 69 return (
62 <List 70 <List
63 resource={list} 71 resource={list}
  72 + onPressDetail={this._onPressDetail}
64 /> 73 />
65 ); 74 );
66 } 75 }