login.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import request from '@/utils/request'
  2. // 登录方法
  3. export function login(username, password, code, uuid) {
  4. const data = {
  5. username,
  6. password,
  7. code,
  8. uuid
  9. }
  10. return request({
  11. url: '/system/auth/login',
  12. method: 'post',
  13. data: data
  14. })
  15. }
  16. // 获取用户详细信息
  17. export function getInfo() {
  18. return request({
  19. url: '/system/auth/get-permission-info',
  20. method: 'get'
  21. })
  22. }
  23. // 退出方法
  24. export function logout() {
  25. return request({
  26. url: '/system/logout',
  27. method: 'post'
  28. })
  29. }
  30. // 获取验证码
  31. export function getCodeImg() {
  32. return request({
  33. url: '/system/captcha/get-image',
  34. method: 'get',
  35. timeout: 20000
  36. })
  37. }
  38. // 社交授权的跳转
  39. export function socialAuthRedirect(type, redirectUri) {
  40. return request({
  41. url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri,
  42. method: 'get'
  43. })
  44. }
  45. // 社交快捷登录,使用 code 授权码
  46. export function socialQuickLogin(type, code, state) {
  47. return request({
  48. url: '/system/auth/social-quick-login',
  49. method: 'post',
  50. data: {
  51. type,
  52. code,
  53. state
  54. }
  55. })
  56. }
  57. // 社交绑定登录,使用 code 授权码 + + 账号密码
  58. export function socialBindLogin(type, code, state, username, password) {
  59. return request({
  60. url: '/system/auth/social-bind-login',
  61. method: 'post',
  62. data: {
  63. type,
  64. code,
  65. state,
  66. username,
  67. password
  68. }
  69. })
  70. }