123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <template>
- <div v-if="isShowMenu == -1" class="bottom-side" :class="{ 'bottom-size-show': isShowMenu }">
- <div class="menu-container">
- <FourBorderBg class="four-border-bg" v-for="(menu, index) in currentParentRoute.children" :key="index">
- <div class="vent-flex-row">
- <div class="parent-menu">
- {{ menu.name }}
- </div>
- <div class="vent-flex-row-wrap child-menu">
- <div class="child-menu-item" v-for="(childMenu, childIndex) in menu.children" :key="childIndex" @click="handleMenuClick(childMenu)">
- {{ childMenu.name }}
- </div>
- </div>
- </div>
- </FourBorderBg>
- <div class="vent-flex-row-between menu-button-group">
- <div class="vent-flex-row program-group">
- <template v-for="(programMenu, key) in menuModules" :key="key">
- <div
- v-if="programMenu.title !== '首页'"
- class="program-menu"
- :class="{ 'program-menu-active': currentParentRoute == programMenu }"
- @mouseenter="selectMenu(programMenu)"
- >{{ programMenu.title }}</div
- >
- </template>
- </div>
- <div class="setting-group">
- <SvgIcon class="icon-style" size="18" name="home" @click="go('/micro-vent-3dModal/dashboard/analysis')" />
- <SvgIcon class="icon-style" size="18" name="fixed" />
- <SvgIcon class="icon-style" size="18" name="enter" />
- <!-- <SvgIcon class="icon-style" size="18" name="setting" />
- <SvgIcon class="icon-style" size="18" name="hidden" /> -->
- </div>
- </div>
- </div>
- </div>
- <div v-else-if="isShowMenu == 0" class="menu-show-icon">
- <div class="icon" @click="openMenu"></div>
- </div>
- <div v-else>4343434</div>
- </template>
- <script lang="ts">
- import { defineComponent, onMounted, ref, unref } from 'vue';
- import type { Menu } from '/@/router/types';
- import FourBorderBg from '/@/components/vent/fourBorderBg.vue';
- import { SvgIcon } from '/@/components/Icon';
- import { getMenus } from '/@/router/menus';
- import { useGo } from '/@/hooks/web/usePage';
- import { useRouter } from 'vue-router';
- export default defineComponent({
- name: 'BottomSider',
- components: { FourBorderBg, SvgIcon },
- setup() {
- const isShowMenu = ref(0);
- let menuModules = ref<Menu[]>([]);
- const router = useRouter();
- const currentParentRoute = ref<Menu>();
- const { currentRoute } = router;
- const route = unref(currentRoute);
- const go = useGo();
- function selectMenu(programMenu) {
- currentParentRoute.value = programMenu;
- }
- function handleMenuClick(path: Menu) {
- if (route.path.startsWith('/micro-')) {
- if (route.path.startsWith('/micro-vent-3dModal')){
- const { href } = router.resolve(path.path)
- window.open(href, '_blank')
- }else {
- history.pushState({}, '', path.path);
- }
- } else {
- go(path.path);
- }
- isShowMenu.value = 0;
- }
- const closeMenu = () => {
- isShowMenu.value = 0;
- window.removeEventListener('click', closeMenu);
- };
- function openMenu() {
- isShowMenu.value = -1;
- window.addEventListener('click', closeMenu, true);
- }
- onMounted(async () => {
- menuModules.value = await getMenus();
- currentParentRoute.value = menuModules.value[1];
- });
- return {
- menuModules,
- isShowMenu,
- handleMenuClick,
- openMenu,
- selectMenu,
- go,
- currentParentRoute,
- };
- },
- });
- </script>
- <style lang="less" scoped>
- @keyframes menuShow {
- 0% {
- width: 0;
- height: 0;
- }
- 100% {
- width: 480px;
- height: 100vh;
- }
- }
- .bottom-side {
- width: 480px;
- height: 100vh;
- position: fixed;
- bottom: 2px;
- left: 0px;
- z-index: 9999;
- color: #fff;
- .menu-container {
- width: 480px;
- position: absolute;
- bottom: 0;
- // border: 1px solid #0099e6;
- // background-color: #06115a;
- border: 1px solid #0099e6;
- background-color: #0c1e2b;
- // backdrop-filter: blur(8px);
- .four-border-bg {
- margin: 5px;
- background-color: #ffffff00;
- .main-container {
- background-color: #ffffff00 !important;
- box-shadow: 0 0 3px #ffffff33 inset;
- backdrop-filter: blur(0px)
- }
- .parent-menu {
- width: 110px;
- }
- .child-menu {
- width: 330px;
- font-size: 13px;
- }
- .child-menu-item {
- width: 100px;
- background-color: #07476b;
- border-radius: 2px;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 5px;
- cursor: pointer;
- box-shadow: 0 0 3px #ffffff22 inset;
- &:hover {
- background-color: #0676b5;
- }
- }
- }
- }
- .menu-button-group {
- margin: 5px 0;
- .program-menu {
- width: 90px;
- background: linear-gradient(#214ea5, #0f3075);
- margin-left: 5px;
- text-align: center;
- border-radius: 2px;
- cursor: pointer;
- &:hover {
- background: linear-gradient(#4281ff, #1c57d4);
- }
- }
- .program-menu-active {
- background: linear-gradient(#4281ff, #1c57d4);
- }
- .icon-style {
- margin-right: 10px;
- &:last-child {
- margin-right: 5px;
- }
- }
- }
- }
- .bottom-size-show {
- animation: menuShow 0.4s;
- animation-iteration-count: 1;
- animation-fill-mode: forwards;
- animation-timing-function: ease-in;
- /* Safari and Chrome */
- -webkit-animation: menuShow 0.4s;
- -webkit-animation-iteration-count: 1;
- -webkit-animation-fill-mode: forwards;
- -webkit-animation-timing-function: ease-in;
- }
- .menu-show-icon {
- position: fixed;
- bottom: 5px;
- left: 5px;
- z-index: 1000000;
- .icon {
- width: 60px;
- height: 60px;
- position: relative;
- background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
- background-position: center;
- &:before {
- content: '';
- display: block;
- width: 60px;
- height: 60px;
- position: absolute;
- background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
- background-position: center;
- }
- &:after {
- content: '';
- display: block;
- width: 60px;
- height: 60px;
- position: absolute;
- background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
- background-position: center;
- animation-timing-function: ease-in;
- animation: fadenum 8s infinite;
- }
- @keyframes fadenum {
- 0% {
- transform: rotate(0deg);
- }
- 10% {
- transform: rotate(360deg);
- }
- 100% {
- transform: rotate(360deg);
- }
- }
- }
- }
- </style>
|