http.js 350 B

1234567891011121314151617181920212223242526272829
  1. let http = {
  2. get(url, data, {
  3. header,
  4. // showLoading = true,
  5. timeout = 20000
  6. } = {}) {
  7. let promise = new Promise(function(resolve, reject) {
  8. uni.request({
  9. url: url,
  10. method: 'GET',
  11. data,
  12. timeout,
  13. }).then(
  14. (res) => {
  15. resolve(res[1])
  16. }
  17. ).catch(
  18. )
  19. })
  20. return promise;
  21. }
  22. }
  23. export default http;