feat: 重构登录和注册流程,添加邮箱验证和验证码输入组件,优化样式

This commit is contained in:
2025-12-12 14:44:30 +07:00
parent 5bd063f982
commit 2d82ef6e35
10 changed files with 189 additions and 58 deletions

View File

@@ -0,0 +1,46 @@
<script lang='ts' setup>
import type { PropType } from "vue";
import type { AuthUserSignup } from "@/auth/type";
import { toastController } from "@ionic/vue";
const emit = defineEmits<{
(e: "success", value: AuthUserSignup): void;
}>();
const model = defineModel({ type: Object as PropType<AuthUserSignup>, required: true });
async function submitSignup() {
if (model.value.verificationCode.length !== 6) {
const toast = await toastController.create({
message: "Please enter a valid 6-digit verification code.",
duration: 1500,
position: "bottom",
});
await toast.present();
return;
}
emit("success", model.value);
}
</script>
<template>
<h1><strong>Verify your email</strong></h1>
<p>We have sent a verification code to {{ model.email }}. Please enter the code below to verify your email address.</p>
<div>
<ion-input-otp v-model="model.verificationCode" :length="6" />
<!--
<ui-input v-model="model.name" placeholder="Name" />
<ui-input v-model="model.password" placeholder="Password" />
<ui-input v-model="model.confirmPassword" placeholder="Confirm Password" /> -->
<ion-button expand="block" class="ion-margin-top" shape="round" @click="submitSignup">
Submit
</ion-button>
</div>
</template>
<style scoped></style>