import upload from '@/utils/upload'
import request from '@/utils/request'

// 用户密码重置
export function modifyPassword(data) {
  return request({
    url: '/sys/user/profile/modifyPassword',
    method: 'post',
    data: data
  })
}

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

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

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

// 查询用户个人信息
export function getLoginUserInfo() {
  return request({
    url: '/sys/user/getLoginUser',
    method: 'get'
  })
}
export function list() {
  return request({
    url: '/sys/user/list',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/system/user/profile/avatar',
    name: data.name,
    filePath: data.filePath
  })
}
export function checkUserAccountExist(data){
	return request({
	  url: '/sys/user/checkUserAccount/'+data,
	  method: 'get'
	})
}