2025-10-10 11:00:08 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="login-page">
|
|
|
|
|
|
<div class="content">
|
|
|
|
|
|
<div class="back-button" @click="goBack">
|
2025-10-15 14:52:21 +08:00
|
|
|
|
<img src="@/assets/images/arrow_left.png" class="back-icon" />
|
2025-10-10 11:00:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="header">
|
2025-10-15 14:52:21 +08:00
|
|
|
|
<div class="title">Log in.</div>
|
2025-10-10 11:00:08 +08:00
|
|
|
|
<p class="subtitle">Redefine the styling experience with AI.</p>
|
2025-10-15 14:52:21 +08:00
|
|
|
|
<p class="subtitle">Use Styling Angel to speed up your fashion journey.</p>
|
2025-10-10 11:00:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="login-container">
|
2025-10-22 14:03:57 +08:00
|
|
|
|
<div class="login-form">
|
2025-10-10 11:00:08 +08:00
|
|
|
|
<div class="input-group">
|
2025-10-22 14:03:57 +08:00
|
|
|
|
<input type="email" v-model="formData.email" placeholder="Email" class="input-field" />
|
2025-10-10 11:00:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="input-group pwd">
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="password"
|
|
|
|
|
|
v-model="formData.password"
|
|
|
|
|
|
placeholder="Your Password"
|
|
|
|
|
|
class="input-field"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-10-22 14:03:57 +08:00
|
|
|
|
<div class="login-button" @click="handleLogin">Log in</div>
|
2025-10-15 14:52:21 +08:00
|
|
|
|
<div class="forgot-password" @click="handleForgotPassword">Forgot password?</div>
|
2025-10-10 11:00:08 +08:00
|
|
|
|
|
2025-10-15 14:52:21 +08:00
|
|
|
|
<div type="button" class="google-button" @click="handleGoogleLogin">
|
|
|
|
|
|
<img :src="google" class="google-icon" />
|
2025-10-10 11:00:08 +08:00
|
|
|
|
Sign in with Google
|
|
|
|
|
|
</div>
|
2025-10-15 14:52:21 +08:00
|
|
|
|
<div class="sign-up-button" @click="handleSignup">Don’t have an account? Sign Up</div>
|
2025-10-22 14:03:57 +08:00
|
|
|
|
</div>
|
2025-10-10 11:00:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="footer">
|
|
|
|
|
|
<p>Powered by AiDLab for Lane Crawford</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { ref, reactive, computed } from 'vue'
|
|
|
|
|
|
import { useRouter } from 'vue-router'
|
2025-10-27 11:08:26 +08:00
|
|
|
|
import { useUserInfoStore } from '@/stores'
|
2025-10-10 11:00:08 +08:00
|
|
|
|
import { showToast } from 'vant'
|
2025-10-15 14:52:21 +08:00
|
|
|
|
import { google } from '@/assets/base64'
|
2025-10-27 11:08:26 +08:00
|
|
|
|
import { fetchRegisterOrLogin } from '@/api/login'
|
2025-10-10 11:00:08 +08:00
|
|
|
|
|
|
|
|
|
|
const router = useRouter()
|
2025-10-27 11:08:26 +08:00
|
|
|
|
const userInfoStore = useUserInfoStore()
|
2025-10-10 11:00:08 +08:00
|
|
|
|
|
|
|
|
|
|
// 表单数据
|
2025-10-27 11:08:26 +08:00
|
|
|
|
const formData = reactive({
|
2025-10-10 11:00:08 +08:00
|
|
|
|
email: '',
|
|
|
|
|
|
password: ''
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-10-20 17:01:37 +08:00
|
|
|
|
// 移除表单错误状态管理,改用 toast 提示
|
2025-10-10 11:00:08 +08:00
|
|
|
|
|
|
|
|
|
|
// 加载状态
|
|
|
|
|
|
const isLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
// 表单验证规则
|
|
|
|
|
|
const validateEmail = (email: string) => {
|
|
|
|
|
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
|
|
|
|
|
return emailRegex.test(email)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const validatePassword = (password: string) => {
|
|
|
|
|
|
return password.length >= 6
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证表单
|
|
|
|
|
|
const validateForm = () => {
|
|
|
|
|
|
// 验证邮箱
|
|
|
|
|
|
if (!formData.email) {
|
2025-10-30 13:54:11 +08:00
|
|
|
|
showToast('place input your email')
|
2025-10-20 17:01:37 +08:00
|
|
|
|
return false
|
2025-10-10 11:00:08 +08:00
|
|
|
|
} else if (!validateEmail(formData.email)) {
|
2025-10-30 13:54:11 +08:00
|
|
|
|
showToast('please input valid email')
|
2025-10-20 17:01:37 +08:00
|
|
|
|
return false
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证密码
|
|
|
|
|
|
if (!formData.password) {
|
2025-10-30 13:54:11 +08:00
|
|
|
|
showToast('please input password')
|
2025-10-20 17:01:37 +08:00
|
|
|
|
return false
|
2025-10-10 11:00:08 +08:00
|
|
|
|
} else if (!validatePassword(formData.password)) {
|
2025-10-30 13:54:11 +08:00
|
|
|
|
showToast('please input correct password')
|
2025-10-20 17:01:37 +08:00
|
|
|
|
return false
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-20 17:01:37 +08:00
|
|
|
|
return true
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 返回上一页
|
|
|
|
|
|
const goBack = () => {
|
|
|
|
|
|
router.go(-1)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理登录
|
|
|
|
|
|
const handleLogin = async () => {
|
|
|
|
|
|
if (!validateForm()) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
isLoading.value = true
|
|
|
|
|
|
|
2025-10-27 11:08:26 +08:00
|
|
|
|
fetchRegisterOrLogin({ ...formData, operationType: 'LOGIN' }).then((response) => {
|
|
|
|
|
|
console.log('登录成功', response)
|
|
|
|
|
|
userInfoStore.setToken(response.token)
|
|
|
|
|
|
userInfoStore.setUserInfo(response.user)
|
2025-10-30 13:31:17 +08:00
|
|
|
|
showToast('login success')
|
2025-10-27 11:08:26 +08:00
|
|
|
|
router.replace('/stylist/customer')
|
|
|
|
|
|
})
|
2025-10-10 11:00:08 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理忘记密码
|
|
|
|
|
|
const handleForgotPassword = () => {
|
|
|
|
|
|
// 这里可以跳转到忘记密码页面
|
2025-10-22 14:03:57 +08:00
|
|
|
|
router.push('/reset')
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理Google登录
|
|
|
|
|
|
const handleGoogleLogin = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
isLoading.value = true
|
|
|
|
|
|
showToast('Google登录功能开发中...')
|
|
|
|
|
|
|
|
|
|
|
|
// 这里添加Google OAuth登录逻辑
|
|
|
|
|
|
// const response = await googleLoginAPI()
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('Google登录失败:', error)
|
|
|
|
|
|
showToast('Google登录失败,请重试')
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
isLoading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理注册
|
|
|
|
|
|
const handleSignup = () => {
|
|
|
|
|
|
router.push('/signup')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-20 17:01:37 +08:00
|
|
|
|
// 移除实时验证输入的错误显示逻辑,改用表单提交时统一验证
|
2025-10-10 11:00:08 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
|
.login-page {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
background-image: url('@/assets/images/login_bg.png');
|
|
|
|
|
|
background-size: cover;
|
|
|
|
|
|
background-position: center;
|
|
|
|
|
|
background-repeat: no-repeat;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
padding-top: 12rem;
|
|
|
|
|
|
font-family: 'satoshiRegular';
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.back-button {
|
2025-10-15 14:52:21 +08:00
|
|
|
|
// position: absolute;
|
|
|
|
|
|
// top: 2rem;
|
|
|
|
|
|
// left: 2rem;
|
|
|
|
|
|
margin-top: 2.4rem;
|
|
|
|
|
|
margin-left: 6.1rem;
|
|
|
|
|
|
width: 2rem;
|
|
|
|
|
|
height: 3.4rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
z-index: 3;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
font-size: 3.4rem;
|
|
|
|
|
|
.back-icon {
|
|
|
|
|
|
width: 2.83rem;
|
|
|
|
|
|
height: 3.47rem;
|
|
|
|
|
|
}
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.header {
|
2025-10-15 14:52:21 +08:00
|
|
|
|
margin-top: 1.42rem;
|
|
|
|
|
|
padding-left: 15.5rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
color: white;
|
2025-10-13 10:13:54 +08:00
|
|
|
|
font-family: 'satoshiRegular';
|
2025-10-15 14:52:21 +08:00
|
|
|
|
.title {
|
|
|
|
|
|
font-size: 11rem;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
margin-bottom: 0.8rem;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
font-family: 'satoshiBold';
|
|
|
|
|
|
}
|
2025-10-10 11:00:08 +08:00
|
|
|
|
|
2025-10-15 14:52:21 +08:00
|
|
|
|
.subtitle {
|
|
|
|
|
|
font-size: 3rem;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
line-height: 141%;
|
|
|
|
|
|
letter-spacing: 0.08rem;
|
|
|
|
|
|
}
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-15 14:52:21 +08:00
|
|
|
|
.content {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
// z-index: 2;
|
|
|
|
|
|
flex: 1;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
margin-top: 7.2rem;
|
|
|
|
|
|
.login-form {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
width: calc(100% - 28.4rem);
|
|
|
|
|
|
height: 107.8rem;
|
|
|
|
|
|
background: radial-gradient(
|
|
|
|
|
|
100% 100% at 0% 0%,
|
|
|
|
|
|
rgba(115, 115, 115, 0.4) 0%,
|
|
|
|
|
|
rgba(0, 0, 0, 0) 100%
|
|
|
|
|
|
);
|
|
|
|
|
|
backdrop-filter: blur(35px);
|
|
|
|
|
|
border: 2px solid rgba(255, 255, 255, 0.15);
|
|
|
|
|
|
border-radius: 4.79rem;
|
|
|
|
|
|
padding: 11.2rem 8.62rem 14.28rem 7.18rem;
|
|
|
|
|
|
box-shadow: 0 0.8rem 3.2rem rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
border: 2px solid #fff;
|
|
|
|
|
|
font-size: 3.83rem;
|
|
|
|
|
|
}
|
2025-10-10 11:00:08 +08:00
|
|
|
|
|
|
|
|
|
|
.input-field {
|
|
|
|
|
|
width: 100%;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
height: 10rem;
|
2025-10-30 16:28:28 +08:00
|
|
|
|
padding: 1.6rem 2rem;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
border: 2px solid #fff;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
border-radius: 7.1rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
color: white;
|
|
|
|
|
|
outline: none;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
font-size: 3.83rem;
|
|
|
|
|
|
padding: 0 5.5rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.input-field::placeholder {
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.6);
|
2025-10-15 14:52:21 +08:00
|
|
|
|
font-size: 3.83rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.input-group {
|
2025-10-15 14:52:21 +08:00
|
|
|
|
margin-bottom: 4rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
&.pwd {
|
2025-10-15 14:52:21 +08:00
|
|
|
|
margin-bottom: 6.7rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.login-button {
|
|
|
|
|
|
width: 100%;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
height: 10rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
background: #000;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
border: none;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
border-radius: 7rem;
|
|
|
|
|
|
font-size: 4rem;
|
|
|
|
|
|
margin-bottom: 1.67rem;
|
2025-10-22 14:03:57 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
line-height: 10rem;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
.forgot-password {
|
|
|
|
|
|
font-family: 'satoshiRegular';
|
|
|
|
|
|
font-size: 2.39rem;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
|
text-decoration-style: bold;
|
|
|
|
|
|
margin-bottom: 21.47rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.google-button {
|
|
|
|
|
|
width: 100%;
|
2025-10-30 16:28:28 +08:00
|
|
|
|
padding: 1.6rem;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
border: 2px solid #fff;
|
|
|
|
|
|
border-radius: 7rem;
|
|
|
|
|
|
font-size: 3.83rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
column-gap: 3.1rem;
|
|
|
|
|
|
margin-bottom: 1.67rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
2025-10-15 14:52:21 +08:00
|
|
|
|
.sign-up-button {
|
|
|
|
|
|
font-family: 'satoshiRegular';
|
|
|
|
|
|
font-size: 2.39rem;
|
|
|
|
|
|
font-weight: 400;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-15 14:52:21 +08:00
|
|
|
|
.google-icon {
|
|
|
|
|
|
width: 4.8rem;
|
|
|
|
|
|
height: 4.8rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.footer {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
color: white;
|
2025-10-15 14:52:21 +08:00
|
|
|
|
font-size: 3rem;
|
|
|
|
|
|
margin-bottom: 15.5rem;
|
2025-10-10 11:00:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|