1
0

bottomSideder.vue 10.0 KB

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