bottomSideder.vue 9.8 KB

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