login.js 794 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import request from '@/utils/request'
  2. const client_id = 'web'
  3. const client_secret = '123456'
  4. const grant_type = 'password'
  5. const scope = 'server'
  6. // 登录方法
  7. export function login(username, password, code, uuid) {
  8. return request({
  9. url: '/auth/oauth/token',
  10. method: 'post',
  11. params: { username, password, code, uuid, client_id, client_secret, grant_type, scope }
  12. })
  13. }
  14. // 获取用户详细信息
  15. export function getInfo() {
  16. return request({
  17. url: '/system/user/getInfo',
  18. method: 'get'
  19. })
  20. }
  21. // 退出方法
  22. export function logout() {
  23. return request({
  24. url: '/auth/token/logout',
  25. method: 'delete'
  26. })
  27. }
  28. // 获取验证码
  29. export function getCodeImg() {
  30. return request({
  31. url: '/code',
  32. method: 'get'
  33. })
  34. }