App.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. // console.log("App Launch");
  5. this.checkArguments(); // 检测启动参数
  6. if (uni.getSystemInfoSync().platform == 'android') {
  7. // 重点是以下: 一定要监听后台恢复 !一定要
  8. plus.globalEvent.addEventListener('newintent', e => {
  9. this.checkArguments(); // 检测启动参数
  10. });
  11. }
  12. },
  13. onShow: function() {
  14. // console.log("App Show");
  15. },
  16. onHide: function() {
  17. // console.log("App Hide");
  18. },
  19. methods: {
  20. // 监测是否传参数
  21. checkArguments() {
  22. try {
  23. if (uni.getSystemInfoSync().platform === 'android') {
  24. // 接收第三方app传递的参数 extra;
  25. if (plus.runtime.arguments) {
  26. // patParams: 院区,病区, 床号
  27. const { patParams } = JSON.parse(plus.runtime.arguments);
  28. uni.setStorageSync('patParams', patParams);
  29. }
  30. }
  31. } catch (e) {}
  32. }
  33. }
  34. };
  35. </script>
  36. <style lang="less">
  37. /*每个页面公共css */
  38. body,
  39. uni-app,
  40. uni-page,
  41. uni-page-wrapper,
  42. uni-page-body {
  43. height: 100%;
  44. font-size: 12.5rpx;
  45. line-height: 18.75rpx;
  46. }
  47. view,
  48. label,
  49. scroll-view {
  50. box-sizing: border-box;
  51. }
  52. </style>