config.js 1.0 KB

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