index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. }"
  12. >
  13. <u-loading-icon></u-loading-icon>
  14. </view>
  15. <iframe
  16. v-if="PageCur == 'tun2D'"
  17. ref="iframe"
  18. src="http://182.92.126.35:8098/"
  19. @load="viewLoad"
  20. :style="{
  21. height: wvHeight + 'px',
  22. width: wvWidth + 'px',
  23. marginTop: wvTop + 'px',
  24. border: 'none',
  25. background: '#000',
  26. }"
  27. ></iframe>
  28. <Device
  29. v-if="PageCur == 'device'"
  30. :style="{ marginTop: wvTop + 20 + 'px' }"
  31. ></Device>
  32. <filecenter :cur="PageCur" v-if="PageCur == 'filecenter'"></filecenter>
  33. <warndata v-if="PageCur == 'warndata'" :cur="PageCur"></warndata>
  34. <gasreport :cur="PageCur" v-if="PageCur == 'gasreport'"></gasreport>
  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-item
  63. text="瓦斯日报"
  64. name="gasreport"
  65. icon="bell"
  66. ></u-tabbar-item>
  67. </u-tabbar>
  68. </view>
  69. </template>
  70. <script>
  71. import { nextTick } from "vue";
  72. import Device from "../device/index.vue";
  73. export default {
  74. components: {
  75. Device,
  76. },
  77. data() {
  78. return {
  79. isLandScape: "",
  80. PageCur: "device",
  81. tun3DPage: null,
  82. wvHeight: getApp().globalData.windowHeight,
  83. wvWidth: getApp().globalData.windowWidth,
  84. wvTop: 0,
  85. iframeloading: true,
  86. };
  87. },
  88. onLoad() {
  89. this.changeWV();
  90. },
  91. mounted() {},
  92. onShow() {
  93. // this.changeWV()
  94. },
  95. onResize() {
  96. this.changeWV();
  97. },
  98. methods: {
  99. NavChange: function (e) {
  100. this.PageCur = e;
  101. if (e == "tun2D") {
  102. // this.changeWV()
  103. this.iframeloading = true;
  104. }
  105. },
  106. viewLoad(event) {
  107. const _this = this;
  108. setTimeout(() => {
  109. _this.iframeloading = false;
  110. }, 2000);
  111. },
  112. changeWV() {
  113. const _this = this;
  114. uni.getSystemInfo({
  115. // 获取当前设备的具体信息
  116. success: (sysinfo) => {
  117. if (sysinfo.windowWidth > sysinfo.windowHeight) {
  118. // 横屏
  119. _this.isLandScape = true;
  120. } else {
  121. // 竖屏
  122. _this.isLandScape = false;
  123. }
  124. _this.wvTop = _this.isLandScape ? 0 : sysinfo.statusBarHeight + 20;
  125. _this.wvHeight = _this.isLandScape
  126. ? sysinfo.windowHeight - sysinfo.statusBarHeight - 20
  127. : sysinfo.windowHeight -
  128. sysinfo.statusBarHeight -
  129. sysinfo.statusBarHeight -
  130. 38;
  131. _this.wvWidth = _this.isLandScape
  132. ? sysinfo.windowWidth
  133. : sysinfo.windowWidth;
  134. console.log("屏幕模式--->", _this.isLandScape ? "横屏" : "竖屏");
  135. console.log(_this.wvTop, _this.wvWidth, _this.wvHeight);
  136. },
  137. });
  138. },
  139. },
  140. };
  141. </script>
  142. <style>
  143. .app-container {
  144. width: 100%;
  145. height: 100%;
  146. }
  147. .loadding-box {
  148. position: absolute;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. }
  153. </style>