config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // client_type: 'mini'
  10. }
  11. data = Object.assign({}, options, data);
  12. let session_id = wx.getStorageSync('session_id');
  13. return wx.request({
  14. url: api,
  15. data,
  16. header: {
  17. 'content-type': 'application/json', // 默认值
  18. 'Cookie': 'MPHPSESSID=' + session_id
  19. },
  20. success(res) {
  21. callback(res.data)
  22. },
  23. fail() {
  24. wx.showModal({
  25. confirmText: '重试',
  26. content: '网络错误',
  27. success: function (res) {
  28. if (res.confirm) {
  29. wx.reLaunch({
  30. url: "/pages/index/index"
  31. })
  32. } else if (res.cancel) {
  33. console.log('用户点击取消')
  34. }
  35. }
  36. })
  37. }
  38. })
  39. }
  40. module.exports = {
  41. getReq,
  42. host: api
  43. }