import request from '@/utils/request'

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/buyer/member/userLogin',
    headers: {
      isToken: false
    },
    method: 'post',
    params: data
  })
}

// 注册方法
export function register(params) {
  return request({
    url: '/buyer/member/register',
    headers: {
      isToken: false,
      uuid: localStorage.getItem('uuid')
    },
    method: 'get',
    params
  })
}

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

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

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

// 发送短信验证码
export function sendSms(params) {
  return request({
    url: `/common/sms/${params.verificationEnums}/${params.mobile}`,
    headers: {
      isToken: false
    },
    method: 'get'
  })
}

// 通过图形验证码重置密码
export function resetByCode(data) {
  return request({
    url: '/buyer/member/resetByCode',
    method: 'post',
    headers: {
      isToken: false
    },
    data
  })
}

// 通过短信重置密码
export function resetByMobile(data) {
  return request({
    url: '/buyer/member/resetByMobile',
    method: 'post',
    headers: {
      isToken: false
    },
    data: data
  })
}


