bottomSideder3.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <div v-if="isShowMenu == -1" class="bottom-side" :class="{ 'bottom-size-show': isShowMenu }" @click="closeMenu">
  3. <SiderBorderBg>
  4. <div class="close-btn" @click.stop="closeMenu"></div>
  5. <div class="menu-panel" @click.stop>
  6. <!-- 关键修改1:panel-header 从flex默认的justify-content:flex-start(已满足),但内层wrapper改为inline-flex -->
  7. <div class="panel-header">
  8. <template v-for="(menu, index) in currentParentRoute.children" :key="index">
  9. <div class="col-header-wrapper" v-if="!menu.hideMenu">
  10. <div class="col-header">
  11. <div class="col-header-inner">{{ menu.name }}</div>
  12. </div>
  13. <div class="col-arrow"></div>
  14. </div>
  15. </template>
  16. </div>
  17. <!-- 关键修改2:panel-body 改为inline-flex,取消flex:1均分,添加align-items:flex-start -->
  18. <div class="panel-body">
  19. <template v-for="(menu, index) in currentParentRoute.children" :key="index">
  20. <div class="menu-col" v-if="!menu.hideMenu">
  21. <div class="menu-col-bg">
  22. <template v-for="(childMenu, childIndex) in menu.children" :key="childIndex">
  23. <template v-if="!childMenu.hideMenu">
  24. <div v-if="childMenu['ver'] == 1" class="menu-item" @click.stop="handleMenuClick(childMenu)">{{ childMenu.name }}</div>
  25. <div v-else class="menu-item menu-item-disabled" @click.stop="handleMenuClick(childMenu)">{{ childMenu.name }}</div>
  26. </template>
  27. </template>
  28. </div>
  29. </div>
  30. </template>
  31. </div>
  32. <div class="panel-footer">
  33. <div class="tab-group">
  34. <template v-for="(programMenu, key) in menuModules" :key="key">
  35. <div
  36. v-if="!programMenu.title.startsWith('首页')"
  37. class="tab-btn"
  38. :class="{ 'tab-btn-active': currentParentRoute == programMenu }"
  39. @click.stop="selectMenu($event, programMenu)"
  40. >{{ programMenu.title }}</div
  41. >
  42. </template>
  43. </div>
  44. </div>
  45. </div>
  46. </SiderBorderBg>
  47. </div>
  48. <div v-else-if="isShowMenu == 0" class="menu-show-icon">
  49. <div class="icon" @click="openMenu"></div>
  50. </div>
  51. </template>
  52. <script lang="ts">
  53. import { defineComponent, nextTick, onMounted, ref, unref } from 'vue';
  54. import type { Menu } from '/@/router/types';
  55. import { SvgIcon } from '/@/components/Icon';
  56. import { getMenus } from '/@/router/menus';
  57. import { useGo } from '/@/hooks/web/usePage';
  58. import { useRouter } from 'vue-router';
  59. import { getActions } from '/@/qiankun/state';
  60. import { PageEnum } from '/@/enums/pageEnum';
  61. import { useGlobSetting } from '/@/hooks/setting';
  62. import { unmountMicroApps } from '/@/qiankun';
  63. import { useUserStoreWithOut } from '/@/store/modules/user';
  64. import { useAppStore } from '/@/store/modules/app';
  65. import { router } from '/@/router';
  66. import SiderBorderBg from '/@/components/vent/siderBorderBg.vue';
  67. export default defineComponent({
  68. name: 'BottomSider',
  69. components: { SvgIcon, SiderBorderBg },
  70. setup() {
  71. let menuModules = ref<Menu[]>([]);
  72. const actions = getActions();
  73. const currentParentRoute = ref<Menu>();
  74. const { currentRoute } = useRouter();
  75. const route = unref(currentRoute);
  76. const go = useGo();
  77. const glob = useGlobSetting();
  78. const isShowMenu = ref(route.path.startsWith('/cad-viewer') ? 1 : 0);
  79. const userStore = useUserStoreWithOut();
  80. const themeIcon = ref('styleTwo');
  81. function selectMenu(e: Event, programMenu) {
  82. e.stopPropagation();
  83. currentParentRoute.value = programMenu;
  84. }
  85. async function handleMenuClick(path: Menu) {
  86. if (path.path == currentRoute.value.fullPath) {
  87. return;
  88. }
  89. if (path.path.includes('sw/monitor-fanmain')) {
  90. var url = window.open('_blank') as Window;
  91. url.location = 'https://swkhmi.shendong.vip:9043/#SW_PW_NORTH';
  92. return;
  93. }
  94. if (path.path.includes('sw/forcFan')) {
  95. var url = window.open('_blank') as Window;
  96. url.location = 'https://swkhmi.shendong.vip:9043/#SW_CA';
  97. return;
  98. }
  99. if (path.path.includes('outlink/index')) {
  100. var url = window.open('_blank') as Window;
  101. url.location = path['frameSrc'];
  102. return;
  103. }
  104. go(path.path);
  105. isShowMenu.value = 0;
  106. }
  107. function geHome() {
  108. if (userStore.getUserInfo.homePath) {
  109. go(userStore.getUserInfo.homePath);
  110. } else if (currentRoute.value.path.startsWith('/micro-need-air')) {
  111. window.history.pushState({}, '', glob.homePath || PageEnum.BASE_HOME);
  112. } else {
  113. go(glob.homePath || PageEnum.BASE_HOME);
  114. }
  115. }
  116. function closeMenu(e?: Event) {
  117. e?.stopPropagation();
  118. isShowMenu.value = 0;
  119. document.removeEventListener('click', closeMenu);
  120. }
  121. function openMenu(e: Event) {
  122. e.stopPropagation();
  123. isShowMenu.value = -1;
  124. document.addEventListener('click', closeMenu);
  125. }
  126. onMounted(async () => {
  127. menuModules.value = await getMenus();
  128. const index = menuModules.value.findIndex((menu) => menu.children && menu.children.length > 0);
  129. currentParentRoute.value = menuModules.value[index];
  130. });
  131. return {
  132. themeIcon,
  133. menuModules,
  134. isShowMenu,
  135. handleMenuClick,
  136. openMenu,
  137. closeMenu,
  138. selectMenu,
  139. go,
  140. geHome,
  141. currentParentRoute,
  142. };
  143. },
  144. });
  145. </script>
  146. <style lang="less" scoped>
  147. @panel-bg: #091624;
  148. @panel-border: #1a7aaa;
  149. @accent: #00c8ff;
  150. @accent-dim: #1a8aaa;
  151. @header-bg: linear-gradient(180deg, #1b4e7a 0%, #0d3055 100%);
  152. @header-border: #2a7aaa;
  153. @item-bg: #071828;
  154. @item-border: #155a80;
  155. @item-text: #b0dcf0;
  156. @tab-active-bg: #00b8d9;
  157. @tab-active-text: #001f30;
  158. @white: #ffffff;
  159. @keyframes menuFadeIn {
  160. from {
  161. opacity: 0;
  162. }
  163. to {
  164. opacity: 1;
  165. }
  166. }
  167. @keyframes panelScaleIn {
  168. from {
  169. opacity: 0;
  170. transform: scale(0.96);
  171. }
  172. to {
  173. opacity: 1;
  174. transform: scale(1);
  175. }
  176. }
  177. .bottom-side {
  178. position: fixed;
  179. inset: 0;
  180. z-index: 99999;
  181. display: flex;
  182. align-items: center;
  183. justify-content: center;
  184. background: rgba(0, 8, 22, 0.7);
  185. backdrop-filter: blur(3px);
  186. color: #fff;
  187. animation: panelScaleIn 0.3s ease forwards;
  188. .menu-panel {
  189. position: relative;
  190. width: 92vw;
  191. max-width: 1440px;
  192. background: @panel-bg;
  193. display: flex;
  194. flex-direction: column;
  195. height: 70%;
  196. max-height: 70%;
  197. overflow: hidden;
  198. background: url(/@/assets/images//vent/sider/border.png) no-repeat;
  199. background-size: 100% 100%;
  200. }
  201. .side-bar {
  202. position: absolute;
  203. top: 12%;
  204. bottom: 12%;
  205. width: 3px;
  206. background: linear-gradient(180deg, transparent, @accent 25%, @accent 75%, transparent);
  207. z-index: 10;
  208. box-shadow: 0 0 6px @accent;
  209. &.side-bar-left {
  210. left: -2px;
  211. }
  212. &.side-bar-right {
  213. right: -2px;
  214. }
  215. }
  216. .close-btn {
  217. position: absolute;
  218. top: -18px;
  219. right: 0px;
  220. width: 22px;
  221. height: 22px;
  222. cursor: pointer;
  223. background: url(/@/assets/images//vent/sider/svg-close.svg) no-repeat;
  224. background-size: 100% 100%;
  225. }
  226. .panel-header {
  227. display: flex;
  228. align-items: center;
  229. justify-content: flex-start;
  230. padding: 0 24px;
  231. flex-wrap: nowrap;
  232. overflow-x: auto;
  233. overflow-y: hidden;
  234. position: relative;
  235. .col-header-wrapper {
  236. display: inline-flex;
  237. align-items: center;
  238. min-width: 100px;
  239. width: 175px;
  240. position: relative;
  241. justify-content: center;
  242. }
  243. .col-header {
  244. min-width: 100px;
  245. width: 100%;
  246. padding: 24px 12px 12px 12px;
  247. display: flex;
  248. flex-direction: column;
  249. align-items: center;
  250. justify-content: center;
  251. margin: 0;
  252. .col-header-inner {
  253. width: 100%;
  254. max-width: 135px;
  255. height: 60px;
  256. background: url(/@/assets/images//vent/sider/buttonTitle.png) no-repeat;
  257. background-size: 100% 100%;
  258. text-align: center;
  259. font-size: 13px;
  260. font-weight: 500;
  261. letter-spacing: 1px;
  262. white-space: nowrap;
  263. }
  264. }
  265. .col-arrow {
  266. width: 20px;
  267. height: 12px;
  268. position: absolute;
  269. right: -10px;
  270. top: 57%;
  271. transform: translateY(-50%);
  272. pointer-events: none;
  273. background: url(/@/assets/images//vent/sider/svg-arrow.png) no-repeat;
  274. background-size: 100% 100%;
  275. }
  276. .col-header-wrapper:last-of-type .col-arrow {
  277. display: none;
  278. }
  279. }
  280. .panel-body {
  281. display: inline-flex;
  282. align-items: flex-start;
  283. width: 100%;
  284. height: 100%;
  285. overflow-y: auto;
  286. overflow-x: auto;
  287. padding: 14px 24px 10px;
  288. // &::-webkit-scrollbar {
  289. // width: 2px;
  290. // height: 2px;
  291. // }
  292. // &::-webkit-scrollbar-track {
  293. // background: #071420;
  294. // }
  295. // &::-webkit-scrollbar-thumb {
  296. // background: @accent-dim;
  297. // border-radius: 2px;
  298. // }
  299. .menu-col {
  300. width: 175px;
  301. height: 100%;
  302. display: flex;
  303. flex-direction: column;
  304. align-items: center;
  305. }
  306. .menu-col-bg {
  307. display: flex;
  308. flex-direction: column;
  309. align-items: center;
  310. gap: 15px;
  311. height: 500px;
  312. width: 80%;
  313. max-width: 175px;
  314. max-height: 600px;
  315. background: url(/@/assets/images//vent/sider/menu-bg.png) no-repeat;
  316. background-size: 100% 100%;
  317. padding: 10px;
  318. overflow-y: auto;
  319. overflow-x: hidden;
  320. &::-webkit-scrollbar {
  321. width: 6px !important;
  322. border: 0;
  323. }
  324. // &::-webkit-scrollbar-track {
  325. // background: #071420;
  326. // }
  327. &::-webkit-scrollbar-thumb {
  328. // width: 1px !important;
  329. background: @accent-dim;
  330. }
  331. }
  332. .menu-item {
  333. width: 100%;
  334. max-width: 128px;
  335. min-height: 30px;
  336. padding: 5px 6px;
  337. text-align: center;
  338. background: url(/@/assets/images//vent/sider/buttonCont.png) no-repeat;
  339. background-size: 100% 100%;
  340. font-size: 12px;
  341. color: @item-text;
  342. cursor: pointer;
  343. transition: all 0.18s;
  344. line-height: 1.5;
  345. white-space: nowrap;
  346. overflow: hidden;
  347. text-overflow: ellipsis;
  348. &:hover {
  349. background: url(/@/assets/images//vent/sider/buttonCont-hover.png) no-repeat;
  350. background-size: 100% 100%;
  351. }
  352. }
  353. .menu-item-disabled {
  354. opacity: 0.45;
  355. cursor: default;
  356. background: #111a26;
  357. border-color: #2a3a4a;
  358. color: #6a8a9a;
  359. &:hover {
  360. background: #111a26;
  361. border-color: #2a3a4a;
  362. color: #6a8a9a;
  363. box-shadow: none;
  364. }
  365. }
  366. }
  367. .panel-footer {
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. padding: 10px 20px 0 20px;
  372. position: relative;
  373. flex-shrink: 0;
  374. .tab-group {
  375. width: 50%;
  376. height: 35px;
  377. display: flex;
  378. align-items: center;
  379. gap: 1px;
  380. background: url(/@/assets/images/vent/sider/border-bottom.png) no-repeat;
  381. background-size: 100% 100%;
  382. padding: 0 20px;
  383. }
  384. .tab-btn {
  385. width: 120px;
  386. height: 25px;
  387. color: @white;
  388. font-size: 13px;
  389. cursor: pointer;
  390. background: url(/@/assets/images/vent/sider/buttonBot.png) no-repeat;
  391. background-size: 100% 100%;
  392. white-space: nowrap;
  393. padding: 3px 5px 0 5px;
  394. margin-bottom: 10px;
  395. text-align: center;
  396. }
  397. .tab-btn-active {
  398. width: 120px;
  399. height: 35px;
  400. background: url(/@/assets/images/vent/sider/buttonBot-active.png) no-repeat;
  401. background-size: 105% 100%;
  402. font-weight: 500;
  403. margin: 0 0 4px -5px;
  404. }
  405. .setting-group {
  406. position: absolute;
  407. right: 20px;
  408. display: flex;
  409. align-items: center;
  410. gap: 10px;
  411. color: @accent-dim;
  412. .icon-style {
  413. cursor: pointer;
  414. transition: color 0.18s;
  415. &:hover {
  416. color: @accent;
  417. }
  418. }
  419. }
  420. }
  421. }
  422. .bottom-size-show {
  423. animation: menuFadeIn 0.3s ease forwards;
  424. }
  425. .menu-show-icon {
  426. position: fixed;
  427. bottom: 20px;
  428. left: 25px;
  429. z-index: 1000000;
  430. .icon {
  431. width: 60px;
  432. height: 60px;
  433. position: relative;
  434. &:before {
  435. content: '';
  436. display: block;
  437. width: 60px;
  438. height: 60px;
  439. position: absolute;
  440. background: url('/@/assets/images/vent/sider/icon-outer.png') no-repeat;
  441. background-size: 100% 100%;
  442. background-position: center;
  443. }
  444. &:after {
  445. content: '';
  446. display: block;
  447. width: 36px;
  448. height: 35px;
  449. position: absolute;
  450. top: 18%;
  451. right: 18%;
  452. background: url('/@/assets/images/vent/sider/icon-inner.svg') no-repeat;
  453. background-size: 100% 100%;
  454. background-position: center;
  455. animation-timing-function: ease-in;
  456. animation: fadenum 8s infinite;
  457. }
  458. @keyframes fadenum {
  459. 0% {
  460. transform: rotate(0deg);
  461. }
  462. 10% {
  463. transform: rotate(360deg);
  464. }
  465. 100% {
  466. transform: rotate(360deg);
  467. }
  468. }
  469. }
  470. }
  471. </style>