index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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-show="PageCur == 'device'"
  30. :style="{ marginTop: wvTop + 20 + 'px' }"
  31. ></Device>
  32. <filecenter :cur="PageCur" v-show="PageCur == 'filecenter'"></filecenter>
  33. <warndata v-show="PageCur == 'warndata'" :cur="PageCur"></warndata>
  34. <gasreport :cur="PageCur" v-show="PageCur == 'gasreport'"></gasreport>
  35. <user :cur="PageCur" v-show="PageCur == 'user'"></user>
  36. <u-tabbar
  37. :value="PageCur"
  38. @change="NavChange"
  39. :fixed="true"
  40. :placeholder="true"
  41. :safeAreaInsetBottom="true"
  42. >
  43. <u-tabbar-item v-show="menus.device != null"
  44. text="设备中心"
  45. name="device"
  46. icon="calendar"
  47. ></u-tabbar-item>
  48. <u-tabbar-item v-show="menus.warndata != null"
  49. text="预警分析"
  50. name="warndata"
  51. icon="plus-circle"
  52. ></u-tabbar-item>
  53. <u-tabbar-item v-show="menus.filecenter != null"
  54. text="文件共享"
  55. name="filecenter"
  56. icon="file-text"
  57. ></u-tabbar-item>
  58. <u-tabbar-item v-show="menus.gasreport != null"
  59. text="瓦斯日报"
  60. name="gasreport"
  61. icon="bell"
  62. ></u-tabbar-item>
  63. <u-tabbar-item text="我的" name="user" icon="bell"></u-tabbar-item>
  64. </u-tabbar>
  65. </view>
  66. </template>
  67. <script>
  68. import { nextTick } from "vue";
  69. import Device from "../device/index.vue";
  70. export default {
  71. components: {
  72. Device,
  73. },
  74. data() {
  75. return {
  76. isLandScape: "",
  77. PageCur: "device",
  78. tun3DPage: null,
  79. wvHeight: getApp().globalData.windowHeight,
  80. wvWidth: getApp().globalData.windowWidth,
  81. wvTop: 0,
  82. iframeloading: false,
  83. menus:{}
  84. };
  85. },
  86. computed: {
  87. permission: function () {
  88. var data = uni.getStorageSync("menuPermission");
  89. console.log(JSON.stringify(data));
  90. if (data == null || data == "" || data.length == 0)
  91. {
  92. data = [
  93. {
  94. redirect: null,
  95. path: "/device",
  96. ver: null,
  97. component: "device",
  98. route: "1",
  99. meta: {
  100. keepAlive: false,
  101. des: null,
  102. internalOrExternal: false,
  103. componentName: "device",
  104. title: "设备中心",
  105. },
  106. name: "device",
  107. id: "1862300062379954178",
  108. },
  109. {
  110. redirect: null,
  111. path: "/warndata",
  112. ver: null,
  113. component: "warndata",
  114. route: "1",
  115. meta: {
  116. keepAlive: false,
  117. des: null,
  118. internalOrExternal: false,
  119. componentName: "warndata",
  120. title: "预警分析",
  121. },
  122. name: "warndata",
  123. id: "1862301272310829057",
  124. },
  125. {
  126. redirect: null,
  127. path: "/filecenter",
  128. ver: null,
  129. component: "filecenter",
  130. route: "1",
  131. meta: {
  132. keepAlive: false,
  133. des: null,
  134. internalOrExternal: false,
  135. componentName: "filecenter",
  136. title: "文件共享中心",
  137. },
  138. name: "filecenter",
  139. id: "1862301712700166146",
  140. },
  141. {
  142. redirect: null,
  143. path: "/gasreport",
  144. ver: null,
  145. component: "gasreport",
  146. route: "1",
  147. meta: {
  148. keepAlive: false,
  149. des: null,
  150. internalOrExternal: false,
  151. componentName: "gasreport",
  152. title: "瓦斯上报",
  153. },
  154. name: "gasreport",
  155. id: "1862302433877184513",
  156. },
  157. ];
  158. }
  159. for(var i=0;i<data.length;i++){
  160. this.menus[data[i].component] = data[i].component
  161. }
  162. return data;
  163. },
  164. },
  165. watch: {
  166. permission: {
  167. handler(newV, oldV) {
  168. debugger;
  169. if (newV != null && newV != "") this.PageCur = newV[0].component;
  170. },
  171. immediate: true,
  172. }
  173. },
  174. onLoad() {
  175. this.changeWV();
  176. },
  177. mounted() {},
  178. onShow() {
  179. // this.changeWV()
  180. },
  181. onResize() {
  182. this.changeWV();
  183. },
  184. methods: {
  185. NavChange: function (e) {
  186. this.PageCur = e;
  187. if (e == "tun2D") {
  188. // this.changeWV()
  189. this.iframeloading = true;
  190. }
  191. },
  192. viewLoad(event) {
  193. const _this = this;
  194. setTimeout(() => {
  195. _this.iframeloading = false;
  196. }, 2000);
  197. },
  198. changeWV() {
  199. const _this = this;
  200. uni.getSystemInfo({
  201. // 获取当前设备的具体信息
  202. success: (sysinfo) => {
  203. if (sysinfo.windowWidth > sysinfo.windowHeight) {
  204. // 横屏
  205. _this.isLandScape = true;
  206. } else {
  207. // 竖屏
  208. _this.isLandScape = false;
  209. }
  210. _this.wvTop = _this.isLandScape ? 0 : sysinfo.statusBarHeight + 20;
  211. _this.wvHeight = _this.isLandScape
  212. ? sysinfo.windowHeight - sysinfo.statusBarHeight - 20
  213. : sysinfo.windowHeight -
  214. sysinfo.statusBarHeight -
  215. sysinfo.statusBarHeight -
  216. 38;
  217. _this.wvWidth = _this.isLandScape
  218. ? sysinfo.windowWidth
  219. : sysinfo.windowWidth;
  220. console.log("屏幕模式--->", _this.isLandScape ? "横屏" : "竖屏");
  221. console.log(_this.wvTop, _this.wvWidth, _this.wvHeight);
  222. },
  223. });
  224. },
  225. },
  226. };
  227. </script>
  228. <style>
  229. .app-container {
  230. width: 100%;
  231. height: 100%;
  232. }
  233. .loadding-box {
  234. position: absolute;
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. }
  239. </style>