bottomSideder.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <div v-if="isShowMenu == -1" class="bottom-side" :class="{ 'bottom-size-show': isShowMenu }">
  3. <div class="menu-container">
  4. <template v-for="(menu, index) in currentParentRoute.children" :key="index">
  5. <FourBorderBg class="four-border-bg" v-if="!menu.hideMenu">
  6. <div class="vent-flex-row" >
  7. <div class="parent-menu">
  8. {{ menu.name }}
  9. </div>
  10. <div class="vent-flex-row-wrap child-menu" >
  11. <template v-for="(childMenu, childIndex) in menu.children" :key="childIndex">
  12. <template v-if="!childMenu.hideMenu">
  13. <template v-if="childMenu['ver'] == 1">
  14. <div class="child-menu-item" @click.stop="handleMenuClick(childMenu)">
  15. {{ childMenu.name }}
  16. </div>
  17. </template>
  18. <template v-else>
  19. <div class="child-menu-item-disabled" @click.stop="handleMenuClick(childMenu)" :style="{ backgroundColor: '#314671' }">
  20. {{ childMenu.name }}
  21. </div>
  22. </template>
  23. </template>
  24. </template>
  25. </div>
  26. </div>
  27. </FourBorderBg>
  28. </template>
  29. <div class="vent-flex-row-between menu-button-group">
  30. <div class="vent-flex-row program-group">
  31. <template v-for="(programMenu, key) in menuModules" :key="key">
  32. <div
  33. v-if="!programMenu.title.startsWith('首页')"
  34. class="program-menu"
  35. :class="{ 'program-menu-active': currentParentRoute == programMenu }"
  36. @click="selectMenu($event, programMenu)"
  37. >{{ programMenu.title }}</div
  38. >
  39. </template>
  40. </div>
  41. <div class="setting-group">
  42. <SvgIcon class="icon-style" size="18" name="home" @click="geHome" />
  43. <SvgIcon class="icon-style" size="18" name="fixed" />
  44. <SvgIcon class="icon-style" size="18" name="enter" @click="closeMenu"/>
  45. <!-- <SvgIcon class="icon-style" size="18" name="setting" />
  46. <SvgIcon class="icon-style" size="18" name="hidden" /> -->
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <div v-else-if="isShowMenu == 0" class="menu-show-icon">
  52. <div class="icon" @click="openMenu"></div>
  53. </div>
  54. <div v-else>4343434</div>
  55. </template>
  56. <script lang="ts">
  57. import { defineComponent, nextTick, onMounted, ref, unref } from 'vue';
  58. import type { Menu } from '/@/router/types';
  59. import FourBorderBg from '/@/components/vent/fourBorderBg.vue';
  60. import { SvgIcon } from '/@/components/Icon';
  61. import { getMenus } from '/@/router/menus';
  62. import { useGo } from '/@/hooks/web/usePage';
  63. import { useRouter } from 'vue-router';
  64. import { getActions } from '/@/qiankun/state';
  65. import { PageEnum } from '/@/enums/pageEnum';
  66. import { useGlobSetting } from '/@/hooks/setting';
  67. import { router } from '/@/router';
  68. import { unmountMicroApps } from '/@/qiankun';
  69. export default defineComponent({
  70. name: 'BottomSider',
  71. components: { FourBorderBg, SvgIcon },
  72. setup() {
  73. const isShowMenu = ref(0);
  74. let menuModules = ref<Menu[]>([]);
  75. const actions = getActions();
  76. const currentParentRoute = ref<Menu>();
  77. const { currentRoute } = useRouter();
  78. const route = unref(currentRoute);
  79. const go = useGo();
  80. const glob = useGlobSetting();
  81. function selectMenu(e:Event, programMenu) {
  82. e.stopPropagation()
  83. currentParentRoute.value = programMenu;
  84. }
  85. async function handleMenuClick(path: Menu) {
  86. if(path.path.includes('sw/monitor-fanmain')) { // 上湾主风机
  87. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  88. url.location = 'https://swkhmi.shendong.vip:9043/#SW_PW_NORTH';//使这个窗口跳转到。
  89. return
  90. }
  91. if (path.path.includes('sw/forcFan')) { // 上湾压风
  92. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  93. url.location = 'https://swkhmi.shendong.vip:9043/#SW_CA';//使这个窗口跳转到。
  94. return
  95. }
  96. // if (route.path.startsWith('/micro-')) {
  97. // // if(path.path.startsWith('/micro-vent-3dModal') && route.path.startsWith('/micro-vent-3dModal')){
  98. // // debugger
  99. // // // window['3DVentRouter'].push(path.path)
  100. // // // 触发空路由转发到要跳转的路由
  101. // // // route.matched
  102. // // // router.replace(path.path)
  103. // // // go('/monitorChannel/monitor-window')
  104. // // router.push({ path: '/monitorChannel/monitor-window', query: { redirect: path.path } })
  105. // // // await router.push({path: '/test', query: { redirect: path.path} })
  106. // // // go(`/test${path.path}`)
  107. // // // go(path.path);
  108. // // // history.replaceState({}, '', 'path.path')
  109. // // // router.push({path: '/', {redice}});
  110. // // // const { query } = router.resolve(path.path)
  111. // // // const { type, deviceType } = query
  112. // // // if (type && deviceType) {
  113. // // // actions.setGlobalState({ pageObj: { pageType: type, deviceType } });
  114. // // // } else {
  115. // // // actions.setGlobalState({ pageObj: { pageType: 'home' } });
  116. // // // }
  117. // // return
  118. // // }
  119. // go(path.path);
  120. // } else {
  121. // debugger
  122. // if(route.path.startsWith('/subSysmodal/')) {
  123. // router.replace('/micro-vent-3dModal' + path.path)
  124. // return
  125. // }
  126. // debugger
  127. // go(path.path);
  128. // }
  129. if (route.path.startsWith('/subSysmodal/')) {
  130. router.replace('/micro-vent-3dModal' + path.path)
  131. return
  132. }
  133. if(route.path.startsWith('/micro-vent-3dModal')){
  134. if (path.path.startsWith('/micro-vent-3dModal') && route.path.startsWith('/micro-vent-3dModal')) {
  135. unmountMicroApps(['/micro-vent-3dModal']);
  136. nextTick(() => {
  137. go(path.path);
  138. })
  139. // const { query } = router.resolve(path.path)
  140. // const { type, deviceType } = query
  141. // if (type && deviceType) {
  142. // actions.setGlobalState({ pageObj: { pageType: type, deviceType } });
  143. // } else {
  144. // actions.setGlobalState({ pageObj: { pageType: 'home' } });
  145. // }
  146. }else{
  147. go(path.path);
  148. }
  149. // history.pushState(null, '', path.path)
  150. // router.push({path: path.path})
  151. }else{
  152. go(path.path);
  153. }
  154. isShowMenu.value = 0;
  155. }
  156. function geHome() {
  157. isShowMenu.value = 0;
  158. if(route.path.startsWith('/micro-vent-3dModal/dashboard/analysis')){
  159. if (glob.homePath == '/micro-vent-3dModal/dashboard/analysis' || PageEnum.BASE_HOME == '/micro-vent-3dModal/dashboard/analysis') {
  160. actions.setGlobalState({ pageObj: { pageType: 'home' } });
  161. go(glob.homePath || PageEnum.BASE_HOME)
  162. }
  163. }else{
  164. if(glob.homePath == '/model3D/home' || PageEnum.BASE_HOME == '/model3D/home'){
  165. go(glob.homePath || PageEnum.BASE_HOME)
  166. // location.reload()
  167. }
  168. go(glob.homePath || PageEnum.BASE_HOME)
  169. }
  170. }
  171. function closeMenu(e?:Event) {
  172. e?.stopPropagation()
  173. isShowMenu.value = 0;
  174. document.removeEventListener('click', closeMenu);
  175. };
  176. function openMenu(e:Event) {
  177. e.stopPropagation()
  178. isShowMenu.value = -1;
  179. document.addEventListener('click', closeMenu);
  180. }
  181. onMounted(async () => {
  182. menuModules.value = await getMenus();
  183. currentParentRoute.value = menuModules.value[1];
  184. });
  185. return {
  186. menuModules,
  187. isShowMenu,
  188. handleMenuClick,
  189. openMenu,
  190. closeMenu,
  191. selectMenu,
  192. go,
  193. geHome,
  194. currentParentRoute,
  195. };
  196. },
  197. });
  198. </script>
  199. <style lang="less" scoped>
  200. @keyframes menuShow {
  201. 0% {
  202. width: 0;
  203. height: 0;
  204. }
  205. 100% {
  206. width: 480px;
  207. height: 100vh;
  208. }
  209. }
  210. .bottom-side {
  211. width: 480px;
  212. height: 100vh;
  213. position: fixed;
  214. bottom: 2px;
  215. left: 0px;
  216. z-index: 9999999;
  217. color: #fff;
  218. .menu-container {
  219. width: 480px;
  220. position: absolute;
  221. bottom: 0;
  222. // border: 1px solid #0099e6;
  223. // background-color: #06115a;
  224. border: 1px solid #0099e6;
  225. background-color: #0c1e2b;
  226. z-index: 999;
  227. // backdrop-filter: blur(8px);
  228. .four-border-bg {
  229. margin: 5px;
  230. background-color: #ffffff00;
  231. .main-container {
  232. background-color: #ffffff00 !important;
  233. box-shadow: 0 0 3px #ffffff33 inset;
  234. backdrop-filter: none !important;
  235. }
  236. .parent-menu {
  237. width: 110px;
  238. }
  239. .child-menu {
  240. width: 330px;
  241. font-size: 13px;
  242. }
  243. .child-menu-item {
  244. width: 100px;
  245. padding: 2px 0;
  246. text-align: center;
  247. // background-color: #086193;
  248. background: linear-gradient(#0d435d, #0e729d);
  249. border-radius: 2px;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. margin: 5px;
  254. cursor: pointer;
  255. box-shadow: 0 0 3px #ffffff22 inset;
  256. &:hover {
  257. background: linear-gradient(#1d89bf, #17aeee);
  258. }
  259. }
  260. .child-menu-item-disabled{
  261. width: 100px;
  262. padding: 2px 0;
  263. border-radius: 2px;
  264. display: flex;
  265. align-items: center;
  266. justify-content: center;
  267. margin: 5px;
  268. cursor: pointer;
  269. box-shadow: 0 0 3px #ffffff22 inset;
  270. background: linear-gradient(#7b7b7b, #6b6b6b);
  271. }
  272. }
  273. }
  274. .menu-button-group {
  275. margin: 5px 0;
  276. .program-menu {
  277. // width: 90px;
  278. padding: 1px 15px;
  279. background:linear-gradient(#217aa5, #0f4f75);
  280. margin-left: 5px;
  281. text-align: center;
  282. border-radius: 2px;
  283. cursor: pointer;
  284. &:hover {
  285. background: linear-gradient(#42b7ff, #1ca0d4);
  286. }
  287. }
  288. .program-menu-active {
  289. background: linear-gradient(#42adff, #1a8cbb);
  290. }
  291. .icon-style {
  292. margin-right: 10px;
  293. &:last-child {
  294. margin-right: 5px;
  295. }
  296. }
  297. }
  298. }
  299. .bottom-size-show {
  300. animation: menuShow 0.4s;
  301. animation-iteration-count: 1;
  302. animation-fill-mode: forwards;
  303. animation-timing-function: ease-in;
  304. /* Safari and Chrome */
  305. -webkit-animation: menuShow 0.4s;
  306. -webkit-animation-iteration-count: 1;
  307. -webkit-animation-fill-mode: forwards;
  308. -webkit-animation-timing-function: ease-in;
  309. }
  310. .menu-show-icon {
  311. position: fixed;
  312. bottom: 5px;
  313. left: 5px;
  314. z-index: 1000000;
  315. .icon {
  316. width: 60px;
  317. height: 60px;
  318. position: relative;
  319. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  320. background-position: center;
  321. &:before {
  322. content: '';
  323. display: block;
  324. width: 60px;
  325. height: 60px;
  326. position: absolute;
  327. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  328. background-position: center;
  329. }
  330. &:after {
  331. content: '';
  332. display: block;
  333. width: 60px;
  334. height: 60px;
  335. position: absolute;
  336. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  337. background-position: center;
  338. animation-timing-function: ease-in;
  339. animation: fadenum 8s infinite;
  340. }
  341. @keyframes fadenum {
  342. 0% {
  343. transform: rotate(0deg);
  344. }
  345. 10% {
  346. transform: rotate(360deg);
  347. }
  348. 100% {
  349. transform: rotate(360deg);
  350. }
  351. }
  352. }
  353. }
  354. </style>