app.js 2.7 KB

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