🐛 修复样式问题
This commit is contained in:
@@ -209,8 +209,8 @@ defineExpose({ refresh })
|
||||
</div>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div v-if="total > 0" class="mt-4 flex flex-col sm:flex-row items-center justify-between gap-2">
|
||||
<span class="text-sm text-muted-foreground">共 {{ total }} 条</span>
|
||||
<div v-if="total > 0" class="mt-4 flex items-center justify-between gap-2">
|
||||
<span class="text-sm text-muted-foreground whitespace-nowrap">共 {{ total }} 条</span>
|
||||
<Pagination
|
||||
:total="total"
|
||||
:items-per-page="size"
|
||||
|
||||
@@ -38,6 +38,10 @@ const [inviteCode, inviteCodeAttrs] = defineField('inviteCode')
|
||||
|
||||
const captchaOpen = ref(false)
|
||||
const submitting = ref(false)
|
||||
const registered = ref(false)
|
||||
const registeredEmail = ref('')
|
||||
const resending = ref(false)
|
||||
const resendCaptchaOpen = ref(false)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
@@ -76,6 +80,8 @@ async function onCaptchaConfirm(result: { captchaKey: string; dots: Array<{ x: n
|
||||
dots: result.dots,
|
||||
})
|
||||
toast.success('注册成功,请前往邮箱验证')
|
||||
registeredEmail.value = email.value!
|
||||
registered.value = true
|
||||
captchaOpen.value = false
|
||||
} catch (err: any) {
|
||||
if (err?.code === 10003) {
|
||||
@@ -88,6 +94,38 @@ async function onCaptchaConfirm(result: { captchaKey: string; dots: Array<{ x: n
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onResendClick() {
|
||||
const targetEmail = email.value || registeredEmail.value
|
||||
if (!targetEmail) {
|
||||
toast.error('请先填写邮箱')
|
||||
return
|
||||
}
|
||||
registeredEmail.value = targetEmail
|
||||
resendCaptchaOpen.value = true
|
||||
}
|
||||
|
||||
async function onResendCaptchaConfirm(result: { captchaKey: string; dots: Array<{ x: number; y: number }> }) {
|
||||
resending.value = true
|
||||
try {
|
||||
await authApi.resendVerification({
|
||||
email: registeredEmail.value,
|
||||
captchaKey: result.captchaKey,
|
||||
dots: result.dots,
|
||||
})
|
||||
toast.success('验证邮件已重新发送,请查收')
|
||||
resendCaptchaOpen.value = false
|
||||
} catch (err: any) {
|
||||
if (err?.code === 10003) {
|
||||
resendCaptchaOpen.value = false
|
||||
setTimeout(() => { resendCaptchaOpen.value = true }, 100)
|
||||
} else {
|
||||
resendCaptchaOpen.value = false
|
||||
}
|
||||
} finally {
|
||||
resending.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -134,7 +172,15 @@ async function onCaptchaConfirm(result: { captchaKey: string; dots: Array<{ x: n
|
||||
<router-link to="/login" class="text-primary hover:underline ml-1">去登录</router-link>
|
||||
</div>
|
||||
|
||||
<div class="text-center text-sm">
|
||||
<span class="text-muted-foreground">没有收到验证邮件?</span>
|
||||
<button type="button" class="text-primary hover:underline ml-1" :disabled="resending" @click="onResendClick">
|
||||
{{ resending ? '发送中...' : '点击这里重新发送' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<CaptchaDialog v-model:open="captchaOpen" @confirm="onCaptchaConfirm" />
|
||||
<CaptchaDialog v-model:open="resendCaptchaOpen" @confirm="onResendCaptchaConfirm" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user