index.vue 6.4 KB

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