Browse Source

路由优化

gzb
wangzhonglu 9 months ago
parent
commit
4708041583

+ 55
- 2
src/router/platform.js View File

@@ -1,6 +1,6 @@
1 1
 export default {
2 2
   path: "platform",
3
-  component: () => import("@/views/platform/index.vue"),
3
+  component: () => import("@/views/platformSection/index.vue"),
4 4
   name: "platform",
5 5
   meta: {
6 6
     keepAlive: true,
@@ -13,13 +13,66 @@ export default {
13 13
   children: [
14 14
     {
15 15
       path: "home",
16
-      component: () => import("@/views/platform/home/index.vue"),
16
+      component: () => import("@/views/platformSection/home/index.vue"),
17 17
       name: "home",
18 18
       meta: {
19 19
         keepAlive: true,
20 20
         isAuth: true,
21 21
         title: "平台管控-首页"
22 22
       }
23
+    },
24
+    {
25
+      path: "regionManage",
26
+      component: () =>
27
+        import("@/views/platformSection/regionManage/region/index.vue"),
28
+      name: "regionManage",
29
+      meta: {
30
+        keepAlive: true,
31
+        isAuth: true,
32
+        title: "平台管控-区域管理"
33
+      }
34
+    },
35
+    {
36
+      path: "admin",
37
+      component: () =>
38
+        import("@/views/platformSection/regionManage/admin/index.vue"),
39
+      name: "admin",
40
+      meta: {
41
+        keepAlive: true,
42
+        isAuth: true,
43
+        title: "平台管控-管理员"
44
+      }
45
+    },
46
+    {
47
+      path: "whitelistLibrary",
48
+      component: () =>
49
+        import("@/views/platformSection/networkManage/whitelistLibrary.vue"),
50
+      name: "whitelistLibrary",
51
+      meta: {
52
+        keepAlive: true,
53
+        isAuth: true,
54
+        title: "平台管控-白名单库"
55
+      }
56
+    },
57
+    {
58
+      path: "deviceExport",
59
+      component: () => import("@/views/platformSection/log/deviceExport.vue"),
60
+      name: "deviceExport",
61
+      meta: {
62
+        keepAlive: true,
63
+        isAuth: true,
64
+        title: "平台管控-设备导出"
65
+      }
66
+    },
67
+    {
68
+      path: "notice",
69
+      component: () => import("@/views/platformSection/notice/index.vue"),
70
+      name: "notice",
71
+      meta: {
72
+        keepAlive: true,
73
+        isAuth: true,
74
+        title: "平台管控-公告"
75
+      }
23 76
     }
24 77
   ]
25 78
 };

+ 2
- 2
src/router/region.js View File

@@ -1,6 +1,6 @@
1 1
 export default {
2 2
   path: "region",
3
-  component: () => import("@/views/region/index.vue"),
3
+  component: () => import("@/views/regionSection/index.vue"),
4 4
   name: "region",
5 5
   meta: {
6 6
     keepAlive: true,
@@ -13,7 +13,7 @@ export default {
13 13
   children: [
14 14
     {
15 15
       path: "home",
16
-      component: () => import("@/views/region/home/index.vue"),
16
+      component: () => import("@/views/regionSection/home/index.vue"),
17 17
       name: "home",
18 18
       meta: {
19 19
         keepAlive: true,

+ 0
- 16
src/views/platform/index.vue View File

@@ -1,16 +0,0 @@
1
-<template>
2
-  <div>
3
-    <router-view></router-view>
4
-  </div>
5
-</template>
6
-
7
-<script>
8
-export default {
9
-  data() {
10
-    return {};
11
-  },
12
-  methods: {}
13
-};
14
-</script>
15
-
16
-<style lang="less" scoped></style>

src/views/platform/admin/index.vue → src/views/platformSection/home/index.vue View File


+ 208
- 0
src/views/platformSection/index.vue View File

@@ -0,0 +1,208 @@
1
+<template>
2
+  <div class="section_root">
3
+    <div class="section_header">
4
+      <div class="module_list">
5
+        <router-link tag="div" to="/platform/home" class="module_item">
6
+          <span>首页</span>
7
+        </router-link>
8
+        <div
9
+          :class="[
10
+            'module_item drop_down',
11
+            platformManageSelected ? 'selected' : ''
12
+          ]"
13
+        >
14
+          <span class="module_title">区域管理</span>
15
+          <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
16
+          <div class="drop_down_list" v-if="routeDropdown">
17
+            <router-link
18
+              @click.native="routeDropdownChange()"
19
+              tag="div"
20
+              to="/platform/regionManage"
21
+              class="drop_down_list_item"
22
+              >区域管理</router-link
23
+            >
24
+            <router-link
25
+              @click.native="routeDropdownChange()"
26
+              tag="div"
27
+              to="/platform/admin"
28
+              class="drop_down_list_item"
29
+              >管理员</router-link
30
+            >
31
+          </div>
32
+        </div>
33
+        <div
34
+          :class="[
35
+            'module_item drop_down',
36
+            networkManageSelected ? 'selected' : ''
37
+          ]"
38
+        >
39
+          <span class="module_title">网络管理</span>
40
+          <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
41
+          <div class="drop_down_list" v-if="routeDropdown">
42
+            <router-link
43
+              @click.native="routeDropdownChange()"
44
+              tag="div"
45
+              to="/platform/whitelistLibrary"
46
+              class="drop_down_list_item"
47
+              >白名单库</router-link
48
+            >
49
+          </div>
50
+        </div>
51
+        <div
52
+          :class="[
53
+            'module_item drop_down',
54
+            logManageSelected ? 'selected' : ''
55
+          ]"
56
+        >
57
+          <span class="module_title">日志</span>
58
+          <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
59
+          <div class="drop_down_list" v-if="routeDropdown">
60
+            <router-link
61
+              @click.native="routeDropdownChange()"
62
+              tag="div"
63
+              to="/platform/deviceExport"
64
+              class="drop_down_list_item"
65
+              >设备导出</router-link
66
+            >
67
+          </div>
68
+        </div>
69
+        <router-link tag="div" to="/platform/notice" class="module_item">
70
+          <span>公告</span>
71
+        </router-link>
72
+      </div>
73
+    </div>
74
+    <div class="section_main">
75
+      <router-view></router-view>
76
+    </div>
77
+  </div>
78
+</template>
79
+
80
+<script>
81
+export default {
82
+  data() {
83
+    return {
84
+      routeDropdown: true
85
+    };
86
+  },
87
+  computed: {
88
+    // 区域管理路由选中
89
+    platformManageSelected() {
90
+      return (
91
+        this.$route.path.includes("/platform/regionManage") ||
92
+        this.$route.path.includes("/platform/admin")
93
+      );
94
+    },
95
+    // 网络管理路由选中
96
+    networkManageSelected() {
97
+      return this.$route.path.includes("/platform/whitelistLibrary");
98
+    },
99
+    // 日志路由选中
100
+    logManageSelected() {
101
+      return this.$route.path.includes("/platform/deviceExport");
102
+    }
103
+  },
104
+  methods: {
105
+    routeDropdownChange() {
106
+      this.routeDropdown = false;
107
+      setTimeout(() => {
108
+        this.routeDropdown = true;
109
+      }, 500);
110
+    }
111
+  }
112
+};
113
+</script>
114
+
115
+<style lang="less" scoped>
116
+.section_root {
117
+  width: 100%;
118
+  height: 100%;
119
+  overflow: auto;
120
+  .section_header {
121
+    display: flex;
122
+    justify-content: flex-start;
123
+    align-items: center;
124
+    margin: 10px 16px;
125
+    padding: 13px 20px;
126
+    border: 1px solid #e9f0f9;
127
+    border-radius: 15px;
128
+    background-color: #fff;
129
+    .module_list {
130
+      display: flex;
131
+      justify-content: flex-start;
132
+      align-items: center;
133
+      .module_item {
134
+        display: flex;
135
+        justify-content: center;
136
+        align-items: center;
137
+        margin-right: 16px;
138
+        padding: 6px 10px;
139
+        font-size: 16px;
140
+        line-height: 20px;
141
+        cursor: pointer;
142
+        &.drop_down {
143
+          position: relative;
144
+          cursor: default;
145
+          .drop_down_list {
146
+            display: none;
147
+            position: absolute;
148
+            top: 32px;
149
+            left: 0;
150
+            padding: 10px 0;
151
+            min-width: 100px;
152
+            color: #253a70;
153
+            font-size: 14px;
154
+            font-weight: normal;
155
+            border-radius: 4px;
156
+            background: #ffffff;
157
+            box-shadow: 0 8px 30px 0 #bcc9e380;
158
+            z-index: 999;
159
+            .drop_down_list_item {
160
+              margin: 0 6px;
161
+              padding: 0 10px;
162
+              white-space: nowrap;
163
+              line-height: 35px;
164
+              border-radius: 8px;
165
+              color: #798cb5;
166
+              cursor: pointer;
167
+              &.router-link-active,
168
+              &:hover {
169
+                color: #339dff;
170
+                background-color: #f3f4fc;
171
+              }
172
+            }
173
+          }
174
+          &:hover {
175
+            .drop_down_list {
176
+              display: block;
177
+            }
178
+          }
179
+        }
180
+        &.router-link-active,
181
+        &.selected {
182
+          background-color: #339dff;
183
+          color: #fff;
184
+          border-radius: 4px;
185
+        }
186
+        &:hover {
187
+          .arrow_dropdown {
188
+            transform: rotate(180deg);
189
+          }
190
+        }
191
+        .arrow_dropdown {
192
+          transition: all 0.2s ease-in-out;
193
+        }
194
+        .module_title {
195
+          margin-right: 4px;
196
+          line-height: 20px;
197
+        }
198
+      }
199
+    }
200
+  }
201
+  .section_main {
202
+    position: relative;
203
+    width: 100%;
204
+    height: calc(100% - 80px);
205
+    overflow: auto;
206
+  }
207
+}
208
+</style>

src/views/platform/home/index.vue → src/views/platformSection/log/deviceExport.vue View File


src/views/platform/log/index.vue → src/views/platformSection/networkManage/whitelistLibrary.vue View File


src/views/platform/networkManage/index.vue → src/views/platformSection/notice/index.vue View File


src/views/platform/notice/index.vue → src/views/platformSection/regionManage/admin/index.vue View File


src/views/platform/regionManage/index.vue → src/views/platformSection/regionManage/region/index.vue View File


src/views/region/admin/index.vue → src/views/regionSection/home/index.vue View File


+ 208
- 0
src/views/regionSection/index.vue View File

@@ -0,0 +1,208 @@
1
+<template>
2
+  <div class="section_root">
3
+    <div class="section_header">
4
+      <div class="module_list">
5
+        <router-link tag="div" to="/region/home" class="module_item">
6
+          <span>首页</span>
7
+        </router-link>
8
+        <div
9
+          :class="[
10
+            'module_item drop_down',
11
+            platformManageSelected ? 'selected' : ''
12
+          ]"
13
+        >
14
+          <span class="module_title">区域管理</span>
15
+          <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
16
+          <div class="drop_down_list" v-if="routeDropdown">
17
+            <router-link
18
+              @click.native="routeDropdownChange()"
19
+              tag="div"
20
+              to="/region/regionManage"
21
+              class="drop_down_list_item"
22
+              >区域管理</router-link
23
+            >
24
+            <router-link
25
+              @click.native="routeDropdownChange()"
26
+              tag="div"
27
+              to="/region/admin"
28
+              class="drop_down_list_item"
29
+              >管理员</router-link
30
+            >
31
+          </div>
32
+        </div>
33
+        <div
34
+          :class="[
35
+            'module_item drop_down',
36
+            networkManageSelected ? 'selected' : ''
37
+          ]"
38
+        >
39
+          <span class="module_title">网络管理</span>
40
+          <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
41
+          <div class="drop_down_list" v-if="routeDropdown">
42
+            <router-link
43
+              @click.native="routeDropdownChange()"
44
+              tag="div"
45
+              to="/region/whitelistLibrary"
46
+              class="drop_down_list_item"
47
+              >白名单库</router-link
48
+            >
49
+          </div>
50
+        </div>
51
+        <div
52
+          :class="[
53
+            'module_item drop_down',
54
+            logManageSelected ? 'selected' : ''
55
+          ]"
56
+        >
57
+          <span class="module_title">日志</span>
58
+          <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
59
+          <div class="drop_down_list" v-if="routeDropdown">
60
+            <router-link
61
+              @click.native="routeDropdownChange()"
62
+              tag="div"
63
+              to="/region/deviceExport"
64
+              class="drop_down_list_item"
65
+              >设备导出</router-link
66
+            >
67
+          </div>
68
+        </div>
69
+        <router-link tag="div" to="/region/notice" class="module_item">
70
+          <span>公告</span>
71
+        </router-link>
72
+      </div>
73
+    </div>
74
+    <div class="section_main">
75
+      <router-view></router-view>
76
+    </div>
77
+  </div>
78
+</template>
79
+
80
+<script>
81
+export default {
82
+  data() {
83
+    return {
84
+      routeDropdown: true
85
+    };
86
+  },
87
+  computed: {
88
+    // 区域管理路由选中
89
+    platformManageSelected() {
90
+      return (
91
+        this.$route.path.includes("/region/regionManage") ||
92
+        this.$route.path.includes("/region/admin")
93
+      );
94
+    },
95
+    // 网络管理路由选中
96
+    networkManageSelected() {
97
+      return this.$route.path.includes("/region/whitelistLibrary");
98
+    },
99
+    // 日志路由选中
100
+    logManageSelected() {
101
+      return this.$route.path.includes("/region/deviceExport");
102
+    }
103
+  },
104
+  methods: {
105
+    routeDropdownChange() {
106
+      this.routeDropdown = false;
107
+      setTimeout(() => {
108
+        this.routeDropdown = true;
109
+      }, 500);
110
+    }
111
+  }
112
+};
113
+</script>
114
+
115
+<style lang="less" scoped>
116
+.section_root {
117
+  width: 100%;
118
+  height: 100%;
119
+  overflow: auto;
120
+  .section_header {
121
+    display: flex;
122
+    justify-content: flex-start;
123
+    align-items: center;
124
+    margin: 10px 16px;
125
+    padding: 13px 20px;
126
+    border: 1px solid #e9f0f9;
127
+    border-radius: 15px;
128
+    background-color: #fff;
129
+    .module_list {
130
+      display: flex;
131
+      justify-content: flex-start;
132
+      align-items: center;
133
+      .module_item {
134
+        display: flex;
135
+        justify-content: center;
136
+        align-items: center;
137
+        margin-right: 16px;
138
+        padding: 6px 10px;
139
+        font-size: 16px;
140
+        line-height: 20px;
141
+        cursor: pointer;
142
+        &.drop_down {
143
+          position: relative;
144
+          cursor: default;
145
+          .drop_down_list {
146
+            display: none;
147
+            position: absolute;
148
+            top: 32px;
149
+            left: 0;
150
+            padding: 10px 0;
151
+            min-width: 100px;
152
+            color: #253a70;
153
+            font-size: 14px;
154
+            font-weight: normal;
155
+            border-radius: 4px;
156
+            background: #ffffff;
157
+            box-shadow: 0 8px 30px 0 #bcc9e380;
158
+            z-index: 999;
159
+            .drop_down_list_item {
160
+              margin: 0 6px;
161
+              padding: 0 10px;
162
+              white-space: nowrap;
163
+              line-height: 35px;
164
+              border-radius: 8px;
165
+              color: #798cb5;
166
+              cursor: pointer;
167
+              &.router-link-active,
168
+              &:hover {
169
+                color: #339dff;
170
+                background-color: #f3f4fc;
171
+              }
172
+            }
173
+          }
174
+          &:hover {
175
+            .drop_down_list {
176
+              display: block;
177
+            }
178
+          }
179
+        }
180
+        &.router-link-active,
181
+        &.selected {
182
+          background-color: #339dff;
183
+          color: #fff;
184
+          border-radius: 4px;
185
+        }
186
+        &:hover {
187
+          .arrow_dropdown {
188
+            transform: rotate(180deg);
189
+          }
190
+        }
191
+        .arrow_dropdown {
192
+          transition: all 0.2s ease-in-out;
193
+        }
194
+        .module_title {
195
+          margin-right: 4px;
196
+          line-height: 20px;
197
+        }
198
+      }
199
+    }
200
+  }
201
+  .section_main {
202
+    position: relative;
203
+    width: 100%;
204
+    height: calc(100% - 80px);
205
+    overflow: auto;
206
+  }
207
+}
208
+</style>

src/views/region/home/index.vue → src/views/regionSection/log/deviceExport.vue View File


src/views/region/index.vue → src/views/regionSection/networkManage/whitelistLibrary.vue View File


src/views/region/regionManage/index.vue → src/views/regionSection/notice/index.vue View File


src/views/region/schoolManage/index.vue → src/views/regionSection/regionManage/admin/index.vue View File


src/views/school/admin/index.vue → src/views/regionSection/regionManage/region/index.vue View File


src/views/school/home/index.vue → src/views/regionSection/regionManage/school/index.vue View File


src/views/school/index.vue → src/views/schoolSection/admin/index.vue View File


src/views/school/regionManage/index.vue → src/views/schoolSection/home/index.vue View File


+ 14
- 0
src/views/schoolSection/index.vue View File

@@ -0,0 +1,14 @@
1
+<template>
2
+  <div></div>
3
+</template>
4
+
5
+<script>
6
+export default {
7
+  data() {
8
+    return {};
9
+  },
10
+  methods: {}
11
+};
12
+</script>
13
+
14
+<style lang="less" scoped></style>

+ 14
- 0
src/views/schoolSection/regionManage/index.vue View File

@@ -0,0 +1,14 @@
1
+<template>
2
+  <div></div>
3
+</template>
4
+
5
+<script>
6
+export default {
7
+  data() {
8
+    return {};
9
+  },
10
+  methods: {}
11
+};
12
+</script>
13
+
14
+<style lang="less" scoped></style>

Loading…
Cancel
Save