bottomSideder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div v-if="isShowMenu == -1" class="bottom-side" :class="{ 'bottom-size-show': isShowMenu }">
  3. <div class="menu-container">
  4. <div class="menu-items">
  5. <template v-for="(menu, index) in currentParentRoute.children" :key="index">
  6. <FourBorderBg class="four-border-bg" v-if="!menu.hideMenu">
  7. <div class="vent-flex-row">
  8. <div class="parent-menu">
  9. {{ menu.name }}
  10. </div>
  11. <div class="vent-flex-row-wrap child-menu">
  12. <template v-for="(childMenu, childIndex) in menu.children" :key="childIndex">
  13. <template v-if="!childMenu.hideMenu">
  14. <template v-if="childMenu['ver'] == 1">
  15. <div class="child-menu-item" @click.stop="handleMenuClick(childMenu)">
  16. {{ childMenu.name }}
  17. </div>
  18. </template>
  19. <template v-else>
  20. <div class="child-menu-item-disabled" @click.stop="handleMenuClick(childMenu)" :style="{ backgroundColor: '#314671' }">
  21. {{ childMenu.name }}
  22. </div>
  23. </template>
  24. </template>
  25. </template>
  26. </div>
  27. </div>
  28. </FourBorderBg>
  29. </template>
  30. </div>
  31. <div class="vent-flex-row-between menu-button-group">
  32. <div class="vent-flex-row program-group">
  33. <template v-for="(programMenu, key) in menuModules" :key="key">
  34. <div
  35. v-if="!programMenu.title.startsWith('首页')"
  36. class="program-menu"
  37. :class="{ 'program-menu-active': currentParentRoute == programMenu }"
  38. @click="selectMenu($event, programMenu)"
  39. >{{ programMenu.title }}</div
  40. >
  41. </template>
  42. </div>
  43. <div class="setting-group">
  44. <SvgIcon class="icon-style" size="18" name="home" @click="geHome" />
  45. <SvgIcon class="icon-style" size="18" name="fixed" />
  46. <SvgIcon class="icon-style" size="18" name="enter" @click="closeMenu" />
  47. <!-- <SvgIcon class="icon-style" size="18" name="setting" />
  48. <SvgIcon class="icon-style" size="18" name="hidden" /> -->
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div v-else-if="isShowMenu == 0" class="menu-show-icon">
  54. <div class="icon" :class="themeIcon == 'styleTwo' ? 'icon-2' : 'icon-1'" @click="openMenu"></div>
  55. </div>
  56. </template>
  57. <script lang="ts">
  58. import { defineComponent, nextTick, onMounted, ref, unref } from 'vue';
  59. import type { Menu } from '/@/router/types';
  60. import FourBorderBg from '/@/components/vent/fourBorderBg.vue';
  61. import { SvgIcon } from '/@/components/Icon';
  62. import { getMenus } from '/@/router/menus';
  63. import { useGo } from '/@/hooks/web/usePage';
  64. import { useRouter } from 'vue-router';
  65. import { getActions } from '/@/qiankun/state';
  66. import { PageEnum } from '/@/enums/pageEnum';
  67. import { useGlobSetting } from '/@/hooks/setting';
  68. import { unmountMicroApps } from '/@/qiankun';
  69. import { useUserStoreWithOut } from '/@/store/modules/user';
  70. import { useAppStore } from '/@/store/modules/app';
  71. export default defineComponent({
  72. name: 'BottomSider',
  73. components: { FourBorderBg, SvgIcon },
  74. setup() {
  75. let menuModules = ref<Menu[]>([]);
  76. const actions = getActions();
  77. const currentParentRoute = ref<Menu>();
  78. const { currentRoute } = useRouter();
  79. const route = unref(currentRoute);
  80. const go = useGo();
  81. const glob = useGlobSetting();
  82. const isShowMenu = ref(route.path.startsWith('/cad-viewer') ? 1 : 0);
  83. const userStore = useUserStoreWithOut();
  84. const appStore = useAppStore();
  85. const themeIcon = ref(appStore.getDarkMode);
  86. function selectMenu(e: Event, programMenu) {
  87. e.stopPropagation();
  88. currentParentRoute.value = programMenu;
  89. }
  90. async function handleMenuClick(path: Menu) {
  91. if (path.path == currentRoute.value.fullPath) {
  92. return;
  93. }
  94. if (path.path.includes('sw/monitor-fanmain')) {
  95. // 上湾主风机
  96. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  97. url.location = 'https://swkhmi.shendong.vip:9043/#SW_PW_NORTH'; //使这个窗口跳转到。
  98. return;
  99. }
  100. if (path.path.includes('sw/forcFan')) {
  101. // 上湾压风
  102. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  103. url.location = 'https://swkhmi.shendong.vip:9043/#SW_CA'; //使这个窗口跳转到。
  104. return;
  105. }
  106. if (path.path.includes('outlink/index')) {
  107. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  108. url.location = path['frameSrc']; //使这个窗口跳转到。
  109. return;
  110. }
  111. // if (currentRoute.value.path.startsWith('/micro')) {
  112. // go(path.path);
  113. // // window.history.pushState({}, '', path.path);
  114. // } else {
  115. // go(path.path);
  116. // }
  117. go(path.path);
  118. isShowMenu.value = 0;
  119. }
  120. function geHome() {
  121. if (userStore.getUserInfo.homePath) {
  122. go(userStore.getUserInfo.homePath);
  123. } else if (currentRoute.value.path.startsWith('/micro-need-air')) {
  124. window.history.pushState({}, '', glob.homePath || PageEnum.BASE_HOME);
  125. // if (currentRoute.value.path.startsWith('/micro-vent-3dModal/dashboard/analysis')) {
  126. // if (glob.homePath == '/micro-vent-3dModal/dashboard/analysis' || PageEnum.BASE_HOME == '/micro-vent-3dModal/dashboard/analysis') {
  127. // actions.setGlobalState({ pageObj: { pageType: 'home' } });
  128. // go(glob.homePath || PageEnum.BASE_HOME);
  129. // }
  130. // } else {
  131. // if (glob.homePath == '/model3D/home' || PageEnum.BASE_HOME == '/model3D/home') {
  132. // go(glob.homePath || PageEnum.BASE_HOME);
  133. // // location.reload()
  134. // }
  135. // go(glob.homePath || PageEnum.BASE_HOME);
  136. // }
  137. } else {
  138. go(glob.homePath || PageEnum.BASE_HOME);
  139. }
  140. }
  141. function closeMenu(e?: Event) {
  142. e?.stopPropagation();
  143. isShowMenu.value = 0;
  144. document.removeEventListener('click', closeMenu);
  145. }
  146. function openMenu(e: Event) {
  147. e.stopPropagation();
  148. isShowMenu.value = -1;
  149. document.addEventListener('click', closeMenu);
  150. }
  151. onMounted(async () => {
  152. menuModules.value = await getMenus();
  153. const index = menuModules.value.findIndex((menu) => menu.children && menu.children.length > 0);
  154. currentParentRoute.value = menuModules.value[index];
  155. });
  156. return {
  157. themeIcon,
  158. menuModules,
  159. isShowMenu,
  160. handleMenuClick,
  161. openMenu,
  162. closeMenu,
  163. selectMenu,
  164. go,
  165. geHome,
  166. currentParentRoute,
  167. };
  168. },
  169. });
  170. </script>
  171. <style lang="less" scoped>
  172. @keyframes menuShow {
  173. 0% {
  174. width: 0;
  175. height: 0;
  176. }
  177. 100% {
  178. width: 480px;
  179. height: 100vh;
  180. }
  181. }
  182. .bottom-side {
  183. width: 480px;
  184. height: 100vh;
  185. position: fixed;
  186. bottom: 2px;
  187. left: 0px;
  188. z-index: 9999999;
  189. color: #fff;
  190. .menu-container {
  191. width: 480px;
  192. position: absolute;
  193. bottom: 0;
  194. // border: 1px solid #0099e6;
  195. // background-color: #06115a;
  196. border: 1px solid #0099e6;
  197. background-color: #0c1e2b;
  198. z-index: 999;
  199. max-height: 900px;
  200. .menu-items {
  201. max-height: 840px;
  202. overflow-y: auto;
  203. }
  204. .four-border-bg {
  205. margin: 5px;
  206. background-color: #ffffff00;
  207. .main-container {
  208. background-color: #ffffff00 !important;
  209. box-shadow: 0 0 3px #ffffff33 inset;
  210. backdrop-filter: none !important;
  211. }
  212. .parent-menu {
  213. width: 110px;
  214. }
  215. .child-menu {
  216. width: 330px;
  217. font-size: 13px;
  218. }
  219. .child-menu-item {
  220. width: 100px;
  221. padding: 2px 0;
  222. text-align: center;
  223. // background-color: #086193;
  224. background: linear-gradient(#0d435d, #0e729d);
  225. border-radius: 2px;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. margin: 5px;
  230. cursor: pointer;
  231. box-shadow: 0 0 3px #ffffff22 inset;
  232. &:hover {
  233. background: linear-gradient(#1d89bf, #17aeee);
  234. }
  235. }
  236. .child-menu-item-disabled {
  237. width: 100px;
  238. padding: 2px 0;
  239. border-radius: 2px;
  240. display: flex;
  241. align-items: center;
  242. justify-content: center;
  243. margin: 5px;
  244. cursor: pointer;
  245. box-shadow: 0 0 3px #ffffff22 inset;
  246. background: linear-gradient(#7b7b7b, #6b6b6b);
  247. }
  248. }
  249. }
  250. .menu-button-group {
  251. margin: 5px 0;
  252. .program-menu {
  253. // width: 90px;
  254. padding: 1px 15px;
  255. background: linear-gradient(#217aa5, #0f4f75);
  256. margin-left: 5px;
  257. text-align: center;
  258. border-radius: 2px;
  259. cursor: pointer;
  260. &:hover {
  261. background: linear-gradient(#42b7ff, #1ca0d4);
  262. }
  263. }
  264. .program-menu-active {
  265. background: linear-gradient(#42adff, #1a8cbb);
  266. }
  267. .icon-style {
  268. margin-right: 10px;
  269. &:last-child {
  270. margin-right: 5px;
  271. }
  272. }
  273. }
  274. }
  275. .bottom-size-show {
  276. animation: menuShow 0.4s;
  277. animation-iteration-count: 1;
  278. animation-fill-mode: forwards;
  279. animation-timing-function: ease-in;
  280. /* Safari and Chrome */
  281. -webkit-animation: menuShow 0.4s;
  282. -webkit-animation-iteration-count: 1;
  283. -webkit-animation-fill-mode: forwards;
  284. -webkit-animation-timing-function: ease-in;
  285. }
  286. .menu-show-icon {
  287. position: fixed;
  288. bottom: 5px;
  289. left: 5px;
  290. z-index: 1000000;
  291. .icon {
  292. width: 60px;
  293. height: 60px;
  294. position: relative;
  295. &:before {
  296. content: '';
  297. display: block;
  298. width: 60px;
  299. height: 60px;
  300. position: absolute;
  301. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  302. background-position: center;
  303. }
  304. &:after {
  305. content: '';
  306. display: block;
  307. width: 60px;
  308. height: 60px;
  309. position: absolute;
  310. animation-timing-function: ease-in;
  311. animation: fadenum 8s infinite;
  312. }
  313. @keyframes fadenum {
  314. 0% {
  315. transform: rotate(0deg);
  316. }
  317. 10% {
  318. transform: rotate(360deg);
  319. }
  320. 100% {
  321. transform: rotate(360deg);
  322. }
  323. }
  324. }
  325. .icon-1 {
  326. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  327. background-position: center;
  328. &:after {
  329. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  330. background-position: center;
  331. }
  332. }
  333. .icon-2 {
  334. background-image: url('/@/assets/images/vent/bottom-icon/1.png');
  335. background-position: center;
  336. &:after {
  337. background: url('/@/assets/images/vent/bottom-icon/2.png') no-repeat;
  338. background-position: center;
  339. }
  340. }
  341. }
  342. </style>