import request from '@/utils/request'

export function login(data) {
  return request({
    url: request.apiModule.authority + '/users/login',
    method: 'post',
    data: data
  })
}

export function systemLang(param) {
  return request({
    url: request.apiModule.authority + '/users/language/' + param,
    method: 'put'
  })
}

export function loginByWechat(data) {
  return request({
    url: request.apiModule.authority + '/users/account/wxLogin',
    method: 'post',
    data: data
  })
}

export function getInfo() {
  return request({
    url: request.apiModule.authority + '/users/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: request.apiModule.authority + '/users/logout',
    method: 'get'
  })
}

export function sendVerificationCode(phone) {
  return request({
    url: request.apiModule.authority + '/users/account/verification/' + phone,
    method: 'get'
  })
}

export function resetPwd(data) {
  return request({
    url: request.apiModule.authority + '/users/account/password',
    method: 'put',
    data: data
  })
}

export function registration(data) {
  return request({
    url: request.apiModule.authority + '/users/account/registration',
    method: 'post',
    data: data
  })
}

//修改密码
export function changePassword(data) {
  return request({
    url: request.apiModule.authority + '/users/modification',
    method: 'put',
    data: data
  })
}

//管理员重置密码
export function resetPassword(id) {
  return request({
    url: request.apiModule.authority + '/users/adres/password/' + id,
    method: 'put'
  })
}

//管理员添加用户
export function addUser(data) {
  return request({
    url: request.apiModule.authority + '/users/admin/addUser',
    method: 'post',
    data: data
  })
}

//获取用户中心 用户信息
export function getUserCenterInfo() {
  return request({
    url: request.apiModule.authority + '/users',
    method: 'get'
  })
}

//更改用户中心 用户信息
export function putUserCenterInfo(data) {
  return request({
    url: request.apiModule.authority + '/users',
    method: 'put',
    data: data
  })
}
