diff --git a/admin/client/src/layout/components/Navbar.vue b/admin/client/src/layout/components/Navbar.vue index 2534892..1fe9b16 100644 --- a/admin/client/src/layout/components/Navbar.vue +++ b/admin/client/src/layout/components/Navbar.vue @@ -36,6 +36,35 @@ + +
+
+
+ + 深色 +
+
+ + 橙色 +
+
+ + 浅白色 +
+
+
@@ -53,13 +82,17 @@ export default { ...mapGetters([ 'sidebar', 'avatar', - 'name' + 'name', + 'theme' ]) }, methods: { toggleSideBar() { this.$store.dispatch('app/toggleSideBar') }, + setTheme(theme) { + this.$store.dispatch('settings/setTheme', theme) + }, async logout() { await this.$store.dispatch('user/logout') this.$router.push(`/login?redirect=${this.$route.fullPath}`) @@ -150,5 +183,56 @@ export default { } } } + + .theme-switch-wrapper { + float: right; + height: 100%; + display: flex; + align-items: center; + margin-right: 10px; + + .theme-switch { + display: flex; + background: rgba(0, 0, 0, 0.05); + padding: 3px; + border-radius: 20px; + + .theme-item { + display: flex; + align-items: center; + padding: 4px 8px; + margin: 0 2px; + cursor: pointer; + border-radius: 16px; + font-size: 12px; + color: #606266; + transition: all 0.3s; + + &:hover { + background: rgba(0, 0, 0, 0.1); + color: #303133; + } + + &.active { + background: #fff; + color: #303133; + box-shadow: 0 2px 6px rgba(0,0,0,0.1); + font-weight: 500; + } + + .color-dot { + width: 8px; + height: 8px; + border-radius: 50%; + margin-right: 4px; + display: inline-block; + } + + .dark-dot { background: #1b2735; } + .orange-dot { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); } + .light-dot { background: #f0f2f5; border: 1px solid #ccc; } + } + } + } } diff --git a/admin/client/src/layout/components/Sidebar/Logo.vue b/admin/client/src/layout/components/Sidebar/Logo.vue index fc7e40a..95718c3 100644 --- a/admin/client/src/layout/components/Sidebar/Logo.vue +++ b/admin/client/src/layout/components/Sidebar/Logo.vue @@ -42,41 +42,41 @@ export default { } .sidebar-logo-container { - position: relative; - width: 100%; - height: 50px; - line-height: 50px; - background: #2b333e; - text-align: center; - overflow: hidden; - - & .sidebar-logo-link { - height: 100%; + position: relative; width: 100%; + height: 50px; + line-height: 50px; + background: var(--menuBg); + text-align: center; + overflow: hidden; - & .sidebar-logo { - width: 32px; - height: 32px; - vertical-align: middle; - margin-right: 12px; + & .sidebar-logo-link { + height: 100%; + width: 100%; + + & .sidebar-logo { + width: 32px; + height: 32px; + vertical-align: middle; + margin-right: 12px; + } + + & .sidebar-title { + display: inline-block; + margin: 0; + color: var(--menuText); + font-weight: 600; + line-height: 50px; + font-size: 14px; + font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif; + vertical-align: middle; + } } - & .sidebar-title { - display: inline-block; - margin: 0; - color: #fff; - font-weight: 600; - line-height: 50px; - font-size: 14px; - font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif; - vertical-align: middle; + &.collapse { + .sidebar-logo { + margin-right: 0px; + } } } - - &.collapse { - .sidebar-logo { - margin-right: 0px; - } - } -} diff --git a/admin/client/src/layout/components/Sidebar/index.vue b/admin/client/src/layout/components/Sidebar/index.vue index fb014a2..cf4ecfc 100644 --- a/admin/client/src/layout/components/Sidebar/index.vue +++ b/admin/client/src/layout/components/Sidebar/index.vue @@ -1,5 +1,5 @@