App.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <script>
  2. // import getWenjian from './utils/getWenjian.js' //方法:获取文件数据
  3. export default {
  4. onLaunch: function() {
  5. console.log('App Launch')
  6. plus.screen.lockOrientation('landscape-primary'); //锁定
  7. },
  8. onShow() {
  9. // #ifdef APP-PLUS
  10. // 隐藏顶部电池,时间等信息
  11. plus.navigator.setFullscreen(true);
  12. //隐藏虚拟按键
  13. // plus.navigator.hideSystemNavigation()
  14. // #endif
  15. },
  16. onHide: function() {
  17. console.log('App Hide')
  18. },
  19. created() {
  20. // getWenjian("/storage/emulated/0/QingTianGB_X/cadre.db").then(res => {
  21. // console.log(res);
  22. // })
  23. uni.getNetworkType({
  24. success: (res) => {
  25. if (res.networkType != "wifi") {
  26. console.log('未连接wifi');
  27. } else {
  28. this.changeWifiStatus(false)
  29. }
  30. }
  31. })
  32. },
  33. methods: {
  34. changeWifiStatus(value) {
  35. let wifiManager;
  36. let Context = plus.android.importClass("android.content.Context");
  37. let WifiManager = plus.android.importClass("android.net.wifi.WifiManager");
  38. wifiManager = plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE);
  39. wifiManager.setWifiEnabled(value);
  40. },
  41. }
  42. }
  43. </script>
  44. <style lang="scss">
  45. /*每个页面公共css */
  46. @import "uview-ui/index.scss";
  47. .myChart {
  48. width: 100%;
  49. height: 100%;
  50. }
  51. page {
  52. height: 100%;
  53. font-size: 18rpx;
  54. }
  55. </style>