店播抖音版小程序

util.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // var rootDocment = 'https://sph.wenxingshuju.com/wx_sph';//域名
  2. var rootDocment = 'https://dy.wenxingshuju.com';//域名
  3. function req(url, method, data, cb, fail_cb, selfHeader) {
  4. var dataes = {'admin_id':uni.getStorageSync('admin_id'),
  5. 'ttl':uni.getStorageSync('ttl'),
  6. 'sign':uni.getStorageSync('sign')
  7. }
  8. var header = {
  9. 'sessionKey':uni.getStorageSync('session_key')?uni.getStorageSync('session_key'):false
  10. }
  11. const app = getApp()
  12. uni.request({
  13. url: rootDocment + url,
  14. data: data ? Object.assign(data, dataes) : dataes,
  15. method: method,
  16. header: selfHeader ? Object.assign(selfHeader,header) : header,
  17. success: function (res) {
  18. // if((res.data.errno == '4002')&&url.indexOf('verified')==-1&&url.indexOf('loginByUnionId')==-1){
  19. // var platform = wx.getStorageSync('platform');
  20. // var showMaskID = wx.getStorageSync('showMaskID');//弹层的id
  21. // var showMask = wx.getStorageSync('showMask'+showMaskID);//首页浮层的弹框
  22. // var showFlag = wx.getStorageSync('showFlag');//加入我的小程序的提醒
  23. // var claim = wx.getStorageSync('claim');
  24. // var notice_showFlag = wx.getStorageSync('notice_showFlag');//关注公众号的提醒
  25. // var claim_token = wx.getStorageSync('claim_token');
  26. // if(wx.getStorageSync('isLogin')){
  27. // wx.clearStorage()
  28. // wx.setStorageSync('platform', platform)
  29. // wx.setStorageSync('showFlag', showFlag)
  30. // wx.setStorageSync('showMask'+showMaskID, showMask)
  31. // wx.setStorageSync('showMaskID', showMaskID)
  32. // wx.setStorageSync('claim', claim)
  33. // wx.setStorageSync('claim_token', claim_token)
  34. // wx.setStorageSync('notice_showFlag', notice_showFlag)
  35. // app.login('/pages/index/index')
  36. // }
  37. // }else{
  38. return typeof cb == "function" && cb(res.data)
  39. // }
  40. },
  41. fail: function (err) {
  42. return typeof fail_cb == "function" && fail_cb(err)
  43. }
  44. })
  45. }
  46. module.exports = {
  47. req: req,
  48. rootDocment: rootDocment
  49. }