重置密码的60s冷却🐱🐱

This commit is contained in:
Kunagisa 2025-07-24 21:53:02 +08:00
parent 79f1daf525
commit 0537bdb86e

View File

@ -86,8 +86,10 @@
<span class="error-message" v-if="usernameError">{{ usernameError }}</span> <span class="error-message" v-if="usernameError">{{ usernameError }}</span>
</div> </div>
<div class="login-button"> <div class="login-button">
<button type="submit" :disabled="isSubmitting"> <button type="submit" :disabled="isSubmitting || cooldown > 0">
{{ isSubmitting ? '提交中...' : '重置密码' }} <template v-if="isSubmitting">提交中...</template>
<template v-else-if="cooldown > 0">请稍候 ({{ cooldown }}s)</template>
<template v-else>重置密码</template>
</button> </button>
</div> </div>
<div class="register-link"> <div class="register-link">
@ -132,6 +134,8 @@ const uuidError = ref('')
// //
const isSubmitting = ref(false) const isSubmitting = ref(false)
const cooldown = ref(0)
let cooldownTimer = null
// //
const showError = ref(false) const showError = ref(false)
@ -218,17 +222,23 @@ const uuid_handleForgetPassword = async () => {
if (!uuid_validateForm()) { if (!uuid_validateForm()) {
return return
} }
//console.log(uuid.value);
const user = await getUserByInfo({qq_code:username.value}) const user = await getUserByInfo({qq_code:username.value})
console.log(user)
await requestResetPassword(user.uuid) await requestResetPassword(user.uuid)
isSubmitting.value = true isSubmitting.value = true
cooldown.value = 60
cooldownTimer = setInterval(() => {
if (cooldown.value > 0) {
cooldown.value--
} else {
clearInterval(cooldownTimer)
cooldownTimer = null
}
}, 1000)
}catch ( error){ }catch ( error){
showErrorMessage(error.message || '不是正确的uuid') showErrorMessage(error.message || '不是正确的uuid')
}finally { }finally {
isSubmitting.value = false isSubmitting.value = false
} }
} }