chore: 优化部分代码

This commit is contained in:
2024-05-17 21:03:00 +08:00
parent d4b9057554
commit 3a44a818d8
7 changed files with 46 additions and 58 deletions

View File

@@ -16,19 +16,19 @@
:loading="captchaLoading"
:disabled="captchaDisable"
size="large"
@click="handleOpenBehaviorCaptcha"
@click="onCaptcha"
>
{{ captchaBtnName }}
</a-button>
</template>
</GiForm>
<Verify
ref="VerifyRef"
:mode="captchaMode"
:captcha-type="captchaType"
:img-size="{ width: '330px', height: '155px' }"
@success="onCaptcha"
></Verify>
ref="VerifyRef"
:captcha-type="captchaType"
:mode="captchaMode"
:img-size="{ width: '330px', height: '155px' }"
@success="getCaptcha"
/>
</a-modal>
</template>
@@ -137,19 +137,19 @@ const { form, resetForm } = useForm({
const VerifyRef = ref<InstanceType<any>>()
const captchaType = ref('blockPuzzle')
const captchaMode = ref('pop')
const captchaTimer = ref()
const captchaTime = ref(60)
const captchaBtnName = ref('获取验证码')
const captchaDisable = ref(false)
const captchaLoading = ref(false)
// 弹出行为验证码
const handleOpenBehaviorCaptcha = async () => {
const onCaptcha = async () => {
if (captchaLoading.value) return
const isInvalid = await formRef.value?.formRef?.validateField(verifyType.value === 'phone' ? 'phone' : 'email')
if (isInvalid) return
VerifyRef.value.show()
}
const captchaTimer = ref()
const captchaTime = ref(60)
const captchaBtnName = ref('获取验证码')
const captchaDisable = ref(false)
// 重置验证码
const resetCaptcha = () => {
window.clearInterval(captchaTimer.value)
@@ -166,7 +166,7 @@ const reset = () => {
}
// 获取验证码
const onCaptcha = async () => {
const getCaptcha = async () => {
// 发送验证码
try {
captchaLoading.value = true