login.js 964 B

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