intell.js 509 B

1234567891011121314151617181920
  1. const { baseUrl } = require('./env').intell
  2. module.exports = {
  3. intell:function(url , type , key ,data = {}){
  4. let fullUrl = `${baseUrl}${url}`
  5. return new Promise((resolve,reject)=>{
  6. wx.request({url: fullUrl,method:type,data,header: {"api-key":key},
  7. success(res){
  8. resolve(res)
  9. },
  10. fail(){
  11. wx.showToast({
  12. title: '接口请求错误',
  13. icon:'none'
  14. })
  15. reject('接口请求错误')
  16. }
  17. })
  18. })
  19. }
  20. }