fix: 错误消息提示
This commit is contained in:
@@ -60,8 +60,6 @@ const formData = reactive({
|
||||
password: ''
|
||||
})
|
||||
|
||||
// 移除表单错误状态管理,改用 toast 提示
|
||||
|
||||
// 加载状态
|
||||
const isLoading = ref(false)
|
||||
|
||||
@@ -79,19 +77,19 @@ const validatePassword = (password: string) => {
|
||||
const validateForm = () => {
|
||||
// 验证邮箱
|
||||
if (!formData.email) {
|
||||
showToast('place input your email')
|
||||
showToast('Please input your email')
|
||||
return false
|
||||
} else if (!validateEmail(formData.email)) {
|
||||
showToast('please input valid email')
|
||||
showToast('Please input valid email')
|
||||
return false
|
||||
}
|
||||
|
||||
// 验证密码
|
||||
if (!formData.password) {
|
||||
showToast('please input password')
|
||||
showToast('Please input password')
|
||||
return false
|
||||
} else if (!validatePassword(formData.password)) {
|
||||
showToast('please input correct password')
|
||||
showToast('Please input correct password')
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -111,14 +109,13 @@ const handleLogin = async () => {
|
||||
|
||||
isLoading.value = true
|
||||
|
||||
fetchRegisterOrLogin({ ...formData, operationType: 'LOGIN' }).then((response) => {
|
||||
console.log('登录成功', response)
|
||||
userInfoStore.setToken(response.token)
|
||||
userInfoStore.setUserInfo(response.user)
|
||||
showToast('login success')
|
||||
router.replace('/stylist/customer')
|
||||
fetchRegisterOrLogin({ ...formData, operationType: 'LOGIN' }).then((response) => {
|
||||
console.log('登录成功', response)
|
||||
userInfoStore.setToken(response.token)
|
||||
userInfoStore.setUserInfo(response.user)
|
||||
showToast('login success')
|
||||
router.replace('/stylist/customer')
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 处理忘记密码
|
||||
@@ -131,13 +128,13 @@ const handleForgotPassword = () => {
|
||||
const handleGoogleLogin = async () => {
|
||||
try {
|
||||
isLoading.value = true
|
||||
showToast('Google登录功能开发中...')
|
||||
showToast('Google login is not available yet')
|
||||
|
||||
// 这里添加Google OAuth登录逻辑
|
||||
// const response = await googleLoginAPI()
|
||||
} catch (error) {
|
||||
console.error('Google登录失败:', error)
|
||||
showToast('Google登录失败,请重试')
|
||||
showToast('Google login failed, please try again')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user