App.vue 2.3 KB

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