import request from '@/utils/request'

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

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

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

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


// 短信验证码
export function sendSms (params) {
  return request({
    url: '/common/shortMessage/sendSms',
    method: 'post',
    params: params
  })
}


// 验证码校验
export function validateSms (params) {
  return request({
    url: '/common/shortMessage/validateSms',
    method: 'post',
    params: params
  })
}

// 验证码校验
export function improveUserInfo (params) {
  return request({
    url: '/front/loginUp/improveUserInfo',
    method: 'post',
    data: params
  })
}

export function getAreaSchoolAndYears(params){
  return request({
    url: '/front/areaSchools/getAreaSchoolAndYears',
    method: 'get',
    data: params
  })
}

export function sendSmsNoValidation(params){
  return request({
    url: '/common/shortMessage/sendSmsNoValidation',
    method: 'get',
    data: params
  })
}

export function resetCardPassword(params){
  return request({
    url: '/front/loginUp/resetCardPassword',
    method: 'post',
    params: params
  })
}

// 切换角色 changeRole?newRoleId=12
export function changeRole(roleId) {
	return request({
		url: '/changeRole?newRoleId=' + roleId,
		method: 'post'
	})
}
