Commit 818b7fdf authored by 前端-许佳敏's avatar 前端-许佳敏

fix: 修复验证码功能

parent 2e7ef061
......@@ -83,11 +83,15 @@ const Phone = (props) => {
const validatePhoneRequest = async () => {
return new Promise(async (resolve, reject) => {
try {
// 这种情况说明是忘记密码, 无需校验手机号
if (!form.getFieldValue('phone') && form.getFieldValue('account')) {
resolve(true)
return ;
}
const { code } = await PublicApi.getMemberRegisterPhoneCheck({
countryCode: prefixCode,
phone: form.getFieldValue('phone')
}, { ctlType: 'none', useCache: true, ttl: 60 * 1000 })
if (code !== 1000) {
form.setFieldState('phone', state => {
state.errors = ['手机号已存在']
......
......@@ -59,21 +59,6 @@ const GetBack: React.FC = () => {
})
$('onFieldValidateEnd', 'account').subscribe(fieldState => {
if (fieldState.valid) {
if (PATTERN_MAPS.phone.test(fieldState.value)) {
// 校验手机号格式通过时, 需请求接口判断手机号是否存在数据库
PublicApi.getMemberRegisterPhoneCheck({
countryCode: prefixCode,
phone: fieldState.value
}, { ctlType: 'none', useCache: true, ttl: 60 * 1000 }).then(({ code, data }) => {
message.destroy()
if (code === 1000) {
setFieldState('account', state => {
state.errors = ['手机号不存在, 请检查']
})
}
})
return ;
}
if (PATTERN_MAPS.email.test(fieldState.value)) {
// 校验邮箱格式通过时, 需请求接口判断邮箱是否存在数据库
PublicApi.postMemberRegisterEmailCheck({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment