12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- // var rootDocment = 'https://sph.wenxingshuju.com/wx_sph';//域名
- var rootDocment = 'https://dy.wenxingshuju.com';//域名
- function req(url, method, data, cb, fail_cb, selfHeader) {
- var dataes = {'admin_id':uni.getStorageSync('admin_id'),
- 'ttl':uni.getStorageSync('ttl'),
- 'sign':uni.getStorageSync('sign')
- }
- var header = {
- 'sessionKey':uni.getStorageSync('session_key')?uni.getStorageSync('session_key'):false
- }
- const app = getApp()
- uni.request({
- url: rootDocment + url,
- data: data ? Object.assign(data, dataes) : dataes,
- method: method,
- header: selfHeader ? Object.assign(selfHeader,header) : header,
- success: function (res) {
- // if((res.data.errno == '4002')&&url.indexOf('verified')==-1&&url.indexOf('loginByUnionId')==-1){
- // var platform = wx.getStorageSync('platform');
- // var showMaskID = wx.getStorageSync('showMaskID');//弹层的id
- // var showMask = wx.getStorageSync('showMask'+showMaskID);//首页浮层的弹框
- // var showFlag = wx.getStorageSync('showFlag');//加入我的小程序的提醒
- // var claim = wx.getStorageSync('claim');
- // var notice_showFlag = wx.getStorageSync('notice_showFlag');//关注公众号的提醒
- // var claim_token = wx.getStorageSync('claim_token');
- // if(wx.getStorageSync('isLogin')){
- // wx.clearStorage()
- // wx.setStorageSync('platform', platform)
- // wx.setStorageSync('showFlag', showFlag)
- // wx.setStorageSync('showMask'+showMaskID, showMask)
- // wx.setStorageSync('showMaskID', showMaskID)
- // wx.setStorageSync('claim', claim)
- // wx.setStorageSync('claim_token', claim_token)
- // wx.setStorageSync('notice_showFlag', notice_showFlag)
- // app.login('/pages/index/index')
- // }
- // }else{
- return typeof cb == "function" && cb(res.data)
- // }
- },
- fail: function (err) {
- return typeof fail_cb == "function" && fail_cb(err)
- }
- })
- }
- module.exports = {
- req: req,
- rootDocment: rootDocment
- }
|