// let api = "https://passport.lrlz.com/mobile/index.php"; let api = "http://a.lrlz.com/mobile/index.php"; // let api = "http://121.43.114.153/mobile/index.php" // let api = "http://192.168.0.131/mobile/index.php"; function getReq(data, callback, fail) { let options = { client_type: 'ios' } data = Object.assign({}, options, data); let session_id = wx.getStorageSync('session_id'); return wx.request({ url: api, data, header: { 'content-type': 'application/json', // 默认值 'Cookie': 'MPHPSESSID=' + session_id }, success(res) { callback(res.data) }, fail() { wx.showModal({ confirmText: '重试', content: '网络错误', success: function (res) { if (res.confirm) { wx.reLaunch({ url: "/pages/index/index" }) } else if (res.cancel) { console.log('用户点击取消') } } }) } }) } module.exports = { getReq, host: api }