|
@@ -0,0 +1,189 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="featureBox">
|
|
3
|
+ <el-menu
|
|
4
|
+ :collapse="isCollapse"
|
|
5
|
+ :default-active="activeMenu"
|
|
6
|
+ class="el-menu-vertical-demo dark-mode"
|
|
7
|
+ >
|
|
8
|
+ <template v-for="item in menuList" :key="item.key">
|
|
9
|
+ <el-sub-menu
|
|
10
|
+ class="menuBox"
|
|
11
|
+ :index="item.path"
|
|
12
|
+ v-if="item.children"
|
|
13
|
+ @mouseenter="
|
|
14
|
+ (el) => {
|
|
15
|
+ moveToMenu(el, item.icon);
|
|
16
|
+ }
|
|
17
|
+ "
|
|
18
|
+ @mouseleave="
|
|
19
|
+ (el) => {
|
|
20
|
+ leaveToMenu(el, item.icon);
|
|
21
|
+ }
|
|
22
|
+ "
|
|
23
|
+ >
|
|
24
|
+ <template #title>
|
|
25
|
+ <img :src="getUrl(item.icon)" alt="" />
|
|
26
|
+ <span>{{ item.name }}</span>
|
|
27
|
+ </template>
|
|
28
|
+ <el-menu-item
|
|
29
|
+ :index="son.path"
|
|
30
|
+ v-for="son in item.children"
|
|
31
|
+ @click="jumpModule(son.path)"
|
|
32
|
+ >
|
|
33
|
+ <template #title>
|
|
34
|
+ <span class="muneName">{{ son.name }}</span>
|
|
35
|
+ </template>
|
|
36
|
+ </el-menu-item>
|
|
37
|
+ </el-sub-menu>
|
|
38
|
+
|
|
39
|
+ <el-menu-item
|
|
40
|
+ v-else
|
|
41
|
+ :index="item.path"
|
|
42
|
+ @mouseenter="
|
|
43
|
+ (el) => {
|
|
44
|
+ moveToMenu(el, item.icon);
|
|
45
|
+ }
|
|
46
|
+ "
|
|
47
|
+ @mouseleave="
|
|
48
|
+ (el) => {
|
|
49
|
+ leaveToMenu(el, item.icon);
|
|
50
|
+ }
|
|
51
|
+ "
|
|
52
|
+ @click="jumpModule(item.path)"
|
|
53
|
+ >
|
|
54
|
+ <img :src="getUrl(item.icon)" alt="" />
|
|
55
|
+ <template #title>
|
|
56
|
+ <span class="muneName">{{ item.name }}</span>
|
|
57
|
+ </template>
|
|
58
|
+ </el-menu-item>
|
|
59
|
+ </template>
|
|
60
|
+ <slot />
|
|
61
|
+ </el-menu>
|
|
62
|
+ </div>
|
|
63
|
+</template>
|
|
64
|
+<script setup>
|
|
65
|
+import { ref, watch, reactive } from "vue";
|
|
66
|
+import { useRouter } from "vue-router";
|
|
67
|
+import "@/style/zwgk/menuModule.less";
|
|
68
|
+
|
|
69
|
+const router = useRouter();
|
|
70
|
+const activeMenu = ref("zfxxgkzn");
|
|
71
|
+
|
|
72
|
+const menuList = reactive([
|
|
73
|
+ {
|
|
74
|
+ path: "zfxxgkzn",
|
|
75
|
+ icon: "zfxxgkzn",
|
|
76
|
+ name: "政府信息公开指南",
|
|
77
|
+ },
|
|
78
|
+ {
|
|
79
|
+ path: "zfxxgkzd",
|
|
80
|
+ icon: "zfxxgkzd",
|
|
81
|
+ name: "政府信息公开制度",
|
|
82
|
+ },
|
|
83
|
+ {
|
|
84
|
+ path: "zfxxgknb",
|
|
85
|
+ icon: "zfxxgknb",
|
|
86
|
+ name: "政府信息公开年报",
|
|
87
|
+ },
|
|
88
|
+ {
|
|
89
|
+ path: "fdgknr",
|
|
90
|
+ icon: "fdgknr",
|
|
91
|
+ name: "法定公开内容",
|
|
92
|
+ children: [
|
|
93
|
+ {
|
|
94
|
+ path: "fdgknr/lzyj",
|
|
95
|
+ name: "履职依据",
|
|
96
|
+ },
|
|
97
|
+ {
|
|
98
|
+ path: "fdgknr/jgzz",
|
|
99
|
+ name: "机构职能",
|
|
100
|
+ },
|
|
101
|
+ {
|
|
102
|
+ path: "fdgknr/ldzc",
|
|
103
|
+ name: "领导之窗",
|
|
104
|
+ },
|
|
105
|
+ {
|
|
106
|
+ path: "fdgknr/zdgkwj",
|
|
107
|
+ name: "主动公开文件",
|
|
108
|
+ },
|
|
109
|
+ // {
|
|
110
|
+ // path: "fdgknr/xzcf",
|
|
111
|
+ // name: "行政处罚",
|
|
112
|
+ // },
|
|
113
|
+ // {
|
|
114
|
+ // path: "fdgknr/xzxk",
|
|
115
|
+ // name: "行政许可",
|
|
116
|
+ // },
|
|
117
|
+ {
|
|
118
|
+ path: "fdgknr/ghjh",
|
|
119
|
+ name: "规划计划",
|
|
120
|
+ },
|
|
121
|
+ {
|
|
122
|
+ path: "fdgknr/czys",
|
|
123
|
+ name: "财政预决算",
|
|
124
|
+ },
|
|
125
|
+ ],
|
|
126
|
+ },
|
|
127
|
+ {
|
|
128
|
+ path: "zcwj",
|
|
129
|
+ icon: "zcwj",
|
|
130
|
+ name: "政策文件",
|
|
131
|
+ },
|
|
132
|
+ {
|
|
133
|
+ path: "zcjd",
|
|
134
|
+ icon: "zcjd",
|
|
135
|
+ name: "政策解读",
|
|
136
|
+ },
|
|
137
|
+ {
|
|
138
|
+ path: "xzgfxwj",
|
|
139
|
+ icon: "xzgfxwj",
|
|
140
|
+ name: "行政规范性文件",
|
|
141
|
+ },
|
|
142
|
+ {
|
|
143
|
+ path: "ysqgk",
|
|
144
|
+ icon: "ysqgk",
|
|
145
|
+ name: "依申请公开",
|
|
146
|
+ },
|
|
147
|
+ {
|
|
148
|
+ path: "zfwzgznb",
|
|
149
|
+ icon: "zfwzgznb",
|
|
150
|
+ name: "政府网站工作年报",
|
|
151
|
+ },
|
|
152
|
+]);
|
|
153
|
+function jumpModule(path) {
|
|
154
|
+ activeMenu.value = path;
|
|
155
|
+ router.push("/zwgk/" + path);
|
|
156
|
+}
|
|
157
|
+function getUrl(name) {
|
|
158
|
+ if (name == activeMenu.value) {
|
|
159
|
+ name = name + "s";
|
|
160
|
+ }
|
|
161
|
+ return new URL(`../../../assets/hdjl/${name}.png`, import.meta.url).href;
|
|
162
|
+}
|
|
163
|
+// 鼠标移入菜单
|
|
164
|
+function moveToMenu(el, url) {
|
|
165
|
+ let urls = url + "s";
|
|
166
|
+ // 找到当前菜单项中的 img 元素
|
|
167
|
+ let imgElement = el.target.querySelector("img");
|
|
168
|
+ if (imgElement) {
|
|
169
|
+ imgElement.src = imgElement.src.replace(url, urls);
|
|
170
|
+ }
|
|
171
|
+}
|
|
172
|
+// 鼠标移出菜单
|
|
173
|
+function leaveToMenu(el, url) {
|
|
174
|
+ let urls = url + "s";
|
|
175
|
+ // 找到当前菜单项中的 img 元素
|
|
176
|
+ let imgElement = el.target.querySelector("img");
|
|
177
|
+ if (imgElement) {
|
|
178
|
+ imgElement.src = imgElement.src.replace(urls, url);
|
|
179
|
+ }
|
|
180
|
+}
|
|
181
|
+
|
|
182
|
+watch(
|
|
183
|
+ () => router.currentRoute.value.name,
|
|
184
|
+ (newValue) => {
|
|
185
|
+ activeMenu.value = newValue == "zwgk" ? "zfxxgkzn" : newValue;
|
|
186
|
+ },
|
|
187
|
+ { immediate: true }
|
|
188
|
+);
|
|
189
|
+</script>
|