登录增加验证码切换
This commit is contained in:
@@ -91,6 +91,11 @@ const refreshCaptcha = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
refreshCaptcha
|
||||
})
|
||||
|
||||
const handleLogin = async () => {
|
||||
if (!isFormComplete.value || loading.value) return
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@
|
||||
</div>
|
||||
|
||||
<!-- 登录表单 -->
|
||||
<LoginForm v-if="isLogin" @success="onLoginSuccess" />
|
||||
<LoginForm v-show="isLogin" ref="loginFormRef" @success="onLoginSuccess" />
|
||||
|
||||
<!-- 注册表单 -->
|
||||
<RegisterForm v-else @success="onRegisterSuccess" />
|
||||
<RegisterForm v-show="!isLogin" @success="onRegisterSuccess" />
|
||||
|
||||
<!-- 底部切换 -->
|
||||
<div class="card-footer">
|
||||
@@ -70,6 +70,7 @@ const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const isLogin = ref(true)
|
||||
const loginFormRef = ref(null)
|
||||
const storageLimitGb = ref(50)
|
||||
|
||||
const storageLimitText = computed(() => {
|
||||
@@ -95,6 +96,10 @@ onMounted(() => {
|
||||
|
||||
const toggleMode = () => {
|
||||
isLogin.value = !isLogin.value
|
||||
// 切换到登录时刷新验证码
|
||||
if (isLogin.value && loginFormRef.value) {
|
||||
loginFormRef.value.refreshCaptcha()
|
||||
}
|
||||
}
|
||||
|
||||
const onLoginSuccess = (data) => {
|
||||
|
||||
Reference in New Issue
Block a user