bottomSideder.vue 11 KB

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