diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js
index 87da6745..b7e3bdd7 100644
--- a/pc4mobx/hrmSalary/components/captchaModal/index.js
+++ b/pc4mobx/hrmSalary/components/captchaModal/index.js
@@ -21,7 +21,7 @@ const { getLabel } = WeaLocaleProvider;
class Index extends Component {
constructor(props) {
super(props);
- this.state = { captcha: "", time: 60 };
+ this.state = { captcha: "", time: 60, loading: false };
this.timeRef = null;
}
@@ -31,10 +31,11 @@ class Index extends Component {
componentWillUnmount() {
clearInterval(this.timeRef);
- this.setState({ captcha: "", time: 60 });
+ this.setState({ captcha: "", time: 60, loading: false });
}
handleSendCaptcha = () => {
+ this.setState({ loading: true });
sendMobileCode({ id: this.props.id }).then(({ status, data }) => {
if (status) {
this.timeRef = setInterval(() => {
@@ -42,12 +43,14 @@ class Index extends Component {
this.setState({ time: time - 1 }, () => {
if (this.state.time === -1) {
clearInterval(this.timeRef);
- this.setState({ time: 60 });
+ this.setState({ time: 60, loading: false });
}
});
}, 1000);
+ } else {
+ this.setState({ loading: false });
}
- });
+ }).catch(() => this.setState({ loading: false }));
};
handleConfirm = async () => {
const type = getQueryString("type"), f = await form.validateForm();
@@ -69,13 +72,13 @@ class Index extends Component {
};
render() {
- const { captcha, time } = this.state, type = getQueryString("type");
+ const { captcha, time, loading } = this.state, type = getQueryString("type");
const itemRender = {
mobileCode: (field, textAreaProps, form, formParams) => {
return (
this.setState({ captcha: form.getFormParams().mobileCode })}/>
-