index.vue 3.5 KB

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