bottomSideder.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. router.replace(path.path)
  88. } else {
  89. go(path.path);
  90. }
  91. }else {
  92. go(path.path);
  93. }
  94. } else {
  95. // micro-vent-3dModal
  96. if(route.path.startsWith('/subSysmodal/')) {
  97. router.replace('/micro-vent-3dModal' + path.path)
  98. }else if(path.path == '/sw/monitor-fanmain') {
  99. window.open('https://swkhmi.shendong.vip:9043/#SW_PW_NORTH', '_blank')
  100. }else{
  101. go(path.path);
  102. }
  103. }
  104. isShowMenu.value = 0;
  105. }
  106. function geHome() {
  107. isShowMenu.value = 0;
  108. if(route.path == glob.homePath || PageEnum.BASE_HOME){
  109. actions.setGlobalState({ pageObj: { pageType: 'home' } });
  110. go(glob.homePath || PageEnum.BASE_HOME)
  111. }else{
  112. go(glob.homePath || PageEnum.BASE_HOME)
  113. }
  114. }
  115. function closeMenu() {
  116. isShowMenu.value = 0;
  117. };
  118. function openMenu() {
  119. isShowMenu.value = -1;
  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. text-align: center;
  187. // background-color: #086193;
  188. background: linear-gradient(#0d435d, #0e729d);
  189. border-radius: 2px;
  190. display: flex;
  191. align-items: center;
  192. justify-content: center;
  193. margin: 5px;
  194. cursor: pointer;
  195. box-shadow: 0 0 3px #ffffff22 inset;
  196. &:hover {
  197. background: linear-gradient(#1d89bf, #17aeee);
  198. }
  199. }
  200. .child-menu-item-disabled{
  201. width: 100px;
  202. padding: 2px 0;
  203. border-radius: 2px;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. margin: 5px;
  208. cursor: pointer;
  209. box-shadow: 0 0 3px #ffffff22 inset;
  210. background: linear-gradient(#7b7b7b, #6b6b6b);
  211. }
  212. }
  213. }
  214. .menu-button-group {
  215. margin: 5px 0;
  216. .program-menu {
  217. // width: 90px;
  218. padding: 1px 15px;
  219. background:linear-gradient(#217aa5, #0f4f75);
  220. margin-left: 5px;
  221. text-align: center;
  222. border-radius: 2px;
  223. cursor: pointer;
  224. &:hover {
  225. background: linear-gradient(#42b7ff, #1ca0d4);
  226. }
  227. }
  228. .program-menu-active {
  229. background: linear-gradient(#42adff, #1a8cbb);
  230. }
  231. .icon-style {
  232. margin-right: 10px;
  233. &:last-child {
  234. margin-right: 5px;
  235. }
  236. }
  237. }
  238. }
  239. .bottom-size-show {
  240. animation: menuShow 0.4s;
  241. animation-iteration-count: 1;
  242. animation-fill-mode: forwards;
  243. animation-timing-function: ease-in;
  244. /* Safari and Chrome */
  245. -webkit-animation: menuShow 0.4s;
  246. -webkit-animation-iteration-count: 1;
  247. -webkit-animation-fill-mode: forwards;
  248. -webkit-animation-timing-function: ease-in;
  249. }
  250. .menu-show-icon {
  251. position: fixed;
  252. bottom: 5px;
  253. left: 5px;
  254. z-index: 1000000;
  255. .icon {
  256. width: 60px;
  257. height: 60px;
  258. position: relative;
  259. background-image: url('/@/assets/images/vent/bottom-icon/menu-icon-outer.png');
  260. background-position: center;
  261. &:before {
  262. content: '';
  263. display: block;
  264. width: 60px;
  265. height: 60px;
  266. position: absolute;
  267. background: url('/@/assets/images/vent/bottom-icon/menu-icon-inner.png') no-repeat;
  268. background-position: center;
  269. }
  270. &:after {
  271. content: '';
  272. display: block;
  273. width: 60px;
  274. height: 60px;
  275. position: absolute;
  276. background: url('/@/assets/images/vent/bottom-icon/menu-icon-center.png') no-repeat;
  277. background-position: center;
  278. animation-timing-function: ease-in;
  279. animation: fadenum 8s infinite;
  280. }
  281. @keyframes fadenum {
  282. 0% {
  283. transform: rotate(0deg);
  284. }
  285. 10% {
  286. transform: rotate(360deg);
  287. }
  288. 100% {
  289. transform: rotate(360deg);
  290. }
  291. }
  292. }
  293. }
  294. </style>