api.js 633 B

123456789101112131415161718192021222324252627282930313233343536
  1. import host from "./config.js"
  2. import api from "./request.js"
  3. const user = uni.getStorageSync('systemUserInfo');
  4. export function get(url, params, baseURL) {
  5. return api({
  6. url,
  7. params,
  8. method: "GET",
  9. baseURL,
  10. })
  11. }
  12. export function post(url, params, baseURL) {
  13. return api({
  14. url,
  15. params,
  16. method: "POST",
  17. header: { "Content-Type": "application/x-www-form-urlencoded" },
  18. baseURL,
  19. })
  20. }
  21. export function u_post(url, params, baseURL) {
  22. params = {
  23. ...params,
  24. userId: user.userId
  25. }
  26. return api({
  27. url,
  28. params,
  29. method: "POST",
  30. header: { "Content-Type": "application/x-www-form-urlencoded" },
  31. baseURL,
  32. })
  33. }