app.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //app.js
  2. let wechat = require('./utils/wechat.js');
  3. let log = require('./utils/log.js');
  4. App({
  5. globalData: {
  6. postHeadAgreement: 'https://cdgl.pjnes.com',
  7. helpPhoneNum: '18211188302'
  8. },
  9. onLaunch() {
  10. log.info('[全局]', '[小程序加载完成]');
  11. // log.error({ str: 'hello world22' }, 'warn log', 100, [1, 2, 3]);
  12. // log.warn({ str: 'hello world33' }, 'warn log', 100, [1, 2, 3]);
  13. // log.setFilterMsg('filterkeyword');
  14. // log.setFilterMsg('addfilterkeyword');
  15. // wx.showModal({
  16. // title: '温馨提示',
  17. // content: '为方便您更好的使用派捷充电小程序,平台将定期(暂定每周一次)对未支付订单进行自动支付。望周知',
  18. // showCancel:false
  19. // });
  20. // wx.showToast({
  21. // title: '当前网络环境较差,无法连接服务器,请稍后重试。有问题请联系客服电话18211188302,接听时段08:00-17:00。',
  22. // icon: 'none',
  23. // duration:2000
  24. // });
  25. //this.showNetworkError();
  26. },
  27. showNetworkError(){
  28. wx.showModal({
  29. title: '温馨提示',
  30. content: '当前网络环境较差,无法连接服务器,请稍后重试。有问题请联系客服电话18211188302,接听时段08:00-17:00。',
  31. showCancel: false
  32. });
  33. },
  34. onShow() {
  35. let userInfo = wx.getStorageSync('userInfo');
  36. let isLogin = wx.getStorageSync('isLogin');
  37. // 页面显示
  38. if (userInfo && isLogin) {
  39. if ((!userInfo.userId && userInfo.userId != 0)) {
  40. log.info('[全局]', '[已登陆未有用户ID跳转登录界面]');
  41. let url = `/pages/login/login`;
  42. wx.navigateTo({
  43. url
  44. });
  45. return;
  46. }
  47. }
  48. }
  49. })