From b5b766487cfa2b4c9b7e511ccd84c3aa51281487 Mon Sep 17 00:00:00 2001
From: "Ray.Hao" <1490493387@qq.com>
Date: Fri, 23 May 2025 13:16:56 +0800
Subject: [PATCH] =?UTF-8?q?wip:=20=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../NavBar/components/NavbarActions.vue | 73 ++++++---
src/layout/components/NavBar/index.vue | 3 +
.../Sidebar/components/SidebarMixTopMenu.vue | 92 ++++++-----
.../components/LeftSideLayout/index.vue | 30 ++--
.../components/MixMenuLayout/index.vue | 143 ++++++++++++++++--
src/layouts/composables/useLayout.ts | 17 ++-
6 files changed, 274 insertions(+), 84 deletions(-)
diff --git a/src/layout/components/NavBar/components/NavbarActions.vue b/src/layout/components/NavBar/components/NavbarActions.vue
index aa06f578..e22cc39b 100644
--- a/src/layout/components/NavBar/components/NavbarActions.vue
+++ b/src/layout/components/NavBar/components/NavbarActions.vue
@@ -88,15 +88,27 @@ function handleProfileClick() {
// 根据主题和侧边栏配色方案选择样式类
const navbarActionsClass = computed(() => {
- // 暗黑主题
- if (settingStore.theme === ThemeMode.DARK) {
+ const { theme, sidebarColorScheme, layout } = settingStore;
+
+ // 暗黑主题下,所有布局都使用白色文字
+ if (theme === ThemeMode.DARK) {
return "navbar-actions--white-text";
}
- // 经典蓝侧边栏
- if (settingStore.sidebarColorScheme === SidebarColor.CLASSIC_BLUE) {
- return "navbar-actions--white-text";
+ // 明亮主题下
+ if (theme === ThemeMode.LIGHT) {
+ // 顶部布局和混合布局的顶部区域使用深色背景,需要白色文字
+ if (layout === "top" || layout === "mix") {
+ return "navbar-actions--white-text";
+ }
+
+ // 左侧布局下,如果侧边栏是经典蓝色,顶部导航栏仍使用默认颜色
+ if (layout === "left" && sidebarColorScheme === SidebarColor.CLASSIC_BLUE) {
+ return ""; // 使用默认的深色文字
+ }
}
+
+ return "";
});
/**
@@ -130,18 +142,21 @@ function logout() {
height: $navbar-height;
text-align: center;
cursor: pointer;
+ transition: all 0.3s;
+ // 默认图标样式(明亮模式 + 左侧布局)
:deep([class^="i-svg:"]) {
- color: var(--el-text-color);
-
- &:hover {
- color: var(--el-text-color-primary);
- }
+ font-size: 18px;
+ color: var(--el-text-color-regular);
+ transition: color 0.3s;
}
&:hover {
- color: var(--el-text-color-primary);
- background: rgb(0 0 0 / 10%);
+ background: rgba(0, 0, 0, 0.04);
+
+ :deep([class^="i-svg:"]) {
+ color: var(--el-color-primary);
+ }
}
}
@@ -160,19 +175,41 @@ function logout() {
&__name {
margin-left: 10px;
+ color: var(--el-text-color-regular);
+ transition: color 0.3s;
}
}
}
-.layout-top,
-.layout-mix {
+// 白色文字样式(用于深色背景:暗黑主题、顶部布局、混合布局)
+.navbar-actions--white-text {
+ .navbar-actions__item {
+ :deep([class^="i-svg:"]) {
+ color: rgba(255, 255, 255, 0.85);
+ }
+
+ &:hover {
+ background: rgba(255, 255, 255, 0.1);
+
+ :deep([class^="i-svg:"]) {
+ color: #fff;
+ }
+ }
+ }
+
.user-profile__name {
- color: #fff !important;
+ color: rgba(255, 255, 255, 0.85);
}
}
-.layout-top .navbar-actions--white-text :deep([class^="i-svg:"]),
-.layout-mix .navbar-actions--white-text :deep([class^="i-svg:"]) {
- color: #fff !important;
+// 确保下拉菜单中的图标不受影响
+:deep(.el-dropdown-menu) {
+ [class^="i-svg:"] {
+ color: var(--el-text-color-regular) !important;
+
+ &:hover {
+ color: var(--el-color-primary) !important;
+ }
+ }
}
diff --git a/src/layout/components/NavBar/index.vue b/src/layout/components/NavBar/index.vue
index d4d32c5b..b7b952f3 100644
--- a/src/layout/components/NavBar/index.vue
+++ b/src/layout/components/NavBar/index.vue
@@ -26,7 +26,10 @@ const isSidebarOpened = computed(() => appStore.sidebar.opened);
// 切换侧边栏展开/折叠状态
function toggleSideBar() {
+ console.log("🔄 Hamburger clicked! Current state:", isSidebarOpened.value);
+ console.log("🔄 Device type:", appStore.device);
appStore.toggleSidebar();
+ console.log("🔄 New state:", appStore.sidebar.opened);
}
diff --git a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue
index 2fd657d1..643d719e 100644
--- a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue
+++ b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue
@@ -1,42 +1,40 @@
-
-
-
-
-
-
-
-
-
-
- 首页
-
- {{ translateRouteTitle(route.meta.title) }}
-
+
+
+
+
+
+
+
+
-
-
-
+ 首页
+
+ {{ translateRouteTitle(route.meta.title) }}
+
+
+
+
+
+
diff --git a/src/layouts/components/LeftSideLayout/index.vue b/src/layouts/components/LeftSideLayout/index.vue
index 429f9eb6..fee1ebcf 100644
--- a/src/layouts/components/LeftSideLayout/index.vue
+++ b/src/layouts/components/LeftSideLayout/index.vue
@@ -35,10 +35,14 @@ import AppMain from "@/layout/components/AppMain/index.vue";
import SidebarMenu from "../LayoutMenu.vue";
// 布局相关参数
-const { isShowTagsView, isShowLogo, isSidebarOpen } = useLayout();
+const { isShowTagsView, isShowLogo, isSidebarOpen, isMobile } = useLayout();
// 菜单相关
const { routes } = useLayoutMenu();
+
+// 添加调试日志
+console.log("🔍 LeftSideLayout - isSidebarOpen:", isSidebarOpen.value);
+console.log("🔍 LeftSideLayout - isMobile:", isMobile.value);