From 5c5d5ab0620412f7a1771f9c9918999ae04e864b Mon Sep 17 00:00:00 2001 From: zhaoxiao Date: Mon, 11 Oct 2021 15:37:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/user/alteration/Alteration.vue | 42 +++++++++++++----------- 1 file changed, 23 insertions(+), 19 deletions(-) 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']({