user.js 751 B

12345678910111213141516171819202122232425262728293031323334
  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 logout() {
  15. return request({
  16. url: '/logout',
  17. method: 'post'
  18. })
  19. }
  20. //修改用户信息
  21. export function saveUserInfo(data){
  22. return fly.put('/system/user/profile',data).then(res=>res)
  23. }
  24. //修改用户密码
  25. export function savePassword(oldPwd,newPwd){
  26. return fly.put('/system/user/profile/updatePwd',{
  27. oldPassword:oldPwd,
  28. newPassword:newPwd
  29. }).then(res=>res)
  30. }
  31. // export function logout(){
  32. // }