Authored by lixia.zhang

倒数计时在请求回来之后开始

... ... @@ -49,13 +49,13 @@ export default function native(platform) {
render() {
let type = this.props.type;
let cancleFialdDesc = this.props.cancleFialdDesc;
let cancelFailedDesc = this.props.cancelFailedDesc;
const store = configureStore(getInitialState());
store.dispatch(setPlatform(platform));
store.dispatch(setHost(this.props.host));
store.dispatch(setChannel(this.props.channelId));
store.dispatch(setServiceHost(this.props.serviceHost));
store.dispatch(processCancelFaildDesc(cancleFialdDesc));
store.dispatch(processCancelFaildDesc(cancelFailedDesc));
if (type == 'userLogoutClause') {
return (
<Provider store={store}>
... ...
... ... @@ -58,7 +58,7 @@ export default class UserLogoutFaild extends Component {
<View>
{
this.props.cancleFialdDesc && this.props.cancleFialdDesc.map((item, i) => {
this.props.cancelFailedDesc && this.props.cancelFailedDesc.map((item, i) => {
return <Text style={styles.reasonText}>{i+1}.{item}</Text>
})
}
... ...
... ... @@ -71,17 +71,35 @@ export default class UserLogoutReason extends Component {
if (this.state.resendBtnText !== '获取') {
return;
}else {
this.setState({
countDown: 60,
tickTimeOut: false,
resendBtnText: '59s',
});
this._startTimer();
var degrees = this.state.image0Degree + ',' + this.state.image1Degree + ',' + this.state.image2Degree + ',' + this.state.image3Degree;
this.props.fetchCanleCode && this.props.fetchCanleCode(this.state.mobile, degrees)
}
}
componentWillReceiveProps(nextProps) {
if(nextProps.succeedSendCode != this.props.succeedSendCode) {
try {
if (nextProps.succeedSendCode) {
if (this.state.resendBtnText !== '获取') {
return;
}else {
this.setState({
countDown: 60,
tickTimeOut: false,
resendBtnText: '59s',
});
this._startTimer();
}
}
} catch (e) {
} finally {
}
}
}
render() {
let {imageCheckCodeUrl}=this.props;
return (
... ... @@ -104,7 +122,14 @@ export default class UserLogoutReason extends Component {
<TouchableOpacity
activeOpacity={0.8}
onPress={() => {
this.props.showLogoutReasonModalAction && this.props.showLogoutReasonModalAction(true)
if(this.props.submitBtnEnable){
this.props.showLogoutReasonModalAction && this.props.showLogoutReasonModalAction(true)
this.setState({
countDown: 60,
tickTimeOut: true,
resendBtnText: '获取',
});
}
}}>
<View style={[styles.submitBtn,{backgroundColor:this.props.submitBtnEnable?'#444444':'#b0b0b0'}]}>
<Text style={styles.submitText}>提交</Text>
... ... @@ -122,6 +147,11 @@ export default class UserLogoutReason extends Component {
style={{width:width,height:height, flex: 1, justifyContent: 'center'}}
onPress={() => {
this.props.showLogoutReasonModalAction && this.props.showLogoutReasonModalAction(false)
this.setState({
countDown: 60,
tickTimeOut: true,
resendBtnText: '获取',
});
}}>
<View style={styles.modalView}>
<View style={{marginTop:15,marginBottom:15}}>
... ...
... ... @@ -23,5 +23,6 @@ export default keyMirror({
SHOW_LOGOUT_REASON_MODAL: null,
SET_IMAGE_CHECK_SWITCH_STATE: null,
IMAGE_CHECK_CODE_URL: null,
UPDATE_TIP_MESSAGE: null
UPDATE_TIP_MESSAGE: null,
SUCCEED_SEND_CODE_STATUE: null
});
... ...
... ... @@ -61,13 +61,13 @@ class UserLogoutFaildReasonContainer extends Component {
render() {
let {cancleFialdDesc} = this.props.userLogout;
cancleFialdDesc = cancleFialdDesc.toJS();
let {cancelFailedDesc} = this.props.userLogout;
cancelFailedDesc = cancelFailedDesc.toJS();
return (
<UserLogoutFaild
isFaildReasonPage={true}
gotoOnlineService={this._gotoOnlineService}
cancleFialdDesc={cancleFialdDesc}
cancelFailedDesc={cancelFailedDesc}
/>
);
}
... ...
... ... @@ -102,7 +102,8 @@ class UserLogoutReasonContainer extends Component {
showModalFlag,
imageCheckSwitchState,
imageCheckCodeUrl,
tipMeaasge
tipMeaasge,
succeedSendCode
} = this.props.userLogoutReason;
return (
... ... @@ -120,6 +121,7 @@ class UserLogoutReasonContainer extends Component {
imageCheckSwitchState={imageCheckSwitchState}
imageCheckCodeUrl={imageCheckCodeUrl}
tipMeaasge={tipMeaasge}
succeedSendCode={succeedSendCode}
/>
);
}
... ...
... ... @@ -108,8 +108,8 @@ export function processCancelFaildDesc(desc) {
export function gotoLogoutFaildReason() {
return (dispatch, getState) => {
let {userLogout} = getState();
let {cancleFialdDesc} = userLogout;
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.userLogout","params":{"title":"注销失败","type":"userLogoutFaildReason","cancleFialdDesc":"`+ cancleFialdDesc.toJS().join() +`"}}`;
let {cancelFailedDesc} = userLogout;
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.userLogout","params":{"title":"注销失败","type":"userLogoutFaildReason","cancelFailedDesc":"`+ cancelFailedDesc.toJS().join() +`"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
}
... ...
... ... @@ -13,7 +13,7 @@ let InitialState = Record({
showConfirmLogoutModal: false,
logoutStatus: 0,
tipMessage: '',
cancleFialdDesc: List(),
cancelFailedDesc: List(),
});
export default InitialState;
... ...
... ... @@ -29,7 +29,7 @@ export default function userLogoutReducer(state=initialState, action) {
}
case FETCH_LOGOUT_STATUS_SUCCESS:{
return state.set('logoutStatus',action.payload.state)
.set('cancleFialdDesc', Immutable.fromJS(action.payload.descList))
.set('cancelFailedDesc', Immutable.fromJS(action.payload.descList))
.set('isFetching', false);
}
case FETCH_LOGOUT_STATUS_FAILURE:{
... ... @@ -37,7 +37,7 @@ export default function userLogoutReducer(state=initialState, action) {
.set('tipMessage', action.payload);
}
case SET_CANCEL_FAILD_DESC:{
return state.set('cancleFialdDesc', Immutable.fromJS(action.payload))
return state.set('cancelFailedDesc', Immutable.fromJS(action.payload))
}
}
... ...
... ... @@ -16,6 +16,7 @@ const {
SET_IMAGE_CHECK_SWITCH_STATE,
IMAGE_CHECK_CODE_URL,
UPDATE_TIP_MESSAGE,
SUCCEED_SEND_CODE_STATUE,
} = require('../../constants/actionTypes').default;
export function enableSubmitBtn(flag) {
... ... @@ -53,6 +54,13 @@ export function updateTipMessage(tipMesage) {
}
}
export function setSucceedSendCodeStatus(state) {
return {
type: SUCCEED_SEND_CODE_STATUE,
payload: state
}
}
export function fetchImageCheckSwitchState() {
return (dispatch, getState) => {
let {app} = getState();
... ... @@ -73,11 +81,13 @@ export function fetchCanleCode(mobile, degrees) {
let udid = ReactNative.NativeModules.RNNativeConfig.udid;
return new UserLogoutReasonService(app.host).fetchCancleCode(mobile, degrees, udid)
.then(json => {
dispatch(setSucceedSendCodeStatus(true));
dispatch(fetchImageCheckSwitchState());
dispatch(updateTipMessage('验证短信已发送,请注意查收'));
})
.catch(error => {
if(error.message != '') {
dispatch(setSucceedSendCodeStatus(false));
dispatch(updateTipMessage(error.message));
}
});
... ...
... ... @@ -13,7 +13,8 @@ let InitialState = Record({
submitBtnEnable: false,
imageCheckSwitchState: true,
imageCheckCodeUrl: '',
tipMeaasge: ''
tipMeaasge: '',
succeedSendCode: false
});
export default InitialState;
... ...
... ... @@ -14,7 +14,8 @@ const {
SHOW_LOGOUT_REASON_MODAL,
SET_IMAGE_CHECK_SWITCH_STATE,
IMAGE_CHECK_CODE_URL,
UPDATE_TIP_MESSAGE
UPDATE_TIP_MESSAGE,
SUCCEED_SEND_CODE_STATUE
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -36,6 +37,9 @@ export default function userLogoutReasonReducer(state = initialState, action) {
case UPDATE_TIP_MESSAGE: {
return state.set('tipMeaasge', action.payload);
}
case SUCCEED_SEND_CODE_STATUE: {
return state.set('succeedSendCode', action.payload);
}
}
return state;
... ...