bottomSideder.vue 9.6 KB

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