fix: 错误消息提示

This commit is contained in:
zhangyahui
2025-10-31 11:42:15 +08:00
parent 5606784bb7
commit 6eaf202d91
2 changed files with 14 additions and 24 deletions

View File

@@ -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
}

View File

@@ -66,13 +66,6 @@ const formData = reactive({
password: ''
})
// 表单验证状态
const formErrors = reactive<Record<string, string>>({
name: '',
email: '',
password: ''
})
// 加载状态
const isLoading = ref(false)
@@ -146,13 +139,13 @@ const handleConfirm = async () => {
const handleSignupByGoogle = async () => {
try {
isLoading.value = true
showToast('Google登录功能开发中...')
showToast('Google sign up is not available yet')
// 这里添加Google OAuth登录逻辑
// const response = await googleLoginAPI()
} catch (error) {
console.error('Google登录失败:', error)
showToast('Google登录失败请重试')
showToast(error?.message || 'Google sign up failed, please try again')
} finally {
isLoading.value = false
}