diff --git a/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue b/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue index 4b1c811..8004477 100644 --- a/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue +++ b/kinit-admin/src/views/Login/components/TelephoneCodeForm.vue @@ -130,17 +130,21 @@ const getSMSCode = async () => { SMSCodeNumber.value = 60 const { getFormData } = methods const formData = await getFormData() - const res = await postSMSCodeApi({ telephone: formData.telephone }) - if (res?.data) { - let timer = setInterval(() => { - SMSCodeNumber.value-- - if (SMSCodeNumber.value < 1) { - SMSCodeStatus.value = true - clearInterval(timer) - } - }, 1000) - } else { - ElMessage.error('发送失败,请联系管理员') + try { + const res = await postSMSCodeApi({ telephone: formData.telephone }) + if (res?.data) { + let timer = setInterval(() => { + SMSCodeNumber.value-- + if (SMSCodeNumber.value < 1) { + SMSCodeStatus.value = true + clearInterval(timer) + } + }, 1000) + } else { + ElMessage.error('发送失败,请联系管理员') + SMSCodeStatus.value = true + } + } catch (e: any) { SMSCodeStatus.value = true } }