bottomSideder.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div v-if="isShowMenu == -1" class="bottom-side" :class="{ 'bottom-size-show': isShowMenu }">
  3. <div class="menu-container">
  4. <template v-for="(menu, index) in currentParentRoute.children" :key="index">
  5. <FourBorderBg class="four-border-bg" v-if="!menu.hideMenu">
  6. <div class="vent-flex-row" >
  7. <div class="parent-menu">
  8. {{ menu.name }}
  9. </div>
  10. <div class="vent-flex-row-wrap child-menu" >
  11. <template v-for="(childMenu, childIndex) in menu.children" :key="childIndex">
  12. <template v-if="!childMenu.hideMenu">
  13. <template v-if="childMenu['ver'] == 1">
  14. <div class="child-menu-item" @click="handleMenuClick(childMenu)">
  15. {{ childMenu.name }}
  16. </div>
  17. </template>
  18. <template v-else>
  19. <div class="child-menu-item-disabled" :style="{ backgroundColor: '#314671' }">
  20. {{ childMenu.name }}
  21. </div>
  22. </template>
  23. </template>
  24. </template>
  25. </div>
  26. </div>
  27. </FourBorderBg>
  28. </template>
  29. <div class="vent-flex-row-between menu-button-group">
  30. <div class="vent-flex-row program-group">
  31. <template v-for="(programMenu, key) in menuModules" :key="key">
  32. <div
  33. v-if="!programMenu.title.startsWith('首页')"
  34. class="program-menu"
  35. :class="{ 'program-menu-active': currentParentRoute == programMenu }"
  36. @click="selectMenu(programMenu)"
  37. >{{ programMenu.title }}</div
  38. >
  39. </template>
  40. </div>
  41. <div class="setting-group">
  42. <SvgIcon class="icon-style" size="18" name="home" @click="geHome" />
  43. <SvgIcon class="icon-style" size="18" name="fixed" />
  44. <SvgIcon class="icon-style" size="18" name="enter" @click="closeMenu"/>
  45. <!-- <SvgIcon class="icon-style" size="18" name="setting" />
  46. <SvgIcon class="icon-style" size="18" name="hidden" /> -->
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <div v-else-if="isShowMenu == 0" class="menu-show-icon">
  52. <div class="icon" @click="openMenu"></div>
  53. </div>
  54. <div v-else>4343434</div>
  55. </template>
  56. <script lang="ts">
  57. import { defineComponent, onMounted, ref, unref } from 'vue';
  58. import type { Menu } from '/@/router/types';
  59. import FourBorderBg from '/@/components/vent/fourBorderBg.vue';
  60. import { SvgIcon } from '/@/components/Icon';
  61. import { getMenus } from '/@/router/menus';
  62. import { useGo } from '/@/hooks/web/usePage';
  63. import { useRouter } from 'vue-router';
  64. import { getActions } from '/@/qiankun/state';
  65. export default defineComponent({
  66. name: 'BottomSider',
  67. components: { FourBorderBg, SvgIcon },
  68. setup() {
  69. const isShowMenu = ref(0);
  70. let menuModules = ref<Menu[]>([]);
  71. const router = useRouter();
  72. const actions = getActions();
  73. const currentParentRoute = ref<Menu>();
  74. const { currentRoute } = router;
  75. const route = unref(currentRoute);
  76. const go = useGo();
  77. function selectMenu(programMenu) {
  78. currentParentRoute.value = programMenu;
  79. }
  80. function handleMenuClick(path: Menu) {
  81. if (route.path.startsWith('/micro-')) {
  82. if (route.path.startsWith('/micro-vent-3dModal/dashboard/analysis')){
  83. if(!path.path.startsWith('/micro-vent-3dModal/dashboard/analysis')){
  84. // window.open(href, '_blank')
  85. router.replace(path.path)
  86. }else{
  87. const { query } = router.resolve(path.path)
  88. if(query){
  89. const { type, deviceType } = query
  90. if(type && deviceType)actions.setGlobalState({ pageObj: { pageType: type, deviceType } });
  91. }
  92. go(path.path);
  93. }
  94. }else {
  95. actions.setGlobalState({ pageObj: { pageType: 'home' } });
  96. // history.pushState({}, '', path.path);
  97. go(path.path);
  98. }
  99. } else {
  100. // micro-vent-3dModal
  101. if(route.path.startsWith('/subSysmodal/')) {
  102. router.replace('/micro-vent-3dModal' + path.path)
  103. }else{
  104. go(path.path);
  105. }
  106. }
  107. isShowMenu.value = 0;
  108. }
  109. function geHome() {
  110. isShowMenu.value = 0;
  111. go('/micro-vent-3dModal/dashboard/analysis')
  112. }
  113. function closeMenu() {
  114. isShowMenu.value = 0;
  115. // window.removeEventListener('click', closeMenu);
  116. };
  117. function openMenu() {
  118. isShowMenu.value = -1;
  119. // window.addEventListener('click', closeMenu, true);
  120. }
  121. onMounted(async () => {
  122. menuModules.value = await getMenus();
  123. currentParentRoute.value = menuModules.value[1];
  124. });
  125. return {
  126. menuModules,
  127. isShowMenu,
  128. handleMenuClick,
  129. openMenu,
  130. closeMenu,
  131. selectMenu,
  132. go,
  133. geHome,
  134. currentParentRoute,
  135. };
  136. },
  137. });
  138. </script>
  139. <style lang="less" scoped>
  140. @keyframes menuShow {
  141. 0% {
  142. width: 0;
  143. height: 0;
  144. }
  145. 100% {
  146. width: 480px;
  147. height: 100vh;
  148. }
  149. }
  150. .bottom-side {
  151. width: 480px;
  152. height: 100vh;
  153. position: fixed;
  154. bottom: 2px;
  155. left: 0px;
  156. z-index: 9999999;
  157. color: #fff;
  158. .menu-container {
  159. width: 480px;
  160. position: absolute;
  161. bottom: 0;
  162. // border: 1px solid #0099e6;
  163. // background-color: #06115a;
  164. border: 1px solid #0099e6;
  165. background-color: #0c1e2b;
  166. z-index: 999;
  167. // backdrop-filter: blur(8px);
  168. .four-border-bg {
  169. margin: 5px;
  170. background-color: #ffffff00;
  171. .main-container {
  172. background-color: #ffffff00 !important;
  173. box-shadow: 0 0 3px #ffffff33 inset;
  174. backdrop-filter: none !important;
  175. }
  176. .parent-menu {
  177. width: 110px;
  178. }
  179. .child-menu {
  180. width: 330px;
  181. font-size: 13px;
  182. }
  183. .child-menu-item {
  184. width: 100px;
  185. padding: 2px 0;
  186. // background-color: #086193;
  187. background: linear-gradient(#0d435d, #0e729d);
  188. border-radius: 2px;
  189. display: flex;
  190. align-items: center;
  191. justify-content: center;
  192. margin: 5px;
  193. cursor: pointer;
  194. box-shadow: 0 0 3px #ffffff22 inset;
  195. &:hover {
  196. background: linear-gradient(#1d89bf, #17aeee);
  197. }
  198. }
  199. .child-menu-item-disabled{
  200. width: 100px;
  201. padding: 2px 0;
  202. border-radius: 2px;
  203. display: flex;
  204. align-items: center;
  205. justify-content: center;
  206. margin: 5px;
  207. cursor: pointer;
  208. box-shadow: 0 0 3px #ffffff22 inset;
  209. background: linear-gradient(#7b7b7b, #6b6b6b);
  210. }
  211. }
  212. }
  213. .menu-button-group {
  214. margin: 5px 0;
  215. .program-menu {
  216. // width: 90px;
  217. padding: 1px 15px;
  218. background:linear-gradient(#217aa5, #0f4f75);
  219. margin-left: 5px;
  220. text-align: center;
  221. border-radius: 2px;
  222. cursor: pointer;
  223. &:hover {
  224. background: linear-gradient(#42b7ff, #1ca0d4);
  225. }
  226. }
  227. .program-menu-active {
  228. background: linear-gradient(#42adff, #1a8cbb);
  229. }
  230. .icon-style {
  231. margin-right: 10px;
  232. &:last-child {
  233. margin-right: 5px;
  234. }
  235. }
  236. }
  237. }
  238. .bottom-size-show {
  239. animation: menuShow 0.4s;
  240. animation-iteration-count: 1;
  241. animation-fill-mode: forwards;
  242. animation-timing-function: ease-in;
  243. /* Safari and Chrome */
  244. -webkit-animation: menuShow 0.4s;
  245. -webkit-animation-iteration-count: 1;
  246. -webkit-animation-fill-mode: forwards;
  247. -webkit-animation-timing-function: ease-in;
  248. }
  249. .menu-show-icon {
  250. position: fixed;
  251. bottom: 5px;
  252. left: 5px;
  253. z-index: 1000000;
  254. .icon {
  255. width: 60px;
  256. height: 60px;
  257. position: relative;
  258. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  259. background-position: center;
  260. &:before {
  261. content: '';
  262. display: block;
  263. width: 60px;
  264. height: 60px;
  265. position: absolute;
  266. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  267. background-position: center;
  268. }
  269. &:after {
  270. content: '';
  271. display: block;
  272. width: 60px;
  273. height: 60px;
  274. position: absolute;
  275. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  276. background-position: center;
  277. animation-timing-function: ease-in;
  278. animation: fadenum 8s infinite;
  279. }
  280. @keyframes fadenum {
  281. 0% {
  282. transform: rotate(0deg);
  283. }
  284. 10% {
  285. transform: rotate(360deg);
  286. }
  287. 100% {
  288. transform: rotate(360deg);
  289. }
  290. }
  291. }
  292. }
  293. </style>