config.js 974 B

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