bottomSideder.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div v-if="isShowMenu == -1" class="bottom-side" :class="{ 'bottom-size-show': isShowMenu }">
  3. <div class="menu-container">
  4. <FourBorderBg class="four-border-bg" v-for="(menu, index) in currentParentRoute.children" :key="index">
  5. <div class="vent-flex-row">
  6. <div class="parent-menu">
  7. {{ menu.name }}
  8. </div>
  9. <div class="vent-flex-row-wrap child-menu">
  10. <div class="child-menu-item" v-for="(childMenu, childIndex) in menu.children" :key="childIndex" @click="handleMenuClick(childMenu)">
  11. {{ childMenu.name }}
  12. </div>
  13. </div>
  14. </div>
  15. </FourBorderBg>
  16. <div class="vent-flex-row-between menu-button-group">
  17. <div class="vent-flex-row program-group">
  18. <template v-for="(programMenu, key) in menuModules" :key="key">
  19. <div
  20. v-if="!programMenu.title.startsWith('首页')"
  21. class="program-menu"
  22. :class="{ 'program-menu-active': currentParentRoute == programMenu }"
  23. @mouseenter="selectMenu(programMenu)"
  24. >{{ programMenu.title }}</div
  25. >
  26. </template>
  27. </div>
  28. <div class="setting-group">
  29. <SvgIcon class="icon-style" size="18" name="home" @click="go('/micro-vent-3dModal/dashboard/analysis')" />
  30. <SvgIcon class="icon-style" size="18" name="fixed" />
  31. <SvgIcon class="icon-style" size="18" name="enter" />
  32. <!-- <SvgIcon class="icon-style" size="18" name="setting" />
  33. <SvgIcon class="icon-style" size="18" name="hidden" /> -->
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div v-else-if="isShowMenu == 0" class="menu-show-icon">
  39. <div class="icon" @click="openMenu"></div>
  40. </div>
  41. <div v-else>4343434</div>
  42. </template>
  43. <script lang="ts">
  44. import { defineComponent, onMounted, ref, unref } from 'vue';
  45. import type { Menu } from '/@/router/types';
  46. import FourBorderBg from '/@/components/vent/fourBorderBg.vue';
  47. import { SvgIcon } from '/@/components/Icon';
  48. import { getMenus } from '/@/router/menus';
  49. import { useGo } from '/@/hooks/web/usePage';
  50. import { useRouter } from 'vue-router';
  51. export default defineComponent({
  52. name: 'BottomSider',
  53. components: { FourBorderBg, SvgIcon },
  54. setup() {
  55. const isShowMenu = ref(0);
  56. let menuModules = ref<Menu[]>([]);
  57. const router = useRouter();
  58. const currentParentRoute = ref<Menu>();
  59. const { currentRoute } = router;
  60. const route = unref(currentRoute);
  61. const go = useGo();
  62. function selectMenu(programMenu) {
  63. currentParentRoute.value = programMenu;
  64. }
  65. function handleMenuClick(path: Menu) {
  66. if (route.path.startsWith('/micro-')) {
  67. if (route.path.startsWith('/micro-vent-3dModal/dashboard/analysis')){
  68. const { href } = router.resolve(path.path)
  69. window.open(href, '_blank')
  70. }else {
  71. history.pushState({}, '', path.path);
  72. }
  73. } else {
  74. // micro-vent-3dModal
  75. debugger
  76. if(route.path.startsWith('/subSysmodal/')) {
  77. router.replace('/micro-vent-3dModal' + path.path)
  78. }else{
  79. go(path.path);
  80. }
  81. }
  82. isShowMenu.value = 0;
  83. }
  84. function closeMenu() {
  85. isShowMenu.value = 0;
  86. window.removeEventListener('click', closeMenu);
  87. };
  88. function openMenu() {
  89. isShowMenu.value = -1;
  90. window.addEventListener('click', closeMenu, true);
  91. }
  92. onMounted(async () => {
  93. menuModules.value = await getMenus();
  94. currentParentRoute.value = menuModules.value[1];
  95. });
  96. return {
  97. menuModules,
  98. isShowMenu,
  99. handleMenuClick,
  100. openMenu,
  101. selectMenu,
  102. go,
  103. currentParentRoute,
  104. };
  105. },
  106. });
  107. </script>
  108. <style lang="less" scoped>
  109. @keyframes menuShow {
  110. 0% {
  111. width: 0;
  112. height: 0;
  113. }
  114. 100% {
  115. width: 480px;
  116. height: 100vh;
  117. }
  118. }
  119. .bottom-side {
  120. width: 480px;
  121. height: 100vh;
  122. position: fixed;
  123. bottom: 2px;
  124. left: 0px;
  125. z-index: 999990;
  126. color: #fff;
  127. .menu-container {
  128. width: 480px;
  129. position: absolute;
  130. bottom: 0;
  131. // border: 1px solid #0099e6;
  132. // background-color: #06115a;
  133. border: 1px solid #0099e6;
  134. background-color: #0c1e2b;
  135. z-index: 999;
  136. // backdrop-filter: blur(8px);
  137. .four-border-bg {
  138. margin: 5px;
  139. background-color: #ffffff00;
  140. .main-container {
  141. background-color: #ffffff00 !important;
  142. box-shadow: 0 0 3px #ffffff33 inset;
  143. backdrop-filter: none !important;
  144. }
  145. .parent-menu {
  146. width: 110px;
  147. }
  148. .child-menu {
  149. width: 330px;
  150. font-size: 13px;
  151. }
  152. .child-menu-item {
  153. width: 100px;
  154. padding: 2px 0;
  155. // background-color: #086193;
  156. background: linear-gradient(#0d435d, #0e729d);
  157. border-radius: 2px;
  158. display: flex;
  159. align-items: center;
  160. justify-content: center;
  161. margin: 5px;
  162. cursor: pointer;
  163. box-shadow: 0 0 3px #ffffff22 inset;
  164. &:hover {
  165. background: linear-gradient(#1d89bf, #17aeee);
  166. }
  167. }
  168. }
  169. }
  170. .menu-button-group {
  171. margin: 5px 0;
  172. .program-menu {
  173. // width: 90px;
  174. padding: 1px 15px;
  175. background:linear-gradient(#217aa5, #0f4f75);
  176. margin-left: 5px;
  177. text-align: center;
  178. border-radius: 2px;
  179. cursor: pointer;
  180. &:hover {
  181. background: linear-gradient(#42b7ff, #1ca0d4);
  182. }
  183. }
  184. .program-menu-active {
  185. background: linear-gradient(#42adff, #1a8cbb);
  186. }
  187. .icon-style {
  188. margin-right: 10px;
  189. &:last-child {
  190. margin-right: 5px;
  191. }
  192. }
  193. }
  194. }
  195. .bottom-size-show {
  196. animation: menuShow 0.4s;
  197. animation-iteration-count: 1;
  198. animation-fill-mode: forwards;
  199. animation-timing-function: ease-in;
  200. /* Safari and Chrome */
  201. -webkit-animation: menuShow 0.4s;
  202. -webkit-animation-iteration-count: 1;
  203. -webkit-animation-fill-mode: forwards;
  204. -webkit-animation-timing-function: ease-in;
  205. }
  206. .menu-show-icon {
  207. position: fixed;
  208. bottom: 5px;
  209. left: 5px;
  210. z-index: 1000000;
  211. .icon {
  212. width: 60px;
  213. height: 60px;
  214. position: relative;
  215. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  216. background-position: center;
  217. &:before {
  218. content: '';
  219. display: block;
  220. width: 60px;
  221. height: 60px;
  222. position: absolute;
  223. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  224. background-position: center;
  225. }
  226. &:after {
  227. content: '';
  228. display: block;
  229. width: 60px;
  230. height: 60px;
  231. position: absolute;
  232. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  233. background-position: center;
  234. animation-timing-function: ease-in;
  235. animation: fadenum 8s infinite;
  236. }
  237. @keyframes fadenum {
  238. 0% {
  239. transform: rotate(0deg);
  240. }
  241. 10% {
  242. transform: rotate(360deg);
  243. }
  244. 100% {
  245. transform: rotate(360deg);
  246. }
  247. }
  248. }
  249. }
  250. </style>