bottomSideder.vue 9.3 KB

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