auth.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import config from "@/config"
  2. import tool from "@/utils/tool"
  3. import http from "@/utils/request"
  4. export default {
  5. // 登录获取TOKEN
  6. token: async function (data = {}) {
  7. const query = {
  8. username: data.user,
  9. password: tool.crypto.encrypt(data.password),
  10. code: data.code,
  11. uuid: data.uuid
  12. }
  13. return await http.post(`${config.API_URL}/mes/auth/login`, query);
  14. },
  15. // 获取登录验证码
  16. codeImg: async function () {
  17. return await http.get(`${config.API_URL}/mes/auth/code`);
  18. },
  19. user: {
  20. name: "用户管理",
  21. url: `${config.API_URL}/mes/sysUser`,
  22. get: async function (data = {}) {
  23. return await http.post(`${this.url}/getPage`, data);
  24. },
  25. all: async function (data = {}) {
  26. return await http.post(`${this.url}/getList`, data);
  27. },
  28. add: async function (data = {}) {
  29. return await http.post(`${this.url}/save`, data);
  30. },
  31. edit: async function (data = {}) {
  32. return await http.post(`${this.url}/update`, data);
  33. },
  34. del: async function (data = {}) {
  35. return await http.post(`${this.url}/remove`, data);
  36. },
  37. resetPass: async function (data = {}) {
  38. return await http.post(`${this.url}/resetPass`, data);
  39. },
  40. updatePass: async function (data = {}) {
  41. const query = {
  42. oldPass: tool.crypto.encrypt(data.userPassword),
  43. newPass: tool.crypto.encrypt(data.newPassword)
  44. }
  45. return await http.post(`${this.url}/updatePass`, query);
  46. }
  47. }
  48. }