import request from '@/utils/request'

const api = {
  register: '/User/Register',
  Login: '/User/Login',
  ImgCaptcha: '/Captcha/ImageCaptcha',
  GetPermissions: '/User/GetPermissions',
  sendEmail: '/Captcha/SendEmail',
  GetLoginUrl: '/UniLogin/GetLoginUrl',
  UniLogin: '/UniLogin/Login'
}

export function register(parameter) {
  return request({
    url: api.register,
    method: 'post',
    data: parameter
  })
}

export function login (parameter) {
  return request({
    url: api.Login,
    method: 'post',
    data: parameter
  })
}

export function sendEmail(parameter) {
  return request({
    url: api.sendEmail,
    method: 'post',
    data: parameter
  })
}

export function getImageCaptcha () {
  return request({
    url: api.ImgCaptcha,
    method: 'get'
  })
}

export function GetPermissions() {
  return request({
    url: api.GetPermissions,
    method: 'get'
  })
}

export function getLoginUrl(parameter) {
  return request({
    url: api.GetLoginUrl,
    method: 'get',
    params: parameter
  })
}

export function uniLogin(parameter) {
  return request({
    url: api.UniLogin,
    method: 'post',
    data: parameter
  })
}