bottomSideder.vue 10 KB

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