App.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. },
  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. },
  53. onShow: function() {
  54. console.log('App Show');
  55. // #ifdef APP-PLUS
  56. // 锁住屏幕正方向
  57. // plus.screen.lockOrientation('portrait-primary');
  58. // 屏幕常亮
  59. // plus.device.setWakelock(true);
  60. // 下面这个打包要开启手机设置权限
  61. // uni.setScreenBrightness({
  62. // value: 0.8,
  63. // success: function () {
  64. // console.log('setScreenBrightness success');
  65. // }
  66. // });
  67. // uni.setKeepScreenOn({
  68. // keepScreenOn: true,
  69. // success: function () {
  70. // console.log('setKeepScreenOn success');
  71. // }
  72. // });
  73. // let self = this;
  74. // uni.getScreenBrightness({
  75. // success: function (res) {
  76. // console.log('屏幕亮度值:' + res.value);
  77. // self.Test = '=='+plus.device.isWakelock()+ '=getScreenBrightness success';
  78. // self.screenValue = res.value;
  79. // }
  80. // });
  81. // #endif
  82. },
  83. onHide: function() {
  84. console.log('App Hide')
  85. }
  86. }
  87. </script>
  88. <!-- <style src="@/util/util-css/main-nvue.css"></style> -->
  89. <style>
  90. /*每个页面公共css */
  91. // #ifndef APP-PLUS-NVUE
  92. @import "util/util-css/main.css";
  93. @import "util/util-css/icon.css";
  94. // #endif
  95. /* nvue 页面公共css */
  96. // #ifdef APP-PLUS-NVUE
  97. @import "util/util-css/main-nvue.css";
  98. // #endif
  99. </style>