1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
| <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'
| let router = useRouter()
| let currentUrl = ref('statistics')
|
| const menuList = ref(
| [
| {
| menuName: '园区概况',
| path: '/layout/survey'
| },
| {
| menuName: '固定风险源',
| path: '/layout/rs'
| },
| {
| menuName: '应急空间',
| path: '/layout/space'
| },
| {
| menuName: '应急物资',
| path: '/layout/supplies'
| },
| {
| menuName: '三级防控',
| path: '/layout/pac'
| },
| {
| menuName: '救援队伍',
| path: '/layout/rt'
| },
| ]
| )
|
| const goToPath = (params) => {
| if (params.children && params.children.length > 0) return
|
| if (params.path) {
| if (router.currentRoute.value.path == params.path) return
| 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: 150px;
| 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>
|
|