intell.js 489 B

123456789101112131415161718
  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){resolve(res)},
  8. fail(){
  9. wx.showToast({
  10. title: '接口请求错误',
  11. icon:'none'
  12. })
  13. reject('接口请求错误')
  14. }
  15. })
  16. })
  17. }
  18. }