app.js 2.6 KB

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