bottomSideder.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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. </template>
  55. <script lang="ts">
  56. import { defineComponent, nextTick, onMounted, ref, unref } from 'vue';
  57. import type { Menu } from '/@/router/types';
  58. import FourBorderBg from '/@/components/vent/fourBorderBg.vue';
  59. import { SvgIcon } from '/@/components/Icon';
  60. import { getMenus } from '/@/router/menus';
  61. import { useGo } from '/@/hooks/web/usePage';
  62. import { useRouter } from 'vue-router';
  63. import { getActions } from '/@/qiankun/state';
  64. import { PageEnum } from '/@/enums/pageEnum';
  65. import { useGlobSetting } from '/@/hooks/setting';
  66. import { unmountMicroApps } from '/@/qiankun';
  67. import { useUserStoreWithOut } from '/@/store/modules/user';
  68. export default defineComponent({
  69. name: 'BottomSider',
  70. components: { FourBorderBg, SvgIcon },
  71. setup() {
  72. let menuModules = ref<Menu[]>([]);
  73. const actions = getActions();
  74. const currentParentRoute = ref<Menu>();
  75. const { currentRoute } = useRouter();
  76. const route = unref(currentRoute);
  77. const go = useGo();
  78. const glob = useGlobSetting();
  79. const isShowMenu = ref(route.path.startsWith('/cad-viewer') ? 1 : 0);
  80. const userStore = useUserStoreWithOut();
  81. function selectMenu(e: Event, programMenu) {
  82. e.stopPropagation();
  83. currentParentRoute.value = programMenu;
  84. }
  85. async function handleMenuClick(path: Menu) {
  86. debugger;
  87. if (path.path == currentRoute.value.fullPath) {
  88. return;
  89. }
  90. if (path.path.includes('sw/monitor-fanmain')) {
  91. // 上湾主风机
  92. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  93. url.location = 'https://swkhmi.shendong.vip:9043/#SW_PW_NORTH'; //使这个窗口跳转到。
  94. return;
  95. }
  96. if (path.path.includes('sw/forcFan')) {
  97. // 上湾压风
  98. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  99. url.location = 'https://swkhmi.shendong.vip:9043/#SW_CA'; //使这个窗口跳转到。
  100. return;
  101. }
  102. // if (currentRoute.value.path.startsWith('/micro')) {
  103. // go(path.path);
  104. // // window.history.pushState({}, '', path.path);
  105. // } else {
  106. // go(path.path);
  107. // }
  108. go(path.path);
  109. isShowMenu.value = 0;
  110. }
  111. function geHome() {
  112. if (userStore.getUserInfo.homePath) {
  113. go(userStore.getUserInfo.homePath);
  114. } else {
  115. if (currentRoute.value.path.startsWith('/micro-need-air')) {
  116. window.history.pushState({}, '', glob.homePath || PageEnum.BASE_HOME);
  117. } else {
  118. go(glob.homePath || PageEnum.BASE_HOME);
  119. }
  120. // if (currentRoute.value.path.startsWith('/micro-vent-3dModal/dashboard/analysis')) {
  121. // if (glob.homePath == '/micro-vent-3dModal/dashboard/analysis' || PageEnum.BASE_HOME == '/micro-vent-3dModal/dashboard/analysis') {
  122. // actions.setGlobalState({ pageObj: { pageType: 'home' } });
  123. // go(glob.homePath || PageEnum.BASE_HOME);
  124. // }
  125. // } else {
  126. // if (glob.homePath == '/model3D/home' || PageEnum.BASE_HOME == '/model3D/home') {
  127. // go(glob.homePath || PageEnum.BASE_HOME);
  128. // // location.reload()
  129. // }
  130. // go(glob.homePath || PageEnum.BASE_HOME);
  131. // }
  132. }
  133. }
  134. function closeMenu(e?: Event) {
  135. e?.stopPropagation();
  136. isShowMenu.value = 0;
  137. document.removeEventListener('click', closeMenu);
  138. }
  139. function openMenu(e: Event) {
  140. e.stopPropagation();
  141. isShowMenu.value = -1;
  142. document.addEventListener('click', closeMenu);
  143. }
  144. onMounted(async () => {
  145. menuModules.value = await getMenus();
  146. const index = menuModules.value.findIndex((menu) => menu.children && menu.children.length > 0);
  147. currentParentRoute.value = menuModules.value[index];
  148. });
  149. return {
  150. menuModules,
  151. isShowMenu,
  152. handleMenuClick,
  153. openMenu,
  154. closeMenu,
  155. selectMenu,
  156. go,
  157. geHome,
  158. currentParentRoute,
  159. };
  160. },
  161. });
  162. </script>
  163. <style lang="less" scoped>
  164. @keyframes menuShow {
  165. 0% {
  166. width: 0;
  167. height: 0;
  168. }
  169. 100% {
  170. width: 480px;
  171. height: 100vh;
  172. }
  173. }
  174. .bottom-side {
  175. width: 480px;
  176. height: 100vh;
  177. position: fixed;
  178. bottom: 2px;
  179. left: 0px;
  180. z-index: 9999999;
  181. color: #fff;
  182. .menu-container {
  183. width: 480px;
  184. position: absolute;
  185. bottom: 0;
  186. // border: 1px solid #0099e6;
  187. // background-color: #06115a;
  188. border: 1px solid #0099e6;
  189. background-color: #0c1e2b;
  190. z-index: 999;
  191. // backdrop-filter: blur(8px);
  192. .four-border-bg {
  193. margin: 5px;
  194. background-color: #ffffff00;
  195. .main-container {
  196. background-color: #ffffff00 !important;
  197. box-shadow: 0 0 3px #ffffff33 inset;
  198. backdrop-filter: none !important;
  199. }
  200. .parent-menu {
  201. width: 110px;
  202. }
  203. .child-menu {
  204. width: 330px;
  205. font-size: 13px;
  206. }
  207. .child-menu-item {
  208. width: 100px;
  209. padding: 2px 0;
  210. text-align: center;
  211. // background-color: #086193;
  212. background: linear-gradient(#0d435d, #0e729d);
  213. border-radius: 2px;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. margin: 5px;
  218. cursor: pointer;
  219. box-shadow: 0 0 3px #ffffff22 inset;
  220. &:hover {
  221. background: linear-gradient(#1d89bf, #17aeee);
  222. }
  223. }
  224. .child-menu-item-disabled {
  225. width: 100px;
  226. padding: 2px 0;
  227. border-radius: 2px;
  228. display: flex;
  229. align-items: center;
  230. justify-content: center;
  231. margin: 5px;
  232. cursor: pointer;
  233. box-shadow: 0 0 3px #ffffff22 inset;
  234. background: linear-gradient(#7b7b7b, #6b6b6b);
  235. }
  236. }
  237. }
  238. .menu-button-group {
  239. margin: 5px 0;
  240. .program-menu {
  241. // width: 90px;
  242. padding: 1px 15px;
  243. background: linear-gradient(#217aa5, #0f4f75);
  244. margin-left: 5px;
  245. text-align: center;
  246. border-radius: 2px;
  247. cursor: pointer;
  248. &:hover {
  249. background: linear-gradient(#42b7ff, #1ca0d4);
  250. }
  251. }
  252. .program-menu-active {
  253. background: linear-gradient(#42adff, #1a8cbb);
  254. }
  255. .icon-style {
  256. margin-right: 10px;
  257. &:last-child {
  258. margin-right: 5px;
  259. }
  260. }
  261. }
  262. }
  263. .bottom-size-show {
  264. animation: menuShow 0.4s;
  265. animation-iteration-count: 1;
  266. animation-fill-mode: forwards;
  267. animation-timing-function: ease-in;
  268. /* Safari and Chrome */
  269. -webkit-animation: menuShow 0.4s;
  270. -webkit-animation-iteration-count: 1;
  271. -webkit-animation-fill-mode: forwards;
  272. -webkit-animation-timing-function: ease-in;
  273. }
  274. .menu-show-icon {
  275. position: fixed;
  276. bottom: 5px;
  277. left: 5px;
  278. z-index: 1000000;
  279. .icon {
  280. width: 60px;
  281. height: 60px;
  282. position: relative;
  283. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  284. background-position: center;
  285. &:before {
  286. content: '';
  287. display: block;
  288. width: 60px;
  289. height: 60px;
  290. position: absolute;
  291. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  292. background-position: center;
  293. }
  294. &:after {
  295. content: '';
  296. display: block;
  297. width: 60px;
  298. height: 60px;
  299. position: absolute;
  300. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  301. background-position: center;
  302. animation-timing-function: ease-in;
  303. animation: fadenum 8s infinite;
  304. }
  305. @keyframes fadenum {
  306. 0% {
  307. transform: rotate(0deg);
  308. }
  309. 10% {
  310. transform: rotate(360deg);
  311. }
  312. 100% {
  313. transform: rotate(360deg);
  314. }
  315. }
  316. }
  317. }
  318. </style>