App.vue 3.0 KB

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