import React from 'react';
class
ReadPacket
extends
React.Component {
constructor(props) {
super(props);
this.state = {
animation: false,
status: 0
};
}
render() {
var
bonus = this.props.thanks ? 0 : parseFloat(this.props.surveyInfo.bonus);
if
(this.state.status == 0) {
return
(
<p className='redpack-container' id='redpack-container'>
<p className='redpack'>
<p className='topcontent'>
<p id='redpack-opened'>
<p className='redpack-avatar'>
<img src='http:
</p>
</p>
<h2 style={{marginTop: 80, color: 'white'}}>奖励</h2>
<span className='redpack-text'>点击下方按钮领取红包</span>
<p className='redpack-description white-text'>恭喜发财 大吉大利</p>
</p>
<p id='redpack-open' className={this.state.animation ? 'rotate' : ''}
onClick={this.openRedPacket.bind(this)}
>
<span>拆红包</span>
</p>
</p>
</p>
);
}
else
if
(bonus == 0) {
return
(
<p className='redpack-container' id='redpack-container'>
<p className='redpack'>
<p className='topcontent-open'>
<p className='redpack-avatar'>
<span id='close'></span>
</p>
<h1 style={{marginTop: 180, color: 'white'}}> 谢谢参与 </h1>
<span className='redpack-text'>多多参与的奖励的机会更多哦</span>
<br/>
<a onClick={this._toWallet.bind(this)}
style={{cursor:'pointer',textDecoration: 'underline', color: 'white'}}>
去我的账户查看
</a>
</p>
<p id='redpack-opened'>
<p className='redpack-avatar'>
<img src='http:
</p>
</p>
</p>
</p>
);
}
else
{
return
(
<p className='redpack-container' id='redpack-container'>
<p className='redpack'>
<p className='topcontent-open'>
<p className='redpack-avatar'>
<span id='close'></span>
</p>
<h1 className='white-text' style={{marginTop: 180}}> {bonus.toFixed(2)} </h1>
<span className='redpack-text'>奖励积分已经存入您的账户</span>
<a className='btn-flat white-text' onClick={this._toWallet.bind(this)}
style={{textDecoration: 'underline'}}>
去我的账户查看积分
</a>
</p>
<p id='redpack-opened'>
<p className='redpack-avatar'>
<img src='http:
</p>
</p>
</p>
</p>
);
}
}
stopAnimation() {
this.setState({animation: false});
}
showResult() {
this.setState({status: 1});
}
openRedPacket() {
this.setState({animation: true});
setTimeout(this.stopAnimation.bind(this), 3000);
setTimeout(this.showResult.bind(this), 4000);
}
_toWallet() {
window.location.hash = '/wallet';
}
}
export
default
ReadPacket;