App.vue 2.3 KB

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