app.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //app.js
  2. let wechat = require('./utils/wechat.js');
  3. let log = require('./utils/log.js');
  4. App({
  5. globalData: {
  6. // postHeadAgreement: 'http://127.0.0.1:10301',
  7. // 测试
  8. postHeadAgreement: 'https://jqcs.pjnes.com/cloud/chargapi',
  9. // postHeadAgreement: 'http://192.168.105.171:10301',
  10. // 正式
  11. // postHeadAgreement: 'https://cdglyy.pjnes.com/cloud/chargapi',
  12. helpPhoneNum: '4009608068',
  13. version:'2.0'
  14. },
  15. onLaunch() {
  16. log.info('[全局]', '[小程序加载完成]');
  17. // log.error({ str: 'hello world22' }, 'warn log', 100, [1, 2, 3]);
  18. // log.warn({ str: 'hello world33' }, 'warn log', 100, [1, 2, 3]);
  19. // log.setFilterMsg('filterkeyword');
  20. // log.setFilterMsg('addfilterkeyword');
  21. // wx.showModal({
  22. // title: '温馨提示',
  23. // content: '为方便您更好的使用派捷充电小程序,平台将定期(暂定每周一次)对未支付订单进行自动支付。望周知',
  24. // showCancel:false
  25. // });
  26. // wx.showToast({
  27. // title: '当前网络环境较差,无法连接服务器,请稍后重试。有问题请联系客服电话4009608068,接听时段08:30-17:00。',
  28. // icon: 'none',
  29. // duration:2000
  30. // });
  31. //this.showNetworkError();
  32. },
  33. showNetworkError(){
  34. wx.showModal({
  35. title: '温馨提示',
  36. content: '当前网络环境较差,无法连接服务器,请稍后重试。有问题请联系客服电话4009608068,接听时段08:30-17:00。',
  37. confirmColor:'#00AADD',
  38. showCancel: false
  39. });
  40. },
  41. onShow() {
  42. let userInfo = wx.getStorageSync('userInfo');
  43. let isLogin = wx.getStorageSync('isLogin');
  44. // 页面显示
  45. if (userInfo && isLogin) {
  46. if ((!userInfo.userId && userInfo.userId != 0)) {
  47. log.info('[全局]', '[已登陆未有用户ID跳转登录界面]');
  48. let url = `/pages/login/phone_login/phone_login`;
  49. wx.navigateTo({
  50. url
  51. });
  52. return;
  53. }
  54. }
  55. }
  56. // "tabBar": {
  57. // "color": "#a9b7b7",
  58. // "selectedColor": "#11cd6e",
  59. // "borderStyle": "black",
  60. // "list": [
  61. // {
  62. // "selectedIconPath": "images/index.png",
  63. // "iconPath": "images/index.png",
  64. // "pagePath": "pages/index/index",
  65. // "text": "首页"
  66. // },
  67. // {
  68. // "selectedIconPath": "images/ucenter.png",
  69. // "iconPath": "images/ucenter.png",
  70. // "pagePath": "pages/ucenter/index/index",
  71. // "text": "我的"
  72. // }
  73. // ]
  74. // },
  75. })