From e2949e6f0b35bf0dec3d0ed3df0f176c6e0b95cc Mon Sep 17 00:00:00 2001
From: birt <2499248221@qq.com>
Date: 星期日, 13 四月 2025 22:31:05 +0800
Subject: [PATCH] 123
---
zhitan-vue/src/assets/styles/sidebar.scss | 5 +-
zhitan-vue/src/layout/components/TagsView/index.vue | 2
zhitan-vue/src/store/modules/permission.js | 14 +++++++
zhitan-vue/src/layout/components/Sidebar/index.vue | 52 +++++++++++++++----------
zhitan-vue/src/layout/components/TagsView/ScrollPane.vue | 2
zhitan-vue/src/layout/index.vue | 5 +-
6 files changed, 53 insertions(+), 27 deletions(-)
diff --git a/zhitan-vue/src/assets/styles/sidebar.scss b/zhitan-vue/src/assets/styles/sidebar.scss
index 297e8e4..52245c0 100644
--- a/zhitan-vue/src/assets/styles/sidebar.scss
+++ b/zhitan-vue/src/assets/styles/sidebar.scss
@@ -13,6 +13,7 @@
.main-container {
+ background-color: #110f2e !important;
height: 100%;
transition: margin-left 0.28s;
margin-left: $base-sidebar-width;
@@ -28,7 +29,7 @@
transition: width 0.28s;
width: $base-sidebar-width !important;
background-color: $base-menu-background;
- height: 100%;
+ height: calc(100% - 60px) !important;
position: fixed;
top: 60px;
bottom: 0;
@@ -321,7 +322,7 @@
transition: width 0.28s;
width: $base-sidebar-width !important;
background-color: $base-menu-background;
- height: 100%;
+ height: calc(100% - 60px) !important;
position: fixed;
top: 60px;
bottom: 0;
diff --git a/zhitan-vue/src/layout/components/Sidebar/index.vue b/zhitan-vue/src/layout/components/Sidebar/index.vue
index fcb7d47..b0ee0d8 100644
--- a/zhitan-vue/src/layout/components/Sidebar/index.vue
+++ b/zhitan-vue/src/layout/components/Sidebar/index.vue
@@ -5,9 +5,8 @@
class="sidebar-container-wrapper"
>
<el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper" view-class="scrollbar-view">
- <!-- 棣栭〉鏃朵笉鏄剧ず浠讳綍鑿滃崟椤� -->
+ <!-- 濮嬬粓鏄剧ず鑿滃崟椤癸紝涓嶅啀鏍规嵁璺緞鍒ゆ柇 -->
<el-menu
- v-if="!isHomePage"
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="'transparent'"
@@ -18,15 +17,24 @@
mode="vertical"
class="custom-menu"
>
- <sidebar-item
- v-for="(route, index) in sidebarRouters"
- :key="route.path + index"
- :item="route"
- :base-path="route.path"
- />
+ <!-- 褰撳墠鏄椤电湅鏉垮瓙璺敱鏃讹紝娓叉煋涓撶敤璺敱 -->
+ <template v-if="isIndexSubRoute">
+ <sidebar-item
+ v-for="(route, index) in indexPageRouters"
+ :key="route.path + index"
+ :item="route"
+ :base-path="route.path"
+ />
+ </template>
+ <template v-else>
+ <sidebar-item
+ v-for="(route, index) in sidebarRouters"
+ :key="route.path + index"
+ :item="route"
+ :base-path="route.path"
+ />
+ </template>
</el-menu>
- <!-- 棣栭〉鏃剁殑绌虹櫧鍖哄煙 -->
- <div v-else class="home-empty-menu"></div>
</el-scrollbar>
<!-- 搴曢儴鐢ㄦ埛鍖哄煙 -->
@@ -95,19 +103,21 @@
const sidebarRouters = computed(() => permissionStore.sidebarRouters)
-// 鍒ゆ柇褰撳墠鏄惁涓洪椤�
-const isHomePage = computed(() => {
- return route.path === '/index' || route.path === '/' || route.fullPath.startsWith('/index')
+// 鍒ゆ柇褰撳墠鏄惁涓洪椤靛瓙璺敱(/index/index)
+const isIndexSubRoute = computed(() => {
+ return route.path === '/index/index'
})
-// 棣栭〉涓撶敤璺敱锛屽彧鏈夐椤典竴涓彍鍗曢」
-const homePageRouters = computed(() => {
- // 浠庡師濮嬭矾鐢变腑绛涢�夊嚭棣栭〉璺敱
- const homeRoute = sidebarRouters.value.find(route => {
- return route.children && route.children.find(child => child.path === '/index')
- })
-
- return homeRoute ? [homeRoute] : []
+// 鍒ゆ柇褰撳墠鏄惁涓轰富棣栭〉璺敱(/index鎴�/)
+const isMainIndexRoute = computed(() => {
+ return route.path === '/index' || route.path === '/'
+})
+
+// 棣栭〉涓撶敤璺敱锛岄椤电湅鏉跨浉鍏宠彍鍗�
+const indexPageRouters = computed(() => {
+ // 鏌ユ壘name涓篒ndex鐨勮矾鐢�
+ const indexRoute = sidebarRouters.value.find(route => route.name === 'Index')
+ return indexRoute ? [indexRoute] : []
})
const showLogo = computed(() => settingsStore.sidebarLogo)
diff --git a/zhitan-vue/src/layout/components/TagsView/ScrollPane.vue b/zhitan-vue/src/layout/components/TagsView/ScrollPane.vue
index 516b5d2..d7f58cc 100644
--- a/zhitan-vue/src/layout/components/TagsView/ScrollPane.vue
+++ b/zhitan-vue/src/layout/components/TagsView/ScrollPane.vue
@@ -99,7 +99,7 @@
bottom: 0px;
}
:deep(.el-scrollbar__wrap) {
- height: 39px;
+ height: 40px !important;
}
}
</style>
\ No newline at end of file
diff --git a/zhitan-vue/src/layout/components/TagsView/index.vue b/zhitan-vue/src/layout/components/TagsView/index.vue
index 2041c96..c7dcb73 100644
--- a/zhitan-vue/src/layout/components/TagsView/index.vue
+++ b/zhitan-vue/src/layout/components/TagsView/index.vue
@@ -234,7 +234,7 @@
<style lang="scss" scoped>
.themeDark {
.tags-view-container {
- height: 52px;
+ height: 40px;
width: 100%;
background: #1a235d;
// border-bottom: 1px solid #d8dce5;
diff --git a/zhitan-vue/src/layout/index.vue b/zhitan-vue/src/layout/index.vue
index 00a46f1..96046dc 100644
--- a/zhitan-vue/src/layout/index.vue
+++ b/zhitan-vue/src/layout/index.vue
@@ -134,10 +134,11 @@
// 缁勪欢鎸傝浇鏃讹紝纭繚棣栭〉渚ц竟鏍忕姸鎬佹纭�
onMounted(() => {
- // 濡傛灉褰撳墠鏄椤碉紝纭繚渚ц竟鏍忓彲瑙�
+ // 濡傛灉褰撳墠鏄椤靛瓙椤甸潰锛屽彧纭繚渚ц竟鏍忎笉琚殣钘忥紝浣嗕繚鎸佹姌鍙�/灞曞紑鐘舵�佷笉鍙�
if (route.path === '/index/index') {
+ // 鍙缃笉闅愯棌渚ц竟鏍忥紝浣嗕笉鏀瑰彉鍏跺睍寮�/鎶樺彔鐘舵��
appStore.toggleSideBarHide(false)
- appStore.sidebar.opened = true
+ // 涓嶅啀寮哄埗璁剧疆opened涓簍rue锛屼繚鎸佺敤鎴蜂箣鍓嶇殑璁剧疆
}
})
diff --git a/zhitan-vue/src/store/modules/permission.js b/zhitan-vue/src/store/modules/permission.js
index ca7e5a2..4eb8185 100644
--- a/zhitan-vue/src/store/modules/permission.js
+++ b/zhitan-vue/src/store/modules/permission.js
@@ -58,6 +58,20 @@
// 閬嶅巻鍚庡彴浼犳潵鐨勮矾鐢卞瓧绗︿覆锛岃浆鎹负缁勪欢瀵硅薄
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false, parentRoute = null) {
return asyncRouterMap.filter(route => {
+ // 涓嶅啀杩囨护鎺夐椤电湅鏉跨浉鍏宠矾鐢�
+ /*
+ // 杩囨护鎺夐椤电湅鏉跨浉鍏宠矾鐢�
+ if (route.name === 'Index' && route.meta && route.meta.title === '棣栭〉鐪嬫澘') {
+ return false;
+ }
+
+ // 濡傛灉鏄椤电湅鏉跨殑瀛愯彍鍗曪紝涔熻繃婊ゆ帀
+ if (route.path === '/index' || route.path === 'index' ||
+ (route.meta && route.meta.title === '棣栭〉鐪嬫澘')) {
+ return false;
+ }
+ */
+
// 璁剧疆鐖惰矾鐢卞紩鐢�
if (parentRoute) {
route.parent = parentRoute;
--
Gitblit v1.9.3