123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <template>
- <div v-if="isShowMenu == -1" class="bottom-side" :class="{ 'bottom-size-show': isShowMenu }">
- <div class="menu-container">
- <template v-for="(menu, index) in currentParentRoute.children" :key="index">
- <FourBorderBg class="four-border-bg" v-if="!menu.hideMenu">
- <div class="vent-flex-row">
- <div class="parent-menu">
- {{ menu.name }}
- </div>
- <div class="vent-flex-row-wrap child-menu">
- <template v-for="(childMenu, childIndex) in menu.children" :key="childIndex">
- <template v-if="!childMenu.hideMenu">
- <template v-if="childMenu['ver'] == 1">
- <div class="child-menu-item" @click.stop="handleMenuClick(childMenu)">
- {{ childMenu.name }}
- </div>
- </template>
- <template v-else>
- <div class="child-menu-item-disabled" @click.stop="handleMenuClick(childMenu)" :style="{ backgroundColor: '#314671' }">
- {{ childMenu.name }}
- </div>
- </template>
- </template>
- </template>
- </div>
- </div>
- </FourBorderBg>
- </template>
- <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.startsWith('首页')"
- class="program-menu"
- :class="{ 'program-menu-active': currentParentRoute == programMenu }"
- @click="selectMenu($event, programMenu)"
- >{{ programMenu.title }}</div
- >
- </template>
- </div>
- <div class="setting-group">
- <SvgIcon class="icon-style" size="18" name="home" @click="geHome" />
- <SvgIcon class="icon-style" size="18" name="fixed" />
- <SvgIcon class="icon-style" size="18" name="enter" @click="closeMenu" />
- <!-- <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>
- </template>
- <script lang="ts">
- import { defineComponent, nextTick, 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';
- import { getActions } from '/@/qiankun/state';
- import { PageEnum } from '/@/enums/pageEnum';
- import { useGlobSetting } from '/@/hooks/setting';
- import { unmountMicroApps } from '/@/qiankun';
- import { useUserStoreWithOut } from '/@/store/modules/user';
- export default defineComponent({
- name: 'BottomSider',
- components: { FourBorderBg, SvgIcon },
- setup() {
- let menuModules = ref<Menu[]>([]);
- const actions = getActions();
- const currentParentRoute = ref<Menu>();
- const { currentRoute } = useRouter();
- const route = unref(currentRoute);
- const go = useGo();
- const glob = useGlobSetting();
- const isShowMenu = ref(route.path.startsWith('/cad-viewer') ? 1 : 0);
- const userStore = useUserStoreWithOut();
- function selectMenu(e: Event, programMenu) {
- e.stopPropagation();
- currentParentRoute.value = programMenu;
- }
- async function handleMenuClick(path: Menu) {
- if (path.path == currentRoute.value.fullPath) {
- return;
- }
- if (path.path.includes('sw/monitor-fanmain')) {
- // 上湾主风机
- var url = window.open('_blank') as Window; //打开一个窗口,然后用
- url.location = 'https://swkhmi.shendong.vip:9043/#SW_PW_NORTH'; //使这个窗口跳转到。
- return;
- }
- if (path.path.includes('sw/forcFan')) {
- // 上湾压风
- var url = window.open('_blank') as Window; //打开一个窗口,然后用
- url.location = 'https://swkhmi.shendong.vip:9043/#SW_CA'; //使这个窗口跳转到。
- return;
- }
- // if (currentRoute.value.path.startsWith('/micro')) {
- // go(path.path);
- // // window.history.pushState({}, '', path.path);
- // } else {
- // go(path.path);
- // }
- go(path.path);
- isShowMenu.value = 0;
- }
- function geHome() {
- if (userStore.getUserInfo.homePath) {
- go(userStore.getUserInfo.homePath);
- } else {
- if (currentRoute.value.path.startsWith('/micro-need-air')) {
- window.history.pushState({}, '', glob.homePath || PageEnum.BASE_HOME);
- } else {
- go(glob.homePath || PageEnum.BASE_HOME);
- }
- // if (currentRoute.value.path.startsWith('/micro-vent-3dModal/dashboard/analysis')) {
- // if (glob.homePath == '/micro-vent-3dModal/dashboard/analysis' || PageEnum.BASE_HOME == '/micro-vent-3dModal/dashboard/analysis') {
- // actions.setGlobalState({ pageObj: { pageType: 'home' } });
- // go(glob.homePath || PageEnum.BASE_HOME);
- // }
- // } else {
- // if (glob.homePath == '/model3D/home' || PageEnum.BASE_HOME == '/model3D/home') {
- // go(glob.homePath || PageEnum.BASE_HOME);
- // // location.reload()
- // }
- // go(glob.homePath || PageEnum.BASE_HOME);
- // }
- }
- }
- function closeMenu(e?: Event) {
- e?.stopPropagation();
- isShowMenu.value = 0;
- document.removeEventListener('click', closeMenu);
- }
- function openMenu(e: Event) {
- e.stopPropagation();
- isShowMenu.value = -1;
- document.addEventListener('click', closeMenu);
- }
- onMounted(async () => {
- menuModules.value = await getMenus();
- const index = menuModules.value.findIndex((menu) => menu.children && menu.children.length > 0);
- currentParentRoute.value = menuModules.value[index];
- });
- return {
- menuModules,
- isShowMenu,
- handleMenuClick,
- openMenu,
- closeMenu,
- selectMenu,
- go,
- geHome,
- 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: 9999999;
- color: #fff;
- .menu-container {
- width: 480px;
- position: absolute;
- bottom: 0;
- // border: 1px solid #0099e6;
- // background-color: #06115a;
- border: 1px solid #0099e6;
- background-color: #0c1e2b;
- z-index: 999;
- // 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: none !important;
- }
- .parent-menu {
- width: 110px;
- }
- .child-menu {
- width: 330px;
- font-size: 13px;
- }
- .child-menu-item {
- width: 100px;
- padding: 2px 0;
- text-align: center;
- // background-color: #086193;
- background: linear-gradient(#0d435d, #0e729d);
- border-radius: 2px;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 5px;
- cursor: pointer;
- box-shadow: 0 0 3px #ffffff22 inset;
- &:hover {
- background: linear-gradient(#1d89bf, #17aeee);
- }
- }
- .child-menu-item-disabled {
- width: 100px;
- padding: 2px 0;
- border-radius: 2px;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 5px;
- cursor: pointer;
- box-shadow: 0 0 3px #ffffff22 inset;
- background: linear-gradient(#7b7b7b, #6b6b6b);
- }
- }
- }
- .menu-button-group {
- margin: 5px 0;
- .program-menu {
- // width: 90px;
- padding: 1px 15px;
- background: linear-gradient(#217aa5, #0f4f75);
- margin-left: 5px;
- text-align: center;
- border-radius: 2px;
- cursor: pointer;
- &:hover {
- background: linear-gradient(#42b7ff, #1ca0d4);
- }
- }
- .program-menu-active {
- background: linear-gradient(#42adff, #1a8cbb);
- }
- .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>
|