feat:增加登录模块
This commit is contained in:
@@ -1,30 +1,156 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button type="primary" @click="loginClick">登录</el-button>
|
||||
<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>
|
||||
</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 { useRouter } from 'vue-router'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { isMobile } from 'vue3-common/utils/layoutUtil'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useAppStore } from '@/store/app.ts'
|
||||
import { onMounted, onUnmounted } from 'vue'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const appStore = useAppStore()
|
||||
|
||||
const loginClick = async () => {
|
||||
if (!isMobile()) {
|
||||
ElMessage.error('暂不支持PC端')
|
||||
}
|
||||
await authStore.handleLogin('common')
|
||||
userStore.handleSession(authStore.homeSession)
|
||||
await router.push('/record')
|
||||
}
|
||||
onMounted(() => {
|
||||
authStore.isVerified = false
|
||||
// authStore.resetLoginForm()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
authStore.stopCountdown()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
<style lang="scss">
|
||||
$form-item-width: 300px;
|
||||
$login-height: 500px;
|
||||
|
||||
.login-view {
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
|
||||
.login-container {
|
||||
// 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: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.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: 0.9rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<template>
|
||||
<div class="common-mobile-view food-moment">
|
||||
<moment-card v-for="(item, index) in foodStore.momentList"
|
||||
:key="index" :item="item"/>
|
||||
<el-empty v-if="foodStore.momentList.length === 0" description="暂无朋友圈记录"/>
|
||||
|
||||
<div v-else class="moment-list">
|
||||
<moment-card v-for="(item, index) in foodStore.momentList"
|
||||
:key="index" :item="item"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -22,5 +26,11 @@ onMounted(async () => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
|
||||
.moment-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,17 +14,22 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAppStore } from '@/store/app.ts'
|
||||
import { useUserStore } from '@/store/user.ts'
|
||||
import { useAuthStore } from '@/store/auth.ts'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
|
||||
const viewLatestVersionClick = () => {
|
||||
location.reload()
|
||||
}
|
||||
|
||||
const logoutClick = () => {
|
||||
router.push('/')
|
||||
const logoutClick = async () => {
|
||||
await authStore.handleLogout(userStore.userInfo.username)
|
||||
await router.push('/')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
value-format="YYYY-MM-DD"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图片">
|
||||
<el-form-item label="图片" prop="imageUrl">
|
||||
<upload-image v-model="foodStore.currentRecord.imageUrl"
|
||||
:service-url="fileServiceUrl"
|
||||
:image-limit="1"
|
||||
|
||||
Reference in New Issue
Block a user