浏览代码

修改图标

chenghanbin 4 月之前
父节点
当前提交
d41813dd50
共有 5 个文件被更改,包括 217 次插入7 次删除
  1. 二进制
      src/assets/menu/nav3.png
  2. 二进制
      src/assets/menu/nav4.png
  3. 二进制
      src/assets/menu/nav5.png
  4. 28 7
      src/style/zwgk/menuModule.less
  5. 189 0
      src/views/zwgk/modules/menuModule copy.vue

二进制
src/assets/menu/nav3.png


二进制
src/assets/menu/nav4.png


二进制
src/assets/menu/nav5.png


+ 28 - 7
src/style/zwgk/menuModule.less

@@ -8,6 +8,7 @@
8 8
 
9 9
     .el-menu {
10 10
       border: none;
11
+
11 12
       .el-menu-item-group {
12 13
         height: 70px;
13 14
         text-align: center;
@@ -56,21 +57,38 @@
56 57
           word-wrap: break-word;
57 58
         }
58 59
       }
59
-      .is-active{
60
+
61
+      .is-active {
60 62
         background: #1b68c0;
61
-        .muneName{
63
+
64
+        .muneName {
62 65
           color: #fff;
63 66
         }
64 67
       }
65 68
 
66 69
       .menuBox {
67 70
         font-size: 23px;
71
+
68 72
         margin-bottom: 15px;
69
-        background: #f2f2f2;
70
-        border: 1px solid #ddd;
71 73
 
72
-        &:hover {
73
-          .el-sub-menu__title {
74
+        .el-sub-menu__title {
75
+          color: #fff;
76
+          height: 80px !important;
77
+          border-radius: 6px;
78
+          background: #f2f2f2;
79
+          border: 1px solid #ddd;
80
+        }
81
+
82
+        .el-menu-item {
83
+          width: 100%;
84
+          margin: 10px 0;
85
+          background: #FAFAFA;
86
+
87
+          .muneName {
88
+            width: 100%;
89
+          }
90
+
91
+          &:hover {
74 92
             color: #fff;
75 93
             background: #1b68c0;
76 94
           }
@@ -79,7 +97,10 @@
79 97
         .el-sub-menu__title {
80 98
           height: 70px;
81 99
           color: #1c68c0;
82
-
100
+          &:hover {
101
+            color: #fff;
102
+            background: #1b68c0;
103
+          }
83 104
           .el-icon {
84 105
             font-size: 22px;
85 106
           }

+ 189 - 0
src/views/zwgk/modules/menuModule copy.vue

@@ -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>