config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // let api = "https://passport.lrlz.com/mobile/index.php";
  2. let api = "http://a.lrlz.com/mobile/index.php";
  3. // let api = "http://121.43.114.153/mobile/index.php"
  4. // let api = "http://192.168.0.131/mobile/index.php";
  5. // let api = "http://192.168.0.200/mobile/index.php";
  6. function getReq(data, callback, fail) {
  7. let options = {
  8. client_type: 'ios'
  9. }
  10. data = Object.assign({}, options, data);
  11. let session_id = wx.getStorageSync('session_id');
  12. return wx.request({
  13. url: api,
  14. data,
  15. header: {
  16. 'content-type': 'application/json', // 默认值
  17. 'Cookie': 'MPHPSESSID=' + session_id
  18. },
  19. success(res) {
  20. callback(res.data)
  21. },
  22. fail() {
  23. wx.showModal({
  24. confirmText: '重试',
  25. content: '网络错误',
  26. success: function (res) {
  27. if (res.confirm) {
  28. wx.reLaunch({
  29. url: "/pages/index/index"
  30. })
  31. } else if (res.cancel) {
  32. console.log('用户点击取消')
  33. }
  34. }
  35. })
  36. }
  37. })
  38. }
  39. module.exports = {
  40. getReq,
  41. host: api
  42. }