Showing
4 changed files
with
60 additions
and
7 deletions
@@ -70,9 +70,11 @@ let styles = StyleSheet.create({ | @@ -70,9 +70,11 @@ let styles = StyleSheet.create({ | ||
70 | titleContainer: { | 70 | titleContainer: { |
71 | alignItems:'center', | 71 | alignItems:'center', |
72 | marginTop: 19, | 72 | marginTop: 19, |
73 | - marginBottom:15 | 73 | + marginBottom:15, |
74 | }, | 74 | }, |
75 | contentContainer: { | 75 | contentContainer: { |
76 | + marginLeft: 15, | ||
77 | + marginRight: 15 | ||
76 | }, | 78 | }, |
77 | content: { | 79 | content: { |
78 | color: '#444444', | 80 | color: '#444444', |
@@ -31,7 +31,54 @@ export default class UserLogoutReason extends Component { | @@ -31,7 +31,54 @@ export default class UserLogoutReason extends Component { | ||
31 | image0Degree: 0, | 31 | image0Degree: 0, |
32 | image1Degree: 0, | 32 | image1Degree: 0, |
33 | image2Degree: 0, | 33 | image2Degree: 0, |
34 | - image3Degree: 0 | 34 | + image3Degree: 0, |
35 | + countDown: 59, | ||
36 | + tickTimeOut: false, | ||
37 | + resendBtnText: '获取', | ||
38 | + } | ||
39 | + } | ||
40 | + | ||
41 | + _startTimer() { | ||
42 | + this.timer = setInterval(function () { | ||
43 | + let count = this.state.countDown - 1; | ||
44 | + if (count < 0) { | ||
45 | + count = 60; | ||
46 | + this.setState({ | ||
47 | + countDown: count, | ||
48 | + tickTimeOut: true, | ||
49 | + resendBtnText: '获取', | ||
50 | + }); | ||
51 | + } | ||
52 | + if (!this.state.tickTimeOut) { | ||
53 | + this.setState({ | ||
54 | + countDown: count, | ||
55 | + resendBtnText: count+'s', | ||
56 | + }); | ||
57 | + } | ||
58 | + }.bind(this), 1000); | ||
59 | + | ||
60 | + } | ||
61 | + | ||
62 | + componentWillUnmount() { | ||
63 | + this.timer && clearInterval(this.timer); | ||
64 | + } | ||
65 | + | ||
66 | + _sendConfirmPaySnsCode() { | ||
67 | + if (this.state.mobile == '') { | ||
68 | + this.props.mobileEmptyTip(); | ||
69 | + return; | ||
70 | + } | ||
71 | + if (this.state.resendBtnText !== '获取') { | ||
72 | + return; | ||
73 | + }else { | ||
74 | + this.setState({ | ||
75 | + countDown: 60, | ||
76 | + tickTimeOut: false, | ||
77 | + resendBtnText: '59s', | ||
78 | + }); | ||
79 | + this._startTimer(); | ||
80 | + var degrees = this.state.image0Degree + ',' + this.state.image1Degree + ',' + this.state.image2Degree + ',' + this.state.image3Degree; | ||
81 | + this.props.fetchCanleCode && this.props.fetchCanleCode(this.state.mobile, degrees) | ||
35 | } | 82 | } |
36 | } | 83 | } |
37 | 84 | ||
@@ -103,10 +150,9 @@ export default class UserLogoutReason extends Component { | @@ -103,10 +150,9 @@ export default class UserLogoutReason extends Component { | ||
103 | <TouchableOpacity | 150 | <TouchableOpacity |
104 | style={{width:70,height:35,marginRight:5}} | 151 | style={{width:70,height:35,marginRight:5}} |
105 | onPress={() => { | 152 | onPress={() => { |
106 | - var degrees = this.state.image0Degree + ',' + this.state.image1Degree + ',' + this.state.image2Degree + ',' + this.state.image3Degree; | ||
107 | - this.props.fetchCanleCode && this.props.fetchCanleCode(this.state.mobile, degrees) | 153 | + this._sendConfirmPaySnsCode() |
108 | }}> | 154 | }}> |
109 | - <Text style={{lineHeight:30,textAlign:'right',fontSize:14,color:'#444444',letterSpacing:-0.34}}>获取</Text> | 155 | + <Text style={{lineHeight:30,textAlign:'right',fontSize:14,color:'#444444',letterSpacing:-0.34}}>{this.state.resendBtnText}</Text> |
110 | </TouchableOpacity> | 156 | </TouchableOpacity> |
111 | </View> | 157 | </View> |
112 | {this.props.imageCheckSwitchState ? | 158 | {this.props.imageCheckSwitchState ? |
@@ -51,6 +51,7 @@ class UserLogoutReasonContainer extends Component { | @@ -51,6 +51,7 @@ class UserLogoutReasonContainer extends Component { | ||
51 | this._changeImageCode = this._changeImageCode.bind(this); | 51 | this._changeImageCode = this._changeImageCode.bind(this); |
52 | this._onPromptHidden = this._onPromptHidden.bind(this); | 52 | this._onPromptHidden = this._onPromptHidden.bind(this); |
53 | this._gotoLogoutStatus = this._gotoLogoutStatus.bind(this); | 53 | this._gotoLogoutStatus = this._gotoLogoutStatus.bind(this); |
54 | + this._mobileEmptyTip = this._mobileEmptyTip.bind(this); | ||
54 | } | 55 | } |
55 | 56 | ||
56 | componentDidMount() { | 57 | componentDidMount() { |
@@ -85,6 +86,10 @@ class UserLogoutReasonContainer extends Component { | @@ -85,6 +86,10 @@ class UserLogoutReasonContainer extends Component { | ||
85 | this.props.actions.updateTipMessage(''); | 86 | this.props.actions.updateTipMessage(''); |
86 | } | 87 | } |
87 | 88 | ||
89 | + _mobileEmptyTip() { | ||
90 | + this.props.actions.updateTipMessage('手机号不能为空'); | ||
91 | + } | ||
92 | + | ||
88 | _gotoLogoutStatus(){ | 93 | _gotoLogoutStatus(){ |
89 | this.props.actions.gotoLogoutStatus(); | 94 | this.props.actions.gotoLogoutStatus(); |
90 | } | 95 | } |
@@ -106,6 +111,7 @@ class UserLogoutReasonContainer extends Component { | @@ -106,6 +111,7 @@ class UserLogoutReasonContainer extends Component { | ||
106 | changeImageCode={this._changeImageCode} | 111 | changeImageCode={this._changeImageCode} |
107 | onPromptHidden={this._onPromptHidden} | 112 | onPromptHidden={this._onPromptHidden} |
108 | gotoLogoutStatus={this._gotoLogoutStatus} | 113 | gotoLogoutStatus={this._gotoLogoutStatus} |
114 | + mobileEmptyTip={this._mobileEmptyTip} | ||
109 | submitBtnEnable={submitBtnEnable} | 115 | submitBtnEnable={submitBtnEnable} |
110 | showModalFlag={showModalFlag} | 116 | showModalFlag={showModalFlag} |
111 | imageCheckSwitchState={imageCheckSwitchState} | 117 | imageCheckSwitchState={imageCheckSwitchState} |
@@ -94,8 +94,7 @@ export function confirmLogout(code, reason) { | @@ -94,8 +94,7 @@ export function confirmLogout(code, reason) { | ||
94 | let udid = ReactNative.NativeModules.RNNativeConfig.udid; | 94 | let udid = ReactNative.NativeModules.RNNativeConfig.udid; |
95 | return new UserLogoutReasonService('http://api-test3.yohops.com:9999/').confirmLogout(code, reason, udid) | 95 | return new UserLogoutReasonService('http://api-test3.yohops.com:9999/').confirmLogout(code, reason, udid) |
96 | .then(json => { | 96 | .then(json => { |
97 | - console.log(json); | ||
98 | - // dispatch(showLogoutReasonModal(false)); | 97 | + dispatch(showLogoutReasonModal(false)); |
99 | dispatch(gotoLogoutStatus()); | 98 | dispatch(gotoLogoutStatus()); |
100 | 99 | ||
101 | }) | 100 | }) |
-
Please register or login to post a comment