index.vue 5.3 KB

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