apiConfig.js 398 B

12345678910111213141516171819202122
  1. let apiUrl = "https://interface.huihenduo.com.cn/hhd-pat/"
  2. function api(url, data, method) {
  3. return new Promise((resolve, reject) => {
  4. wx.request({
  5. url: `${apiUrl}/${url}`,
  6. method,
  7. data,
  8. dataType: 'json',
  9. header: {
  10. 'content-type': 'application/json'
  11. },
  12. success: resolve,
  13. fail: reject
  14. })
  15. })
  16. }
  17. module.exports = {
  18. apiUrl,
  19. api
  20. }