index.vue 7.4 KB

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