user.js 972 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import fly from '@/utils/request'
  2. export function login(username, password) {
  3. const data = {
  4. username,
  5. password
  6. }
  7. return fly.post('/login',data,{headers:{isToken:false}}).then(res => res)
  8. }
  9. // 获取用户详细信息
  10. export function getInfo() {
  11. return fly.get('/getInfo').then(res=>res)
  12. }
  13. //修改用户信息
  14. export function saveUserInfo(data){
  15. return fly.put('/system/user/profile',data).then(res=>res)
  16. }
  17. // 用户头像上传
  18. export function uploadAvatar(data) {
  19. return request({
  20. url: '/system/user/profile/avatar',
  21. method: 'post',
  22. data: data
  23. })
  24. }
  25. //修改用户密码
  26. export function savePassword(oldPwd,newPwd){
  27. return fly.put('/system/user/profile/updatePwd',{
  28. oldPassword:oldPwd,
  29. newPassword:newPwd
  30. }).then(res=>res)
  31. }
  32. //退出
  33. export function logout(){
  34. return fly.post('/logout').then(res=>res)
  35. }
  36. export function resetPwd(username,password){
  37. return fly.put(`/system/user/resetPwd/${username}/${password}`).then(res=>res)
  38. }