App.vue 2.7 KB

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