import request from '@/utils/request'
import { getClient } from '@/utils/client'

// 登录
export function mobileLogin(data: Record<string, any>) {
    return request.post({ url: '/login/mobileLogin', data })
}

// 账号登录
export function accountLogin(data: Record<string, any>) {
    return request.post({ url: '/login/accountLogin', data })
}

// 邮箱登录
export function emailLogin(data: any) {
    return request.post({
        url: '/login/emailLogin',
        data: { ...data, terminal: getClient() }
    })
}

//邮箱注册
export function emailRegister(data: any) {
    return request.post({
        url: '/login/email/register',
        data
    })
}

//发送邮箱验证码
export function sendEmailCode(data: any) {
    return request.post({ url: '/index/sendEmail', data })
}

//注册
export function register(data: Record<string, any>) {
    return request.post({ url: '/login/register', data })
}

//忘记密码
export function forgotPassword(data: Record<string, any>) {
    return request.post({ url: '/user/forgotPwd', data })
}

//邮箱忘记密码
export function emailForgotPassword(data: Record<string, any>) {
    return request.post({ url: '/user/email/forgotPwd', data })
}

//向微信请求code的链接
export function getWxCodeUrl(data: Record<string, any>) {
    return request.get({ url: '/login/oaCodeUrl', data })
}

// 微信小程序登录

export function mnpLogin(data: Record<string, any>) {
    return request.post({ url: '/login/mnpLogin', data })
}

// APP登录
export function uninAppLogin(data: Record<string, any>) {
    return request.post({ url: '/login/appLogin', data })
}

// 公众号登录
export function OALogin(data: Record<string, any>) {
    return request.post({ url: '/login/oaLogin', data })
}

//获取图形验证码
export function captcha() {
    return request.get({ url: '/login/captcha' })
}