diff --git a/apps/web-antd/src/views/_core/authentication/code-login.vue b/apps/web-antd/src/views/_core/authentication/code-login.vue index 1862abf8c..98d75b47c 100644 --- a/apps/web-antd/src/views/_core/authentication/code-login.vue +++ b/apps/web-antd/src/views/_core/authentication/code-login.vue @@ -24,7 +24,7 @@ const accessStore = useAccessStore(); const tenantEnable = isTenantEnable(); const loading = ref(false); -const CODE_LENGTH = 4; +const CODE_LENGTH = 6; const loginRef = ref(); diff --git a/apps/web-antd/src/views/_core/authentication/forget-password.vue b/apps/web-antd/src/views/_core/authentication/forget-password.vue index 4837cf7dc..4534b18d6 100644 --- a/apps/web-antd/src/views/_core/authentication/forget-password.vue +++ b/apps/web-antd/src/views/_core/authentication/forget-password.vue @@ -24,7 +24,7 @@ const router = useRouter(); const tenantEnable = isTenantEnable(); const loading = ref(false); -const CODE_LENGTH = 4; +const CODE_LENGTH = 6; const forgetPasswordRef = ref(); /** 获取租户列表,并默认选中 */ diff --git a/packages/@core/ui-kit/shadcn-ui/src/components/pin-input/input.vue b/packages/@core/ui-kit/shadcn-ui/src/components/pin-input/input.vue index a8557788d..595b7275b 100644 --- a/packages/@core/ui-kit/shadcn-ui/src/components/pin-input/input.vue +++ b/packages/@core/ui-kit/shadcn-ui/src/components/pin-input/input.vue @@ -59,12 +59,16 @@ function handleComplete(e: string[]) { async function handleSend(e: Event) { try { e?.preventDefault(); + // 先执行验证码发送逻辑(包含手机号验证) + await handleSendCode(); + // 只有成功后才开始倒计时 countdown.value = maxTime; startCountdown(); - await handleSendCode(); } catch (error) { console.error('Failed to send code:', error); - // Consider emitting an error event or showing a notification + // 如果发送失败,确保倒计时停止 + countdown.value = 0; + clearTimeout(timer.value); emit('sendError', error); } }