login.js 1023 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import request from '@/utils/request'
  2. // 登录方法
  3. export function login(username, password, code, uuid) {
  4. return request({
  5. url: '/auth/login',
  6. headers: {
  7. isToken: false,
  8. repeatSubmit: false
  9. },
  10. method: 'post',
  11. data: { username, password, code, uuid }
  12. })
  13. }
  14. // 注册方法
  15. export function register(data) {
  16. return request({
  17. url: '/auth/register',
  18. headers: {
  19. isToken: false
  20. },
  21. method: 'post',
  22. data: data
  23. })
  24. }
  25. // 刷新方法
  26. export function refreshToken() {
  27. return request({
  28. url: '/auth/refresh',
  29. method: 'post'
  30. })
  31. }
  32. // 获取用户详细信息
  33. export function getInfo() {
  34. return request({
  35. url: '/system/user/getInfo',
  36. method: 'get'
  37. })
  38. }
  39. // 退出方法
  40. export function logout() {
  41. return request({
  42. url: '/auth/logout',
  43. method: 'delete'
  44. })
  45. }
  46. // 获取验证码
  47. export function getCodeImg() {
  48. return request({
  49. url: '/code',
  50. headers: {
  51. isToken: false
  52. },
  53. method: 'get',
  54. timeout: 20000
  55. })
  56. }