fix:短信登录功能修复

This commit is contained in:
ktianc 2023-06-19 14:19:55 +08:00
parent 7f4c0d3fa1
commit f9cc24e84c
4 changed files with 17 additions and 18 deletions

View File

@ -74,6 +74,7 @@ const schema = reactive<FormSchema[]>([
field: 'method',
label: '登录类型',
value: '0',
component: 'Input',
ifshow: () => false
},
{
@ -143,7 +144,7 @@ const signIn = async () => {
} else {
loading.value = false
}
} finally {
} catch (e: any) {
loading.value = false
}
}

View File

@ -56,6 +56,7 @@ const schema = reactive<FormSchema[]>([
field: 'method',
label: '登录类型',
value: '1',
component: 'Input',
ifshow: () => false
},
{
@ -111,7 +112,7 @@ const telephoneCodeLogin = async () => {
} else {
loading.value = false
}
} finally {
} catch (e: any) {
loading.value = false
}
}
@ -129,21 +130,17 @@ const getSMSCode = async () => {
SMSCodeNumber.value = 60
const { getFormData } = methods
const formData = await getFormData<UserLoginType>()
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
}
} finally {
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
}
}

View File

@ -110,7 +110,7 @@ const save = async () => {
} else {
loading.value = false
}
} finally {
} catch (e: any) {
loading.value = false
}
}

View File

@ -122,6 +122,7 @@ export const schema = reactive<FormSchema[]>([
colProps: {
span: 24
},
component: 'Input',
ifshow: (values) => values.menu_type !== '2'
},
{