App.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. if (plus.runtime.isApplicationExist({
  65. pname: 'com.tencent.mm',
  66. action: 'weixin://'
  67. })) {
  68. //安装了微信
  69. // console.log("安装了微信");
  70. this.$store.state.bInstallWechat = true;
  71. } else {
  72. //未安装微信
  73. // console.log("未安装微信");
  74. this.$store.state.bInstallWechat = false;
  75. }
  76. },
  77. onShow: function() {
  78. console.log('App Show');
  79. // #ifdef APP-PLUS
  80. // 锁住屏幕正方向
  81. // plus.screen.lockOrientation('portrait-primary');
  82. // 屏幕常亮
  83. // plus.device.setWakelock(true);
  84. // 下面这个打包要开启手机设置权限
  85. // uni.setScreenBrightness({
  86. // value: 0.8,
  87. // success: function () {
  88. // console.log('setScreenBrightness success');
  89. // }
  90. // });
  91. // uni.setKeepScreenOn({
  92. // keepScreenOn: true,
  93. // success: function () {
  94. // console.log('setKeepScreenOn success');
  95. // }
  96. // });
  97. // let self = this;
  98. // uni.getScreenBrightness({
  99. // success: function (res) {
  100. // console.log('屏幕亮度值:' + res.value);
  101. // self.Test = '=='+plus.device.isWakelock()+ '=getScreenBrightness success';
  102. // self.screenValue = res.value;
  103. // }
  104. // });
  105. // #endif
  106. },
  107. onHide: function() {
  108. console.log('App Hide')
  109. }
  110. }
  111. </script>
  112. <!-- <style src="@/util/util-css/main-nvue.css"></style> -->
  113. <style>
  114. /*每个页面公共css */
  115. // #ifndef APP-PLUS-NVUE
  116. @import "util/util-css/main.css";
  117. @import "util/util-css/icon.css";
  118. // #endif
  119. /* nvue 页面公共css */
  120. // #ifdef APP-PLUS-NVUE
  121. @import "util/util-css/main-nvue.css";
  122. // #endif
  123. </style>