E企盈营销工具技术服务商 热线:4006-838-530

微信小程序请求拦截器

E企盈直播平台营销卖货系统

const apiHttp = ‘https://pdm.chiefchain.cn/’const header = {  cookie: ‘JSESSIONID=’ + wx.getStorageSync(‘JSESSIONID’),  ‘content-type’: ‘application/x-www-form-urlencoded’}function request(url, method, data, complete) {  url = apiHttp + url  Object.assign(data, {    tokenId: wx.getStorageSync(‘tokenId’),  })  let promise = new Promise(function(resolve, reject) {    wx.request({      url,      header,      data,      method,      success: res = {        resolve(res)      },      fail: res = {        reject(res)      },      complete: res = {        wx.hideNavigationBarLoading()        complete(res)      }    })  })  return promise}let fn = function() {}module.exports = {  $get: function({    url,    data = {},    complete = fn  }) {    return request(url, ‘GET’, data, complete)  },  $post: function({    url,    data = {},    complete = fn  }) {    return request(url, ‘POST’, data, complete)  },  $$get: function({    url,    data = {},    complete = fn  }) {    wx.showNavigationBarLoading()    return request(url, ‘GET’, data, complete)  },  $$post: function({    url,    data = {},    complete = fn  }) {    wx.showNavigationBarLoading()    return request(url, ‘POST’, data, complete)  },}

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序请求拦截器
分享到: 更多 (0)
E企盈小程序直播营销卖货系统
E企盈直播平台营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏