...
|
...
|
@@ -21,86 +21,68 @@ import Immutable from 'immutable'; |
|
|
import SlicedImage from '../../../common/components/SlicedImage';
|
|
|
import HeadTitleCell from '../cell/HeadTitleCell';
|
|
|
import Banner from '../../../common/components/Banner'
|
|
|
import YH_Image from '../../../common/components/YH_Image';
|
|
|
|
|
|
export default class VipUserFloor extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.onPressBanner = this.onPressBanner.bind(this);
|
|
|
this.renderRow = this.renderRow.bind(this);
|
|
|
this.onPressBuy = this.onPressBuy.bind(this);
|
|
|
this.dataSource = new ListView.DataSource({
|
|
|
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
|
|
|
});
|
|
|
}
|
|
|
|
|
|
onPressBanner() {
|
|
|
console.log("banner on press");
|
|
|
}
|
|
|
|
|
|
_getImageUrl(rowId) {
|
|
|
return {uri: 'http://imgsrc.baidu.com/baike/pic/item/e61190ef76c6a7ef560572e1f8faaf51f2de66d2.jpg'};
|
|
|
}
|
|
|
|
|
|
renderRow(rowData, sectionID, rowID, highlightRow) {
|
|
|
let productName = '商品名称';
|
|
|
let productPrice = '888.88';
|
|
|
let orginPrice = '999.999';
|
|
|
let productName = rowData.get('product_name');;
|
|
|
let productPrice = rowData.get('vip1_price');
|
|
|
let orginPrice = rowData.get('market_price');
|
|
|
let productId = rowData.get('product_id');
|
|
|
let productSkn = rowData.get('product_skn');
|
|
|
let imgUrl = SlicedImage.getSlicedUrl(rowData.get('default_images'),cellWidth,120,2);
|
|
|
return (
|
|
|
<View style={styles.row}>
|
|
|
<Image style={styles.image}
|
|
|
source={this._getImageUrl(rowID)}
|
|
|
resizeMode={'cover'}/>
|
|
|
<TouchableOpacity style={styles.row}
|
|
|
onPress={()=>this.props.onPressVipProduct && this.props.onPressVipProduct(productId,productSkn)}>
|
|
|
<YH_Image style={styles.image}
|
|
|
url={imgUrl}
|
|
|
/>
|
|
|
<Text style={styles.vipText} numberOfLines={1}>{productPrice}</Text>
|
|
|
<View style={styles.vipContainer}>
|
|
|
<Text style={styles.discountText} numberOfLines={1}>{orginPrice}</Text>
|
|
|
<Image style={{width:33,height:12,marginLeft:2}}
|
|
|
source={require('../../images/ic_vip_red.png')}/>
|
|
|
</View>
|
|
|
</View>);
|
|
|
}
|
|
|
|
|
|
onPressBuy() {
|
|
|
console.log('buy');
|
|
|
</TouchableOpacity>);
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
let bannerData = Immutable.fromJS(
|
|
|
[{
|
|
|
"src": "http://img10.static.yhbimg.com/yhb-img01/2017/02/13/10/01d3b3208f7b4971396981debc758c7275.jpg?imageView2/{mode}/w/{width}/h/{height}",
|
|
|
"title": "",
|
|
|
"url": "https://feature.yoho.cn/0116/0116SELECTITEMSBOY/index.html?title=超值精选&share_id=1637&openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"param\":{\"share_id\":\"1637\",\"title\":\"超值精选\"},\"share\":\"/operations/api/v5/webshare/getShare\",\"shareparam\":{\"share_id\":\"1637\"},\"title\":\"超值精选\",\"url\":\"https://feature.yoho.cn/0116/0116SELECTITEMSBOY/index.html\"}}"
|
|
|
}
|
|
|
,
|
|
|
{
|
|
|
"src": "http://img10.static.yhbimg.com/yhb-img01/2017/02/13/10/01d3b3208f7b4971396981debc758c7275.jpg?imageView2/{mode}/w/{width}/h/{height}",
|
|
|
"title": "",
|
|
|
"url": "https://feature.yoho.cn/0116/0116SELECTITEMSBOY/index.html?title=超值精选&share_id=1637&openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"param\":{\"share_id\":\"1637\",\"title\":\"超值精选\"},\"share\":\"/operations/api/v5/webshare/getShare\",\"shareparam\":{\"share_id\":\"1637\"},\"title\":\"超值精选\",\"url\":\"https://feature.yoho.cn/0116/0116SELECTITEMSBOY/index.html\"}}"
|
|
|
}
|
|
|
]
|
|
|
);
|
|
|
let data = [1, 1, 1, 1, 1, 1];
|
|
|
let visible = false;
|
|
|
let data = this.props.data;
|
|
|
let title = data.get('title').get('title');
|
|
|
let moreUrl = data.get('title').get('more_url');
|
|
|
let bgUrl = data.get('background').get('src');
|
|
|
let visible = bgUrl ? true : false;
|
|
|
let bannerData = data.get('banner_image');
|
|
|
let productData = data.get('list');
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<HeadTitleCell title={'VIP专享'}/>
|
|
|
<HeadTitleCell title={title} moreUrl={moreUrl}/>
|
|
|
<Banner
|
|
|
data={bannerData}
|
|
|
duration={8}
|
|
|
width={width}
|
|
|
height={bannerHeight}
|
|
|
onPress={this.onPressBanner}
|
|
|
onPress={this.props.onPressVipBannerItem}
|
|
|
/>
|
|
|
|
|
|
<View style={styles.listContianer}>
|
|
|
{visible ?
|
|
|
<Image style={styles.listBg}
|
|
|
source={{uri: 'http://imgsrc.baidu.com/baike/pic/item/e61190ef76c6a7ef560572e1f8faaf51f2de66d2.jpg'}}
|
|
|
resizeMode={'cover'}/> : null}
|
|
|
<YH_Image style={styles.listBg}
|
|
|
url={SlicedImage.getSlicedUrl(bgUrl,width,cellHeight,2)}
|
|
|
/> : null}
|
|
|
<ListView
|
|
|
style={{position:'absolute',left:0,top:5,paddingTop:12,paddingBottom:12}}
|
|
|
contentContainerStyle={styles.listContent}
|
|
|
horizontal={true}
|
|
|
dataSource={this.dataSource.cloneWithRows(data)}
|
|
|
dataSource={this.dataSource.cloneWithRows(productData.toArray())}
|
|
|
renderRow={this.renderRow}
|
|
|
showsHorizontalScrollIndicator={false}
|
|
|
/>
|
...
|
...
|
@@ -120,20 +102,15 @@ let cellHeight = 210; |
|
|
const styles = StyleSheet.create({
|
|
|
container: {
|
|
|
backgroundColor: 'white',
|
|
|
flex: 1
|
|
|
},
|
|
|
listContianer: {
|
|
|
width:width,
|
|
|
height: cellHeight,
|
|
|
alignItems: 'center',
|
|
|
paddingTop: 16,
|
|
|
paddingBottom: 12,
|
|
|
},
|
|
|
listBg: {
|
|
|
width: width,
|
|
|
height: cellHeight,
|
|
|
position: 'absolute',
|
|
|
top: 0,
|
|
|
left: 0,
|
|
|
},
|
|
|
listContent: {
|
|
|
backgroundColor: 'transparent',
|
...
|
...
|
|