index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class='app-container'>
  3. <view v-if="iframeloading" class="loadding-box" :style="{'height': wvHeight+'px', 'width': wvWidth+'px', 'marginTop': wvTop+'px', border: 'none', background: '#000' }">
  4. <u-loading-icon></u-loading-icon>
  5. </view>
  6. <iframe v-if="PageCur == 'tun2D'" ref="iframe" src="http://182.92.126.35:8098/" @load="viewLoad" :style="{'height': wvHeight+'px', 'width': wvWidth+'px', 'marginTop': wvTop+'px', border: 'none', background: '#000' }"></iframe>
  7. <Device v-if="PageCur == 'device'" :style="{'marginTop': wvTop+20+'px'}"/>
  8. <filecenter
  9. :cur="PageCur"
  10. v-if="PageCur == 'filecenter'"
  11. ></filecenter>
  12. <warndata
  13. v-if="PageCur == 'warndata'"
  14. :cur="PageCur"
  15. ></warndata>
  16. <u-tabbar
  17. :value="PageCur"
  18. @change="NavChange"
  19. :fixed="true"
  20. :placeholder="true"
  21. :safeAreaInsetBottom="true"
  22. >
  23. <u-tabbar-item
  24. text="通风系统图"
  25. name="tun2D"
  26. icon="list-dot"
  27. ></u-tabbar-item>
  28. <u-tabbar-item
  29. text="设备中心"
  30. name="device"
  31. icon="calendar"
  32. ></u-tabbar-item>
  33. <u-tabbar-item
  34. text="预警分析"
  35. name="warndata"
  36. icon="plus-circle"
  37. ></u-tabbar-item>
  38. <u-tabbar-item
  39. text="文件共享"
  40. name="filecenter"
  41. icon="file-text"
  42. ></u-tabbar-item>
  43. </u-tabbar>
  44. </view>
  45. </template>
  46. <script>
  47. import { nextTick } from "vue";
  48. import Device from '../device/index.vue'
  49. export default {
  50. components: {
  51. Device,
  52. },
  53. data() {
  54. return {
  55. isLandScape: '',
  56. PageCur: "tun2D",
  57. tun3DPage: null,
  58. wvHeight: getApp().globalData.windowHeight,
  59. wvWidth: getApp().globalData.windowWidth,
  60. wvTop: 0,
  61. iframeloading: true
  62. };
  63. },
  64. onLoad() {
  65. this.changeWV()
  66. },
  67. mounted(){
  68. },
  69. onShow() {
  70. // this.changeWV()
  71. },
  72. onResize(){
  73. this.changeWV()
  74. },
  75. methods: {
  76. NavChange: function (e) {
  77. this.PageCur = e;
  78. if(e == 'tun2D'){
  79. // this.changeWV()
  80. this.iframeloading = true
  81. }
  82. },
  83. viewLoad(event) {
  84. const _this = this
  85. setTimeout(() => {
  86. _this.iframeloading = false
  87. }, 2000)
  88. },
  89. changeWV() {
  90. const _this = this
  91. uni.getSystemInfo({ // 获取当前设备的具体信息
  92. success: (sysinfo) => {
  93. if (sysinfo.windowWidth > sysinfo.windowHeight) {
  94. // 横屏
  95. _this.isLandScape = true
  96. } else {
  97. // 竖屏
  98. _this.isLandScape = false
  99. }
  100. _this.wvTop = _this.isLandScape ? 0 : sysinfo.statusBarHeight + 20;
  101. _this.wvHeight = _this.isLandScape ? sysinfo.windowHeight - sysinfo.statusBarHeight - 20 : sysinfo.windowHeight - sysinfo.statusBarHeight - sysinfo.statusBarHeight - 38;
  102. _this.wvWidth = _this.isLandScape ? sysinfo.windowWidth : sysinfo.windowWidth
  103. console.log('屏幕模式--->', _this.isLandScape? '横屏':'竖屏')
  104. console.log(_this.wvTop, _this.wvWidth, _this.wvHeight )
  105. }
  106. });
  107. }
  108. },
  109. };
  110. </script>
  111. <style>
  112. .app-container{
  113. width: 100%;
  114. height: 100%;
  115. }
  116. .loadding-box{
  117. position: absolute;
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. }
  122. </style>