倒计时

This commit is contained in:
2026-05-12 14:14:21 +08:00
parent 1afcd3313f
commit 49f211f624
2 changed files with 23 additions and 2 deletions

View File

@ -208,7 +208,7 @@ const phoneCaptchaState = initCaptchaState('phone');
const emailCaptchaState = initCaptchaState('email');
const showPwdSendButton = ref(true);
const pwdSendState = ref({ isCounting: false, countdown: 0 });
const pwdSendState = reactive({ isCounting: false, countdown: 0 });
const pwdMobileCaptchaState = initCaptchaState('phone');
const pwdEmailCaptchaState = initCaptchaState('email');
@ -458,9 +458,28 @@ const handleSendPwdCaptcha = async () => {
const updatePwdSendState = () => {
const t = passwordForm.verifyType === 'email' ? pwdEmailCaptchaState : pwdMobileCaptchaState;
pwdSendState.value = { isCounting: t.isCounting.value, countdown: t.countdown.value };
pwdSendState.isCounting = t.isCounting.value;
pwdSendState.countdown = t.countdown.value;
};
// UI
watch(
() => pwdMobileCaptchaState.countdown.value,
() => {
if (passwordForm.verifyType === 'mobile') {
updatePwdSendState();
}
}
);
watch(
() => pwdEmailCaptchaState.countdown.value,
() => {
if (passwordForm.verifyType === 'email') {
updatePwdSendState();
}
}
);
//
const handlePasswordConfirm = async () => {
if (!passwordFormRef.value) return;

View File

@ -49,6 +49,8 @@ const countdown = ref(0)
watch(
() => props.sendState,
(newVal) => {
console.log('监听 倒数 变化');
isCounting.value = newVal.isCounting
countdown.value = newVal.countdown
},