...
|
...
|
@@ -14,6 +14,8 @@ import ReactNative, { |
|
|
import Banner from '../../../community/components/home/Banner';
|
|
|
import SlicedImage from '../../../common/components/SlicedImage';
|
|
|
import AutoSizeImage from './AutoSizeImage';
|
|
|
import LoadingIndicator from '../../../common/components/LoadingIndicator';
|
|
|
import Prompt from './Prompt';
|
|
|
|
|
|
export default class CouponCenter extends Component {
|
|
|
|
...
|
...
|
@@ -59,12 +61,20 @@ export default class CouponCenter extends Component { |
|
|
case 'getCoupon':
|
|
|
let bg = SlicedImage.getSlicedUrl(data.get('image').get('src'), 0, 0, 2);
|
|
|
let optImage;
|
|
|
let resizeMode = 'contain';
|
|
|
let marginTop = 0;
|
|
|
if (data.get('status') == 1) {
|
|
|
optImage = require('../../images/click-txt.png');
|
|
|
resizeMode = 'center';
|
|
|
marginTop = 0;
|
|
|
} else if (data.get('status') == 2) {
|
|
|
optImage = require('../../images/zero.png');
|
|
|
resizeMode = 'contain';
|
|
|
marginTop = -9;
|
|
|
} else if (data.get('status') == 3) {
|
|
|
optImage = require('../../images/received.png');
|
|
|
resizeMode = 'contain';
|
|
|
marginTop = -9;
|
|
|
}
|
|
|
return (
|
|
|
<Image source={{uri: bg}} style={styles.couponContainer}>
|
...
|
...
|
@@ -80,10 +90,14 @@ export default class CouponCenter extends Component { |
|
|
style={styles.couponRight}
|
|
|
activeOpacity={0.8}
|
|
|
onPress={() => {
|
|
|
this.props.onGetCoupon && this.props.onGetCoupon(data.get('image').get('url'));
|
|
|
if (data.get('status') == 1) {
|
|
|
this.props.onGetCoupon && this.props.onGetCoupon(data.get('couponID'));
|
|
|
} else {
|
|
|
this.props.onPressCoupon && this.props.onPressCoupon(data.get('image').get('url'));
|
|
|
}
|
|
|
}}
|
|
|
>
|
|
|
<Image source={optImage} resizeMode={'center'}/>
|
|
|
<Image source={optImage} resizeMode={resizeMode} style={[styles.rightImage, {marginTop}]}/>
|
|
|
</TouchableOpacity>
|
|
|
</Image>
|
|
|
);
|
...
|
...
|
@@ -94,12 +108,25 @@ export default class CouponCenter extends Component { |
|
|
|
|
|
render() {
|
|
|
let data = this.props.floors.toArray();
|
|
|
|
|
|
return (
|
|
|
<ListView
|
|
|
enableEmptySections={true}
|
|
|
dataSource={this.dataSource.cloneWithRows(data)}
|
|
|
renderRow={this._renderRow}
|
|
|
/>
|
|
|
<View style={styles.container}>
|
|
|
<ListView
|
|
|
enableEmptySections={true}
|
|
|
dataSource={this.dataSource.cloneWithRows(data)}
|
|
|
renderRow={this._renderRow}
|
|
|
/>
|
|
|
<LoadingIndicator
|
|
|
isVisible={this.props.isFetching}
|
|
|
/>
|
|
|
|
|
|
{this.props.showSuccessTip ? <Prompt
|
|
|
icon={require('../../images/hud_success.png')}
|
|
|
text={'领取成功'}
|
|
|
onPromptHidden={this.props.onPromptHidden}
|
|
|
/> : null}
|
|
|
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -107,11 +134,13 @@ export default class CouponCenter extends Component { |
|
|
let {width, height} = Dimensions.get('window');
|
|
|
let bannerHeight = Math.ceil((310 / 640) * width);
|
|
|
let couponHeight = Math.ceil((180 / 640) * width);
|
|
|
let rightWidth = Math.ceil((110 / 640) * width);
|
|
|
let rightHeight = Math.ceil((180 / 110) * rightWidth);
|
|
|
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
|
|
flex: 1,
|
|
|
backgroundColor: '#f0f0f0',
|
|
|
backgroundColor: 'white',
|
|
|
},
|
|
|
textContainer: {
|
|
|
|
...
|
...
|
@@ -119,9 +148,9 @@ let styles = StyleSheet.create({ |
|
|
text: {
|
|
|
fontFamily: 'helvetica',
|
|
|
fontSize: 18,
|
|
|
lineHeight: 56,
|
|
|
lineHeight: 48,
|
|
|
textAlign: 'center',
|
|
|
paddingBottom: (56 - 18) / 2,
|
|
|
paddingBottom: (48 - 18) / 2,
|
|
|
},
|
|
|
couponContainer: {
|
|
|
width,
|
...
|
...
|
@@ -129,11 +158,17 @@ let styles = StyleSheet.create({ |
|
|
flexDirection: 'row',
|
|
|
},
|
|
|
couponLeft: {
|
|
|
flex: 0.8,
|
|
|
flex: 0.78,
|
|
|
},
|
|
|
couponRight: {
|
|
|
flex: 0.2,
|
|
|
justifyContent: 'center',
|
|
|
flex: 0.22,
|
|
|
// justifyContent: 'center',
|
|
|
// alignItems: 'center'
|
|
|
},
|
|
|
|
|
|
rightImage: {
|
|
|
width: rightWidth,
|
|
|
height: rightHeight,
|
|
|
// backgroundColor: 'red'
|
|
|
},
|
|
|
}); |
...
|
...
|
|