feat: api创建
This commit is contained in:
@@ -48,6 +48,7 @@ import { ref, reactive, computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { showToast } from 'vant'
|
||||
import { google } from '@/assets/base64'
|
||||
import { fetchLogin } from '@/api/login'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -108,23 +109,19 @@ const handleLogin = async () => {
|
||||
|
||||
isLoading.value = true
|
||||
|
||||
try {
|
||||
// 模拟登录API调用
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
|
||||
// 这里添加实际的登录API调用
|
||||
// const response = await loginAPI(formData)
|
||||
|
||||
showToast('登录成功')
|
||||
|
||||
// 登录成功后跳转到主页或工作台
|
||||
router.push('/stylist/customer')
|
||||
} catch (error) {
|
||||
console.error('登录失败:', error)
|
||||
showToast('登录失败,请重试')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
const response: any = await fetchLogin({ ...formData, operationType: 'LOGIN' } as any)
|
||||
if (response.code === 200) {
|
||||
console.log('登录成功', response)
|
||||
// showToast('登录成功')
|
||||
// router.push('/stylist/customer')
|
||||
} else {
|
||||
showToast(response.message)
|
||||
}
|
||||
|
||||
// showToast('登录成功')
|
||||
|
||||
// 登录成功后跳转到主页或工作台
|
||||
// router.push('/stylist/customer')
|
||||
}
|
||||
|
||||
// 处理忘记密码
|
||||
|
||||
Reference in New Issue
Block a user