diff --git a/src/views/user/alteration/Alteration.vue b/src/views/user/alteration/Alteration.vue index a947c00..2dbd99c 100644 --- a/src/views/user/alteration/Alteration.vue +++ b/src/views/user/alteration/Alteration.vue @@ -238,27 +238,31 @@ export default { this.cmsFailed('手机号不能为空!') return } - this.state.smsSendBtn = true - let interval = window.setInterval(() => { - if (that.state.time-- <= 0) { - that.state.time = 60 - that.state.smsSendBtn = false - window.clearInterval(interval) + this.form.validateFields(['phone'], { force: true }, (err) => { + if (!err) { + const hide = this.$message.loading('验证码发送中..', 0) + let smsParams = { + phone: phone, + } + getAction('/sys/sendVerificationCode', smsParams).then(res => { + if (!res.success) { + setTimeout(hide, 1) + this.cmsFailed(res.message) + } else { + this.state.smsSendBtn = true + let interval = window.setInterval(() => { + if (that.state.time-- <= 0) { + that.state.time = 60 + that.state.smsSendBtn = false + window.clearInterval(interval) + } + }, 1000) + } + setTimeout(hide, 500) + }) + this.getPublicKey() } - }, 1000) - - const hide = this.$message.loading('验证码发送中..', 0) - let smsParams = { - phone: phone, - } - getAction('/sys/sendVerificationCode', smsParams).then(res => { - if (!res.success) { - setTimeout(hide, 1) - this.cmsFailed(res.message) - } - setTimeout(hide, 500) }) - this.getPublicKey() }, cmsFailed(err) { this.$notification['error']({