index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. <gasreport :cur="PageCur" v-if="PageCur == 'gasreport'"></gasreport>
  36. <u-tabbar
  37. :value="PageCur"
  38. @change="NavChange"
  39. :fixed="true"
  40. :placeholder="true"
  41. :safeAreaInsetBottom="true"
  42. >
  43. <u-tabbar-item
  44. text="通风系统图"
  45. name="tun2D"
  46. icon="list-dot"
  47. ></u-tabbar-item>
  48. <u-tabbar-item
  49. text="设备中心"
  50. name="device"
  51. icon="calendar"
  52. ></u-tabbar-item>
  53. <u-tabbar-item
  54. text="预警分析"
  55. name="warndata"
  56. icon="plus-circle"
  57. ></u-tabbar-item>
  58. <u-tabbar-item
  59. text="文件共享"
  60. name="filecenter"
  61. icon="file-text"
  62. ></u-tabbar-item>
  63. <u-tabbar-item
  64. text="瓦斯日报"
  65. name="gasreport"
  66. icon="bell"
  67. ></u-tabbar-item>
  68. </u-tabbar>
  69. </view>
  70. </template>
  71. <script>
  72. import { nextTick } from "vue";
  73. import Device from "../device/index.vue";
  74. export default {
  75. components: {
  76. Device,
  77. },
  78. data() {
  79. return {
  80. isLandScape: "",
  81. PageCur: "tun2D",
  82. tun3DPage: null,
  83. wvHeight: getApp().globalData.windowHeight,
  84. wvWidth: getApp().globalData.windowWidth,
  85. wvTop: 0,
  86. iframeloading: true,
  87. };
  88. },
  89. onLoad() {
  90. this.changeWV();
  91. },
  92. mounted() {},
  93. onShow() {
  94. // this.changeWV()
  95. },
  96. onResize() {
  97. this.changeWV();
  98. },
  99. methods: {
  100. NavChange: function (e) {
  101. this.PageCur = e;
  102. if (e == "tun2D") {
  103. // this.changeWV()
  104. this.iframeloading = true;
  105. }
  106. },
  107. viewLoad(event) {
  108. const _this = this;
  109. setTimeout(() => {
  110. _this.iframeloading = false;
  111. }, 2000);
  112. },
  113. changeWV() {
  114. const _this = this;
  115. uni.getSystemInfo({
  116. // 获取当前设备的具体信息
  117. success: (sysinfo) => {
  118. if (sysinfo.windowWidth > sysinfo.windowHeight) {
  119. // 横屏
  120. _this.isLandScape = true;
  121. } else {
  122. // 竖屏
  123. _this.isLandScape = false;
  124. }
  125. _this.wvTop = _this.isLandScape ? 0 : sysinfo.statusBarHeight + 20;
  126. _this.wvHeight = _this.isLandScape
  127. ? sysinfo.windowHeight - sysinfo.statusBarHeight - 20
  128. : sysinfo.windowHeight -
  129. sysinfo.statusBarHeight -
  130. sysinfo.statusBarHeight -
  131. 38;
  132. _this.wvWidth = _this.isLandScape
  133. ? sysinfo.windowWidth
  134. : sysinfo.windowWidth;
  135. console.log("屏幕模式--->", _this.isLandScape ? "横屏" : "竖屏");
  136. console.log(_this.wvTop, _this.wvWidth, _this.wvHeight);
  137. },
  138. });
  139. },
  140. },
  141. };
  142. </script>
  143. <style>
  144. .app-container {
  145. width: 100%;
  146. height: 100%;
  147. }
  148. .loadding-box {
  149. position: absolute;
  150. display: flex;
  151. justify-content: center;
  152. align-items: center;
  153. }
  154. </style>