index.vue 4.0 KB

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