app.js 2.4 KB

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