代理记账中共新前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

66 line
1.1 KiB

  1. import request from '@/utils/request'
  2. import { encrypt } from '@/utils/jsencrypt' // 公钥,私钥都声明在里面
  3. // 登录方法
  4. export function login(username, password, code, uuid) {
  5. const data = {
  6. username,
  7. password,
  8. code,
  9. uuid
  10. }
  11. if(process.env.VUE_APP_ENABLE_SECRET)
  12. {
  13. data.username = encrypt(username);
  14. data.password = encrypt(password);
  15. }
  16. return request({
  17. url: '/login',
  18. headers: {
  19. isToken: false
  20. },
  21. method: 'post',
  22. data: data
  23. })
  24. }
  25. // 注册方法
  26. export function register(data) {
  27. return request({
  28. url: '/register',
  29. headers: {
  30. isToken: false
  31. },
  32. method: 'post',
  33. data: data
  34. })
  35. }
  36. // 获取用户详细信息
  37. export function getInfo() {
  38. return request({
  39. url: '/getInfo',
  40. method: 'get'
  41. })
  42. }
  43. // 退出方法
  44. export function logout() {
  45. return request({
  46. url: '/logout',
  47. method: 'post'
  48. })
  49. }
  50. // 获取验证码
  51. export function getCodeImg() {
  52. return request({
  53. url: '/captchaImage',
  54. headers: {
  55. isToken: false
  56. },
  57. method: 'get',
  58. timeout: 20000
  59. })
  60. }