import request from '@/utils/request'

// 账户登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/login',
    method: 'post',
    data: data
  })
}

// 账户不需要验证码登录方法
export function nameLogin(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/backLogin',
    method: 'post',
    data: data
  })
}

// 手机登录方法
export function phoneLogin(mobile, password, code, uuid) {
  const data = {
    mobile,
    password,
    code,
    uuid
  }
  return request({
    url: '/phoneLogin',
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  // console.log('00000')
  return request({
    url: '/getInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  // console.log('11111')
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    method: 'get'
  })
}

// 获取前台用户注册短信验证码
export function getCodeUserRegister(phoneNumber) {
  return request({
    url: '/captchaUserRegister?phoneNumber=' + phoneNumber,
    method: 'get'
  })
}

// 获取前台用户注册登录验证码
export function getCodeUserLogin(phoneNumber) {
  return request({
    url: '/captchaUserLogin?phoneNumber=' + phoneNumber,
    method: 'get'
  })
}

// 获取前台用户修改密码短信验证码
export function getCodeChangePasswd(phoneNumber) {
  return request({
    url: '/captchaChangePasswd?phoneNumber=' + phoneNumber,
    method: 'get'
  })
}