index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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: "device",
  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. onLoad() {
  77. this.changeWV();
  78. },
  79. mounted() { },
  80. onShow() {
  81. // this.changeWV()
  82. },
  83. onResize() {
  84. this.changeWV();
  85. },
  86. methods: {
  87. NavChange: function (e) {
  88. this.PageCur = e;
  89. if (e == "tun2D") {
  90. // this.changeWV()
  91. this.iframeloading = true;
  92. }
  93. },
  94. viewLoad(event) {
  95. const _this = this;
  96. setTimeout(() => {
  97. _this.iframeloading = false;
  98. }, 2000);
  99. },
  100. changeWV() {
  101. const _this = this;
  102. uni.getSystemInfo({
  103. // 获取当前设备的具体信息
  104. success: (sysinfo) => {
  105. if (sysinfo.windowWidth > sysinfo.windowHeight) {
  106. // 横屏
  107. _this.isLandScape = true;
  108. } else {
  109. // 竖屏
  110. _this.isLandScape = false;
  111. }
  112. _this.wvTop = _this.isLandScape ? 0 : sysinfo.statusBarHeight + 20;
  113. _this.wvHeight = _this.isLandScape
  114. ? sysinfo.windowHeight - sysinfo.statusBarHeight - 20
  115. : sysinfo.windowHeight -
  116. sysinfo.statusBarHeight -
  117. sysinfo.statusBarHeight -
  118. 38;
  119. _this.wvWidth = _this.isLandScape
  120. ? sysinfo.windowWidth
  121. : sysinfo.windowWidth;
  122. console.log("屏幕模式--->", _this.isLandScape ? "横屏" : "竖屏");
  123. console.log(_this.wvTop, _this.wvWidth, _this.wvHeight);
  124. },
  125. });
  126. },
  127. },
  128. };
  129. </script>
  130. <style>
  131. .app-container {
  132. width: 100%;
  133. height: 100%;
  134. }
  135. .loadding-box {
  136. position: absolute;
  137. display: flex;
  138. justify-content: center;
  139. align-items: center;
  140. }
  141. </style>