request.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // const baseUrl = 'https://jlxwjr.jljrkg.com';
  2. const imageUrl = 'https://jlxwjr.jljrkg.com';
  3. // const baseUrl = 'http://127.0.0.1:7004';
  4. const baseUrl = 'https://ccss.windd.cn';
  5. module.exports = {
  6. imageUrl,
  7. query({url, data, method = 'GET'}) {
  8. return new Promise((resolve, reject) => {
  9. wx.request({
  10. url: `${baseUrl}/${url}`,
  11. data: data,
  12. method: method,
  13. timeout: 5000,
  14. header: {'content-type': 'application/json'},
  15. dataType: 'json',
  16. success: resolve,
  17. fail: reject,
  18. });
  19. });
  20. },
  21. fetch({url, id}) {
  22. return new Promise((resolve, reject) => {
  23. wx.request({
  24. url: `${baseUrl}/${url}/${id}`,
  25. method: 'GET',
  26. header: {'content-type': 'application/json'},
  27. dataType: 'json',
  28. success: resolve,
  29. fail: reject,
  30. });
  31. });
  32. },
  33. }