bottomSideder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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 = appStore.getDarkMode;
  86. const themeIcon=ref('styleTwo')
  87. function selectMenu(e: Event, programMenu) {
  88. e.stopPropagation();
  89. currentParentRoute.value = programMenu;
  90. }
  91. async function handleMenuClick(path: Menu) {
  92. if (path.path == currentRoute.value.fullPath) {
  93. return;
  94. }
  95. if (path.path.includes('sw/monitor-fanmain')) {
  96. // 上湾主风机
  97. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  98. url.location = 'https://swkhmi.shendong.vip:9043/#SW_PW_NORTH'; //使这个窗口跳转到。
  99. return;
  100. }
  101. if (path.path.includes('sw/forcFan')) {
  102. // 上湾压风
  103. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  104. url.location = 'https://swkhmi.shendong.vip:9043/#SW_CA'; //使这个窗口跳转到。
  105. return;
  106. }
  107. if (path.path.includes('outlink/index')) {
  108. var url = window.open('_blank') as Window; //打开一个窗口,然后用
  109. url.location = path['frameSrc']; //使这个窗口跳转到。
  110. return;
  111. }
  112. // if (currentRoute.value.path.startsWith('/micro')) {
  113. // go(path.path);
  114. // // window.history.pushState({}, '', path.path);
  115. // } else {
  116. // go(path.path);
  117. // }
  118. go(path.path);
  119. isShowMenu.value = 0;
  120. }
  121. function geHome() {
  122. if (userStore.getUserInfo.homePath) {
  123. go(userStore.getUserInfo.homePath);
  124. } else if (currentRoute.value.path.startsWith('/micro-need-air')) {
  125. window.history.pushState({}, '', glob.homePath || PageEnum.BASE_HOME);
  126. // if (currentRoute.value.path.startsWith('/micro-vent-3dModal/dashboard/analysis')) {
  127. // if (glob.homePath == '/micro-vent-3dModal/dashboard/analysis' || PageEnum.BASE_HOME == '/micro-vent-3dModal/dashboard/analysis') {
  128. // actions.setGlobalState({ pageObj: { pageType: 'home' } });
  129. // go(glob.homePath || PageEnum.BASE_HOME);
  130. // }
  131. // } else {
  132. // if (glob.homePath == '/model3D/home' || PageEnum.BASE_HOME == '/model3D/home') {
  133. // go(glob.homePath || PageEnum.BASE_HOME);
  134. // // location.reload()
  135. // }
  136. // go(glob.homePath || PageEnum.BASE_HOME);
  137. // }
  138. } else {
  139. go(glob.homePath || PageEnum.BASE_HOME);
  140. }
  141. }
  142. function closeMenu(e?: Event) {
  143. e?.stopPropagation();
  144. isShowMenu.value = 0;
  145. document.removeEventListener('click', closeMenu);
  146. }
  147. function openMenu(e: Event) {
  148. e.stopPropagation();
  149. isShowMenu.value = -1;
  150. document.addEventListener('click', closeMenu);
  151. }
  152. onMounted(async () => {
  153. menuModules.value = await getMenus();
  154. const index = menuModules.value.findIndex((menu) => menu.children && menu.children.length > 0);
  155. currentParentRoute.value = menuModules.value[index];
  156. });
  157. return {
  158. themeIcon,
  159. menuModules,
  160. isShowMenu,
  161. handleMenuClick,
  162. openMenu,
  163. closeMenu,
  164. selectMenu,
  165. go,
  166. geHome,
  167. currentParentRoute,
  168. };
  169. },
  170. });
  171. </script>
  172. <style lang="less" scoped>
  173. @keyframes menuShow {
  174. 0% {
  175. width: 0;
  176. height: 0;
  177. }
  178. 100% {
  179. width: 480px;
  180. height: 100vh;
  181. }
  182. }
  183. .bottom-side {
  184. width: 480px;
  185. height: 100vh;
  186. position: fixed;
  187. bottom: 2px;
  188. left: 0px;
  189. z-index: 9999999;
  190. color: #fff;
  191. .menu-container {
  192. width: 480px;
  193. position: absolute;
  194. bottom: 0;
  195. // border: 1px solid #0099e6;
  196. // background-color: #06115a;
  197. border: 1px solid #0099e6;
  198. background-color: #0c1e2b;
  199. z-index: 999;
  200. max-height: 900px;
  201. .menu-items {
  202. max-height: 840px;
  203. overflow-y: auto;
  204. }
  205. .four-border-bg {
  206. margin: 5px;
  207. background-color: #ffffff00;
  208. .main-container {
  209. background-color: #ffffff00 !important;
  210. box-shadow: 0 0 3px #ffffff33 inset;
  211. backdrop-filter: none !important;
  212. }
  213. .parent-menu {
  214. width: 110px;
  215. }
  216. .child-menu {
  217. width: 330px;
  218. font-size: 13px;
  219. }
  220. .child-menu-item {
  221. width: 100px;
  222. padding: 2px 0;
  223. text-align: center;
  224. // background-color: #086193;
  225. background: linear-gradient(#0d435d, #0e729d);
  226. border-radius: 2px;
  227. display: flex;
  228. align-items: center;
  229. justify-content: center;
  230. margin: 5px;
  231. cursor: pointer;
  232. box-shadow: 0 0 3px #ffffff22 inset;
  233. &:hover {
  234. background: linear-gradient(#1d89bf, #17aeee);
  235. }
  236. }
  237. .child-menu-item-disabled {
  238. width: 100px;
  239. padding: 2px 0;
  240. border-radius: 2px;
  241. display: flex;
  242. align-items: center;
  243. justify-content: center;
  244. margin: 5px;
  245. cursor: pointer;
  246. box-shadow: 0 0 3px #ffffff22 inset;
  247. background: linear-gradient(#7b7b7b, #6b6b6b);
  248. }
  249. }
  250. }
  251. .menu-button-group {
  252. margin: 5px 0;
  253. .program-menu {
  254. // width: 90px;
  255. padding: 1px 15px;
  256. background: linear-gradient(#217aa5, #0f4f75);
  257. margin-left: 5px;
  258. text-align: center;
  259. border-radius: 2px;
  260. cursor: pointer;
  261. &:hover {
  262. background: linear-gradient(#42b7ff, #1ca0d4);
  263. }
  264. }
  265. .program-menu-active {
  266. background: linear-gradient(#42adff, #1a8cbb);
  267. }
  268. .icon-style {
  269. margin-right: 10px;
  270. &:last-child {
  271. margin-right: 5px;
  272. }
  273. }
  274. }
  275. }
  276. .bottom-size-show {
  277. animation: menuShow 0.4s;
  278. animation-iteration-count: 1;
  279. animation-fill-mode: forwards;
  280. animation-timing-function: ease-in;
  281. /* Safari and Chrome */
  282. -webkit-animation: menuShow 0.4s;
  283. -webkit-animation-iteration-count: 1;
  284. -webkit-animation-fill-mode: forwards;
  285. -webkit-animation-timing-function: ease-in;
  286. }
  287. .menu-show-icon {
  288. position: fixed;
  289. bottom: 5px;
  290. left: 5px;
  291. z-index: 1000000;
  292. .icon {
  293. width: 60px;
  294. height: 60px;
  295. position: relative;
  296. &:before {
  297. content: '';
  298. display: block;
  299. width: 60px;
  300. height: 60px;
  301. position: absolute;
  302. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  303. background-position: center;
  304. }
  305. &:after {
  306. content: '';
  307. display: block;
  308. width: 60px;
  309. height: 60px;
  310. position: absolute;
  311. animation-timing-function: ease-in;
  312. animation: fadenum 8s infinite;
  313. }
  314. @keyframes fadenum {
  315. 0% {
  316. transform: rotate(0deg);
  317. }
  318. 10% {
  319. transform: rotate(360deg);
  320. }
  321. 100% {
  322. transform: rotate(360deg);
  323. }
  324. }
  325. }
  326. .icon-1 {
  327. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  328. background-position: center;
  329. &:after {
  330. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  331. background-position: center;
  332. }
  333. }
  334. .icon-2 {
  335. background-image: url('/@/assets/images/vent/bottom-icon/1.png');
  336. background-position: center;
  337. &:after {
  338. background: url('/@/assets/images/vent/bottom-icon/2.png') no-repeat;
  339. background-position: center;
  340. }
  341. }
  342. }
  343. </style>