bottomSideder.vue 6.6 KB

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