app.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //app.js
  2. let wechat = require('./utils/wechat.js');
  3. let log = require('./utils/log.js');
  4. App({
  5. globalData: {
  6. // 本机调试
  7. // postHeadAgreement: 'http://127.0.0.1:10301',
  8. // 测试
  9. // postHeadAgreement: 'https://jqcs.pjnes.com/cloud/chargapi',
  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. showCancel: false
  38. });
  39. },
  40. onShow() {
  41. let userInfo = wx.getStorageSync('userInfo');
  42. let isLogin = wx.getStorageSync('isLogin');
  43. console.info("cccccccccccccccccccccccccccccccccccccccccccccccccccccc")
  44. console.info(userInfo)
  45. // 页面显示
  46. if (userInfo && isLogin) {
  47. if ((!userInfo.userId && userInfo.userId != 0)) {
  48. log.info('[全局]', '[已登陆未有用户ID跳转登录界面]');
  49. let url = `/pages/login/login`;
  50. wx.navigateTo({
  51. url
  52. });
  53. return;
  54. }
  55. }
  56. }
  57. // "tabBar": {
  58. // "color": "#a9b7b7",
  59. // "selectedColor": "#11cd6e",
  60. // "borderStyle": "black",
  61. // "list": [
  62. // {
  63. // "selectedIconPath": "images/index.png",
  64. // "iconPath": "images/index.png",
  65. // "pagePath": "pages/index/index",
  66. // "text": "首页"
  67. // },
  68. // {
  69. // "selectedIconPath": "images/ucenter.png",
  70. // "iconPath": "images/ucenter.png",
  71. // "pagePath": "pages/ucenter/index/index",
  72. // "text": "我的"
  73. // }
  74. // ]
  75. // },
  76. })