Files
food-hub-ui/src/views/login/index.vue
2025-06-27 17:08:52 +08:00

168 lines
3.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="login-view">
<div class="login-container">
<div class="login-title">
<span class="title">
{{ appStore.appName }}
</span>
</div>
<common-login v-if="authStore.loginType === 'common'"
class="animate__animated animate__bounceIn"/>
<phone-login v-if="authStore.loginType === 'phone'"
class="animate__animated animate__bounceIn"/>
<email-login v-if="authStore.loginType === 'email'"
class="animate__animated animate__bounceIn"/>
<register v-if="authStore.loginType === 'register'"
class="animate__animated animate__bounceIn"/>
</div>
<div class="app-version">
<span>版本号{{ appStore.version }}</span>
</div>
</div>
</template>
<script setup lang="ts">
import CommonLogin from '@/components/Login/CommonLogin.vue'
import PhoneLogin from '@/components/Login/PhoneLogin.vue'
import EmailLogin from '@/components/Login/EmailLogin.vue'
import Register from '@/components/Login/Register.vue'
import { useAuthStore } from '@/store/auth'
import { useAppStore } from '@/store/app.ts'
import { onMounted, onUnmounted } from 'vue'
const authStore = useAuthStore()
const appStore = useAppStore()
onMounted(() => {
authStore.isVerified = false
// authStore.resetLoginForm()
})
onUnmounted(() => {
authStore.stopCountdown()
})
</script>
<style lang="scss">
$form-item-width: 90vw;
$login-height: 500px;
.login-view {
height: 100%;
// display: grid;
// place-items: center;
.login-container {
margin-top: 20vh;
height: $login-height;
// padding: 30px;
// border-radius: 15px;
// box-shadow: 2px 2px 5px #D3D3D3, 4px 4px 10px #A9A9A9;
display: flex;
flex-direction: column;
// justify-content: center;
align-items: center;
gap: 1vh;
.login-title {
margin-bottom: 20px;
.title {
font-size: 1.5rem;
}
}
.common-login {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
gap: 1vh;
.login-form {
.el-form-item {
width: $form-item-width;
}
.login-option {
.el-form-item__content {
justify-content: space-between;
}
}
}
.login-type {
width: 100%;
display: grid;
grid-template-columns: repeat(2, 1fr);
}
.login-others-type {
margin-top: 5vh;
width: 100%;
.el-divider {
.el-divider__text {
color: #A9A9A9;
font-size: 1rem;
}
}
.type-list {
display: flex;
justify-content: space-evenly;
i {
font-size: 1.2rem;
}
i:hover {
cursor: pointer;
filter: brightness(1.5);
}
}
}
.login-register {
margin-top: 10px;
display: flex;
justify-content: center;
span {
font-size: 1.2rem;
}
}
}
.phone-login, .email-login, .register {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 1vh;
.login-form {
.el-form-item {
width: $form-item-width;
}
.code-item {
.el-form-item__content {
flex-wrap: nowrap;
gap: 10px;
}
}
}
}
}
.app-version {
position: absolute;
bottom: 10px;
right: 10px;
}
}
</style>