index.vue 8.0 KB

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