From 0bc7df816454853315ae524792fa44847a298b0a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 11 Nov 2024 18:33:11 +0800
Subject: [PATCH] home页layout相关

---
 src/views/first/components/mainMenu.vue |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 120 insertions(+), 0 deletions(-)

diff --git a/src/views/first/components/mainMenu.vue b/src/views/first/components/mainMenu.vue
new file mode 100644
index 0000000..b7b6024
--- /dev/null
+++ b/src/views/first/components/mainMenu.vue
@@ -0,0 +1,120 @@
+<template>
+  <div class="page-mode">
+    <div @mouseenter="item.childrenFlag = true" :class="{ active: currentUrl.indexOf(item.path) != -1 }"
+      @mouseleave="item.childrenFlag = false" @click="goToPath(item)" v-for="(item, index) in menuList" :key="index">
+      {{ item.menuName }}
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, watch } from 'vue'
+import { useRouter, useRoute } from 'vue-router'
+import { Search } from '@element-plus/icons-vue'
+import { getTime } from '@/utils/getTime.js'
+import { useRouterStore } from 'store/router'
+const store = useRouterStore()
+let router = useRouter()
+let currentUrl = ref('statistics')
+
+const menuList = ref(
+  [
+    {
+      menuName: '园区概况',
+      path: '/layout/first/survey'
+    },
+    {
+      menuName: '风险源',
+      path: '/layout/first/rs'
+    },
+    {
+      menuName: '应急空间',
+      path: '/layout/first/space'
+    },
+    {
+      menuName: '应急物资',
+      path: '/layout/first/supplies'
+    },
+    {
+      menuName: '三级防控',
+      path: '/layout/first/pac'
+    },
+    {
+      menuName: '救援队伍',
+      path: '/layout/first/rt'
+    },
+    {
+      menuName: '污染物处理',
+      path: '/layout/first/pd'
+    },
+  ]
+)
+
+const goToPath = (params) => {
+  if (params.children && params.children.length > 0) return
+
+  if (params.path) {
+    if (router.currentRoute.value.path == params.path) return
+
+    if (params.path == '/layout/first/supplies' || params.path == '/layout/first/rt') {
+      store.setLoadSingle(true)
+    } else {
+      store.setLoadSingle(false)
+    }
+    router.push(params.path)
+  } else {
+    params.childrenFlag = !params.childrenFlag
+  }
+}
+
+watch(
+  () => router.currentRoute.value,
+  (newValue, oldValue) => {
+
+    currentUrl.value = newValue.path
+
+  },
+  { immediate: true }
+)
+
+const userName = ref('管理员')
+</script>
+
+<style lang="scss" scoped>
+.page-mode {
+  position: absolute;
+  top: auto;
+  bottom: 55px;
+  left: 50%;
+  z-index: 99;
+  transform: translateX(-50%);
+  display: flex;
+  pointer-events: auto;
+
+  &>div {
+    background-image: url(/images/mode-tab.png);
+    background-size: cover;
+    width: 136px;
+    height: 50px;
+    font-size: 16px;
+    text-align: center;
+    font-weight: bold;
+    color: #BFD3E5;
+    line-height: 32px;
+    padding-top: 12px;
+    margin-right: -20px;
+    font-style: italic;
+    cursor: pointer;
+    box-sizing: border-box;
+
+    &:last-child {
+      margin-right: 0px;
+    }
+
+    &.active {
+      color: #F6FCFF;
+      background-image: url(/images/mode-tab-ac.png);
+    }
+  }
+}
+</style>

--
Gitblit v1.9.3