diff --git a/src/components/Apps/UserConfirmDialog/index.vue b/src/components/Apps/UserConfirmDialog/index.vue index 8b09c06f3..8c2b53a0b 100644 --- a/src/components/Apps/UserConfirmDialog/index.vue +++ b/src/components/Apps/UserConfirmDialog/index.vue @@ -50,7 +50,7 @@ - + @@ -175,18 +175,20 @@ export default { this.$axios.post(`/api/v1/authentication/mfa/select/`, { type: 'sms' }).then(res => { this.$message.success(this.$tc('VerificationCodeSent')) let time = 60 - const interval = setInterval(() => { - const originText = this.smsBtnText - this.smsBtnText = this.$t('Pending') + `: ${time}` - this.smsBtnDisabled = true - time -= 1 + this.smsBtnDisabled = true - if (time === 0) { - this.smsBtnText = originText - this.smsBtnDisabled = false + const interval = setInterval(() => { + time -= 1 + this.smsBtnText = `${this.$t('Pending')}: ${time}` + + if (time <= 0) { clearInterval(interval) + this.smsBtnText = this.$t('SendVerificationCode') + this.smsBtnDisabled = false } }, 1000) + }).catch(() => { + this.$message.error(this.$tc('FailedToSendVerificationCode')) }) }, handleConfirm() {