import request from '@/utils/request'

// 登录方法
export function login(account, password, mode,captcha) {
  const data = {
    account,
    password,
    mode,
    captcha
  }
  return request({
    url: '/enterprise/v1/account/login',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/enterprise/v1/account/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/enterprise/v1/user/info',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/enterprise/v1/account/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeNum(data) {
  return request({
    url: '/enterprise/v1/sms/captcha',
    headers: {
      isToken: false
    },
    method: 'post',
    data,
    timeout: 20000
  })
}
// 验证码验证
export function codeValid(data) {
  return request({
    url: '/enterprise/v1/sms/captcha/validate',
    headers: {
      isToken: false
    },
    method: 'post',
    data,
  })
}
// 忘记密码/重置密码
export function resetPassword(data) {
  return request({
    url: '/enterprise/v1/account/reset/password',
    headers: {
      isToken: false
    },
    method: 'post',
    data,
  })
}