App.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. uni.setTabBarItem({
  16. index: 2,
  17. visible: false
  18. })
  19. uni.setTabBarItem({
  20. index: 3,
  21. visible: false
  22. })
  23. // 先判断 系统版本
  24. const _systemInfo = uni.getSystemInfoSync();
  25. // uni.getSystemInfo({
  26. // success: (res) => {
  27. // console.log("系统信息:", res);
  28. // this.$store.state.clientName = res.model;
  29. // this.$store.state.system = res.system;
  30. // this.$store.state.platform = res.platform;
  31. // this.$store.state.systemInfo = res;
  32. // },
  33. // fail: (err) => {},
  34. // complete: () => {}
  35. // })
  36. console.log("系统信息:", _systemInfo);
  37. this.$store.state.clientName = _systemInfo.model;
  38. this.$store.state.system = _systemInfo.system;
  39. this.$store.state.platform = _systemInfo.platform;
  40. this.$store.state.systemInfo = _systemInfo;
  41. //获取记录的最后一次连接
  42. this.getFinalUseDevice();
  43. //获取记录的蓝牙列表数据
  44. this.getBLEDeviceList();
  45. // #ifdef APP-PLUS
  46. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  47. console.log("version:", info);
  48. this.$store.state.version = info.version;
  49. this.$store.state.versionCode = info.versionCode;
  50. this.$store.state.appName = info.name;
  51. });
  52. // 锁住屏幕正方向
  53. plus.screen.lockOrientation('portrait-primary');
  54. // 屏幕常亮
  55. // 下面这个打包要开启手机设置权限
  56. plus.device.setWakelock(true);
  57. // #endif
  58. // #ifdef MP
  59. //开始登陆
  60. this.onLuanchLogin({});
  61. // #endif
  62. this.onAccAndGyroConvertDataGet();
  63. // this.setGuideUnlockState({
  64. // //是否首次安装
  65. // firstInstallation: true,
  66. // firstDisconnectBluetooth: true,
  67. // firstUnlockJumpUp: true,
  68. // firstUnlockLeftAndRightJump: true,
  69. // firstUnlockLeftAndRightRotationJump: true
  70. // });
  71. //获取guide任务的解锁状态
  72. this.getGuideUnlockState();
  73. if (plus.runtime.isApplicationExist({
  74. pname: 'com.tencent.mm',
  75. action: 'weixin://'
  76. })) {
  77. //安装了微信
  78. // console.log("安装了微信");
  79. this.$store.state.bInstallWechat = true;
  80. } else {
  81. //未安装微信
  82. // console.log("未安装微信");
  83. this.$store.state.bInstallWechat = false;
  84. }
  85. },
  86. onShow: function() {
  87. console.log('App Show');
  88. // #ifdef APP-PLUS
  89. // 设置非暗夜模式
  90. var style = plus.navigator.getUIStyle();
  91. if ('dark' == style) {
  92. plus.nativeUI.setUIStyle('light');
  93. }
  94. // 锁住屏幕正方向
  95. // plus.screen.lockOrientation('portrait-primary');
  96. // 屏幕常亮
  97. // plus.device.setWakelock(true);
  98. // 下面这个打包要开启手机设置权限
  99. // uni.setScreenBrightness({
  100. // value: 0.8,
  101. // success: function () {
  102. // console.log('setScreenBrightness success');
  103. // }
  104. // });
  105. // uni.setKeepScreenOn({
  106. // keepScreenOn: true,
  107. // success: function () {
  108. // console.log('setKeepScreenOn success');
  109. // }
  110. // });
  111. // let self = this;
  112. // uni.getScreenBrightness({
  113. // success: function (res) {
  114. // console.log('屏幕亮度值:' + res.value);
  115. // self.Test = '=='+plus.device.isWakelock()+ '=getScreenBrightness success';
  116. // self.screenValue = res.value;
  117. // }
  118. // });
  119. // #endif
  120. },
  121. onHide: function() {
  122. console.log('App Hide')
  123. }
  124. }
  125. </script>
  126. <!-- <style src="@/util/util-css/main-nvue.css"></style> -->
  127. <style>
  128. /*每个页面公共css */
  129. // #ifndef APP-PLUS-NVUE
  130. @import "util/util-css/main.css";
  131. @import "util/util-css/icon.css";
  132. // #endif
  133. /* nvue 页面公共css */
  134. // #ifdef APP-PLUS-NVUE
  135. @import "util/util-css/main-nvue.css";
  136. // #endif
  137. </style>