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