user.js 812 B

123456789101112131415161718192021222324252627282930
  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 savePassword(oldPwd,newPwd){
  19. return fly.put('/system/user/profile/updatePwd',{
  20. oldPassword:oldPwd,
  21. newPassword:newPwd
  22. }).then(res=>res)
  23. }
  24. //退出
  25. export function logout(){
  26. return fly.post('/logout').then(res=>res)
  27. }
  28. export function resetPwd(username,password){
  29. return fly.put(`/system/user/resetPwd/${username}/${password}`).then(res=>res)
  30. }