<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/map/main/survey'
|
},
|
{
|
menuName: '风险源',
|
path: '/layout/map/main/rs'
|
},
|
{
|
menuName: '应急空间',
|
path: '/layout/map/main/space'
|
},
|
{
|
menuName: '应急物资',
|
path: '/layout/single/supplies'
|
},
|
{
|
menuName: '三级防控',
|
path: '/layout/map/main/pac'
|
},
|
{
|
menuName: '救援队伍',
|
path: '/layout/single/rt'
|
},
|
{
|
menuName: '突发事件模拟',
|
path: '/layout/map/main/pd'
|
},
|
{
|
menuName: '作战图',
|
path: '/layout/single/ochart'
|
},
|
]
|
)
|
|
const goToPath = (params) => {
|
if (params.children && params.children.length > 0) return
|
|
if (params.path) {
|
if (router.currentRoute.value.path == params.path) return
|
router.push({
|
path: 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>
|