App.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <script>
  2. import config from 'common/config.js';
  3. import {
  4. mapMutations
  5. } from 'vuex'
  6. export default {
  7. methods: {
  8. ...mapMutations(['onLuanchLogin', 'getBLEDeviceList', 'getFinalUseDevice', 'onAccAndGyroConvertDataGet',
  9. 'getGuideUnlockState', 'setGuideUnlockState'
  10. ]),
  11. },
  12. onLaunch: function() {
  13. console.log('App Launch');
  14. // 先判断 系统版本
  15. const _systemInfo = uni.getSystemInfoSync();
  16. // uni.getSystemInfo({
  17. // success: (res) => {
  18. // console.log("系统信息:", res);
  19. // this.$store.state.clientName = res.model;
  20. // this.$store.state.system = res.system;
  21. // this.$store.state.platform = res.platform;
  22. // this.$store.state.systemInfo = res;
  23. // },
  24. // fail: (err) => {},
  25. // complete: () => {}
  26. // })
  27. console.log("系统信息:", _systemInfo);
  28. this.$store.state.clientName = _systemInfo.model;
  29. this.$store.state.system = _systemInfo.system;
  30. this.$store.state.platform = _systemInfo.platform;
  31. this.$store.state.systemInfo = _systemInfo;
  32. //获取记录的最后一次连接
  33. this.getFinalUseDevice();
  34. //获取记录的蓝牙列表数据
  35. this.getBLEDeviceList();
  36. // #ifdef APP-PLUS
  37. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  38. console.log("version:", info);
  39. this.$store.state.version = info.version;
  40. this.$store.state.versionCode = info.versionCode;
  41. this.$store.state.appName = info.name;
  42. });
  43. // 锁住屏幕正方向
  44. plus.screen.lockOrientation('portrait-primary');
  45. // 屏幕常亮
  46. // 下面这个打包要开启手机设置权限
  47. plus.device.setWakelock(true);
  48. // #endif
  49. // #ifdef MP
  50. //开始登陆
  51. this.onLuanchLogin({});
  52. // #endif
  53. this.onAccAndGyroConvertDataGet();
  54. // this.setGuideUnlockState({
  55. // //是否首次安装
  56. // firstInstallation: true,
  57. // firstDisconnectBluetooth: true,
  58. // firstUnlockJumpUp: true,
  59. // firstUnlockLeftAndRightJump: true,
  60. // firstUnlockLeftAndRightRotationJump: true
  61. // });
  62. //获取guide任务的解锁状态
  63. this.getGuideUnlockState();
  64. },
  65. onShow: function() {
  66. console.log('App Show');
  67. // #ifdef APP-PLUS
  68. // 锁住屏幕正方向
  69. // plus.screen.lockOrientation('portrait-primary');
  70. // 屏幕常亮
  71. // plus.device.setWakelock(true);
  72. // 下面这个打包要开启手机设置权限
  73. // uni.setScreenBrightness({
  74. // value: 0.8,
  75. // success: function () {
  76. // console.log('setScreenBrightness success');
  77. // }
  78. // });
  79. // uni.setKeepScreenOn({
  80. // keepScreenOn: true,
  81. // success: function () {
  82. // console.log('setKeepScreenOn success');
  83. // }
  84. // });
  85. // let self = this;
  86. // uni.getScreenBrightness({
  87. // success: function (res) {
  88. // console.log('屏幕亮度值:' + res.value);
  89. // self.Test = '=='+plus.device.isWakelock()+ '=getScreenBrightness success';
  90. // self.screenValue = res.value;
  91. // }
  92. // });
  93. // #endif
  94. },
  95. onHide: function() {
  96. console.log('App Hide')
  97. }
  98. }
  99. </script>
  100. <!-- <style src="@/util/util-css/main-nvue.css"></style> -->
  101. <style>
  102. /*每个页面公共css */
  103. // #ifndef APP-PLUS-NVUE
  104. @import "util/util-css/main.css";
  105. @import "util/util-css/icon.css";
  106. // #endif
  107. /* nvue 页面公共css */
  108. // #ifdef APP-PLUS-NVUE
  109. @import "util/util-css/main-nvue.css";
  110. // #endif
  111. </style>