bottomSideder.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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 !== '首页'"
  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')){
  68. const { href } = router.resolve(path.path)
  69. window.open(href, '_blank')
  70. }else {
  71. history.pushState({}, '', path.path);
  72. }
  73. } else {
  74. go(path.path);
  75. }
  76. isShowMenu.value = 0;
  77. }
  78. const closeMenu = () => {
  79. isShowMenu.value = 0;
  80. window.removeEventListener('click', closeMenu);
  81. };
  82. function openMenu() {
  83. isShowMenu.value = -1;
  84. window.addEventListener('click', closeMenu, true);
  85. }
  86. onMounted(async () => {
  87. menuModules.value = await getMenus();
  88. currentParentRoute.value = menuModules.value[1];
  89. });
  90. return {
  91. menuModules,
  92. isShowMenu,
  93. handleMenuClick,
  94. openMenu,
  95. selectMenu,
  96. go,
  97. currentParentRoute,
  98. };
  99. },
  100. });
  101. </script>
  102. <style lang="less" scoped>
  103. @keyframes menuShow {
  104. 0% {
  105. width: 0;
  106. height: 0;
  107. }
  108. 100% {
  109. width: 480px;
  110. height: 100vh;
  111. }
  112. }
  113. .bottom-side {
  114. width: 480px;
  115. height: 100vh;
  116. position: fixed;
  117. bottom: 2px;
  118. left: 0px;
  119. z-index: 9999;
  120. color: #fff;
  121. .menu-container {
  122. width: 480px;
  123. position: absolute;
  124. bottom: 0;
  125. // border: 1px solid #0099e6;
  126. // background-color: #06115a;
  127. border: 1px solid #0099e6;
  128. background-color: #0c1e2b;
  129. // backdrop-filter: blur(8px);
  130. .four-border-bg {
  131. margin: 5px;
  132. background-color: #ffffff00;
  133. .main-container {
  134. background-color: #ffffff00 !important;
  135. box-shadow: 0 0 3px #ffffff33 inset;
  136. backdrop-filter: blur(0px)
  137. }
  138. .parent-menu {
  139. width: 110px;
  140. }
  141. .child-menu {
  142. width: 330px;
  143. font-size: 13px;
  144. }
  145. .child-menu-item {
  146. width: 100px;
  147. background-color: #07476b;
  148. border-radius: 2px;
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. margin: 5px;
  153. cursor: pointer;
  154. box-shadow: 0 0 3px #ffffff22 inset;
  155. &:hover {
  156. background-color: #0676b5;
  157. }
  158. }
  159. }
  160. }
  161. .menu-button-group {
  162. margin: 5px 0;
  163. .program-menu {
  164. width: 90px;
  165. background: linear-gradient(#214ea5, #0f3075);
  166. margin-left: 5px;
  167. text-align: center;
  168. border-radius: 2px;
  169. cursor: pointer;
  170. &:hover {
  171. background: linear-gradient(#4281ff, #1c57d4);
  172. }
  173. }
  174. .program-menu-active {
  175. background: linear-gradient(#4281ff, #1c57d4);
  176. }
  177. .icon-style {
  178. margin-right: 10px;
  179. &:last-child {
  180. margin-right: 5px;
  181. }
  182. }
  183. }
  184. }
  185. .bottom-size-show {
  186. animation: menuShow 0.4s;
  187. animation-iteration-count: 1;
  188. animation-fill-mode: forwards;
  189. animation-timing-function: ease-in;
  190. /* Safari and Chrome */
  191. -webkit-animation: menuShow 0.4s;
  192. -webkit-animation-iteration-count: 1;
  193. -webkit-animation-fill-mode: forwards;
  194. -webkit-animation-timing-function: ease-in;
  195. }
  196. .menu-show-icon {
  197. position: fixed;
  198. bottom: 5px;
  199. left: 5px;
  200. z-index: 1000000;
  201. .icon {
  202. width: 60px;
  203. height: 60px;
  204. position: relative;
  205. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  206. background-position: center;
  207. &:before {
  208. content: '';
  209. display: block;
  210. width: 60px;
  211. height: 60px;
  212. position: absolute;
  213. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  214. background-position: center;
  215. }
  216. &:after {
  217. content: '';
  218. display: block;
  219. width: 60px;
  220. height: 60px;
  221. position: absolute;
  222. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  223. background-position: center;
  224. animation-timing-function: ease-in;
  225. animation: fadenum 8s infinite;
  226. }
  227. @keyframes fadenum {
  228. 0% {
  229. transform: rotate(0deg);
  230. }
  231. 10% {
  232. transform: rotate(360deg);
  233. }
  234. 100% {
  235. transform: rotate(360deg);
  236. }
  237. }
  238. }
  239. }
  240. </style>