import request from '@/utils/request'
import md5 from 'js-md5'

export function loginByUsername(username, password, code, uuid) {
  var params = new URLSearchParams()
  params.append('account', username)
  params.append('password', md5(password))
  params.append('code', code)
  params.append('uuid', uuid)
  return request({
    url: '/user/login',
    method: 'post',
    data: params
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: {
    }
  })
}

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

