11<template >
22 <div
3- class =" flex h-screen overflow-hidden flex-col transition-colors duration-300 lg:flex-row"
4- :class =" [isDarkMode ? 'bg-[#101012]' : 'bg-[#f5f5f7]']"
3+ class =" theme-page flex h-screen overflow-hidden flex-col transition-colors duration-300 lg:flex-row"
54 >
65 <!-- Sidebar -->
76 <aside
8- class =" fixed inset-y-0 left-0 z-50 flex h-full w-64 shrink-0 transform flex-col border-r lg:relative lg:h-screen lg:translate-x-0"
7+ class =" theme-surface fixed inset-y-0 left-0 z-50 flex h-full w-64 shrink-0 transform flex-col border-r shadow-[var(--shadow-sidebar)] backdrop-blur-2xl lg:relative lg:h-screen lg:translate-x-0"
98 :class =" [
10- isDarkMode
11- ? 'border-white/10 bg-zinc-900/80 backdrop-blur-2xl shadow-[12px_0_40px_-28px_rgba(255,255,255,0.18)]'
12- : 'border-white/80 bg-white/70 backdrop-blur-2xl shadow-[12px_0_40px_-28px_rgba(24,24,27,0.24)]',
139 isSidebarOpen ? 'translate-x-0' : '-translate-x-full',
1410 'transition-transform duration-300 ease-in-out lg:transition-none'
1511 ]"
1612 >
1713 <!-- Logo区域 -->
1814 <div
19- class =" flex h-16 shrink-0 items-center justify-between gap-3 border-b px-4"
20- :class =" [isDarkMode ? 'border-white/10' : 'border-zinc-200/70']"
15+ class =" theme-divider flex h-16 shrink-0 items-center justify-between gap-3 border-b px-4"
2116 >
2217 <div class =" flex min-w-0 items-center" >
2318 <div
24- class =" flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl transition-colors"
25- :class =" [isDarkMode ? 'bg-white/10 text-zinc-100' : 'bg-zinc-950 text-white']"
19+ class =" theme-brand flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl transition-colors"
2620 >
2721 <BoxIcon class="h-5 w-5 shrink-0" />
2822 </div >
2923 <h1
3024 @click =" router.push('/')"
31- class =" ml-2 min-w-0 truncate text-xl font-semibold cursor-pointer"
32- :class =" [isDarkMode ? 'text-white' : 'text-gray-800']"
25+ class =" theme-text-strong ml-2 min-w-0 truncate text-xl font-semibold cursor-pointer"
3326 >
3427 {{ t('common.appName') }}
3528 </h1 >
3629 </div >
3730 <button @click =" toggleSidebar" class =" shrink-0 lg:hidden" >
38- <XIcon class="w-6 h-6" : class = " [ isDarkMode ? ' text-gray-400 ' : ' text-gray-600 ' ] " />
31+ <XIcon class="theme-text-muted w-6 h-6" />
3932 </button >
4033 </div >
4134
4639 <RouterLink
4740 :to =" item .redirect "
4841 class="flex h-10 w-full items-center rounded-lg border-l-4 px-3 text-sm font-medium"
49- :class =" [
50- route .name === item .id
51- ? isDarkMode
52- ? ' border-zinc-200 bg-white/10 text-zinc-50 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]'
53- : ' border-zinc-900 bg-zinc-900/[0.06] text-zinc-950 shadow-sm'
54- : isDarkMode
55- ? ' border-transparent text-zinc-400 hover:bg-white/5 hover:text-zinc-100'
56- : ' border-transparent text-zinc-500 hover:bg-zinc-900/[0.04] hover:text-zinc-900'
57- ] "
42+ :class =" route .name === item .id ? ' theme-nav-item-active' : ' theme-nav-item' "
5843 >
5944 <component :is =" item.icon" class =" mr-3 h-5 w-5 shrink-0" />
6045 {{ item.name }}
6449 </nav >
6550
6651 <!-- 退出登录按钮 -->
67- <div class =" p-4 border-t" :class = " [isDarkMode ? 'border-white/10' : 'border-zinc-200/70'] " >
52+ <div class =" theme-divider p-4 border-t" >
6853 <button
6954 @click =" handleLogout"
70- class =" flex items-center w-full p-2 rounded-lg transition-colors duration-200"
71- :class =" [
72- isDarkMode
73- ? 'text-zinc-400 hover:bg-white/5 hover:text-white'
74- : 'text-zinc-500 hover:bg-zinc-900/[0.04] hover:text-zinc-950'
75- ]"
55+ class =" theme-icon-button flex items-center w-full p-2 rounded-lg transition-colors duration-200"
7656 >
7757 <LogOutIcon class="w-5 h-5 mr-3" />
7858 {{ t('admin.logout') }}
8464 <div class =" flex h-full min-h-0 min-w-0 flex-1 flex-col" >
8565 <!-- Header -->
8666 <header
87- class =" border-b transition-colors duration-300 h-16 backdrop-blur-xl"
88- :class =" [isDarkMode ? 'border-white/10 bg-zinc-900/70' : 'border-white/80 bg-white/60']"
67+ class =" theme-surface border-b transition-colors duration-300 h-16 backdrop-blur-xl"
8968 >
9069 <div class =" flex items-center justify-between h-16 px-4" >
9170 <button @click =" toggleSidebar" class =" lg:hidden" >
92- <MenuIcon class="w-6 h-6" : class = " [ isDarkMode ? ' text-gray-400 ' : ' text-gray-600 ' ] " />
71+ <MenuIcon class="theme-text-muted w-6 h-6" />
9372 </button >
9473 </div >
9574 </header >
9675
9776 <!-- Content -->
9877 <main
99- class =" min-h-0 flex-1 overflow-y-auto transition-colors duration-300 custom-scrollbar"
100- :class =" [isDarkMode ? 'bg-[#101012]' : 'bg-[#f5f5f7]']"
78+ class =" theme-page min-h-0 flex-1 overflow-y-auto transition-colors duration-300 custom-scrollbar"
10179 >
10280 <router-view />
10381 </main >
10684</template >
10785
10886<script setup lang="ts">
109- import { ref , inject , onMounted , onUnmounted } from ' vue'
87+ import { ref , onMounted , onUnmounted } from ' vue'
11088import {
11189 BoxIcon ,
11290 MenuIcon ,
@@ -131,7 +109,6 @@ interface MenuItem {
131109const router = useRouter ()
132110const route = useRoute ()
133111const { t } = useI18n ()
134- const isDarkMode = inject (' isDarkMode' )
135112const { verifySession, logout } = useAdminSession ()
136113const menuItems: MenuItem [] = [
137114 {
@@ -210,20 +187,12 @@ const handleLogout = async () => {
210187 left : 0 ;
211188 right : 0 ;
212189 bottom : 0 ;
213- background-color : #e5e7eb ;
190+ background-color : rgb ( var ( --color-surface-muted )) ;
214191 transition : 0.4s ;
215192}
216193
217- .dark .slider {
218- background-color : #4b5563 ;
219- }
220-
221194input :checked + .slider {
222- background-color : #18181b ;
223- }
224-
225- .dark input :checked + .slider {
226- background-color : #f4f4f5 ;
195+ background-color : rgb (var (--color-accent ));
227196}
228197
229198.slider :before {
@@ -233,14 +202,10 @@ input:checked + .slider {
233202 width : 26px ;
234203 left : 4px ;
235204 bottom : 4px ;
236- background-color : white ;
205+ background-color : rgb ( var ( --color-accent-contrast )) ;
237206 transition : 0.4s ;
238207}
239208
240- .dark .slider :before {
241- background-color : #e5e7eb ;
242- }
243-
244209.slider.round {
245210 border-radius : 34px ;
246211}
@@ -279,23 +244,13 @@ input:checked + .slider {
279244 }
280245
281246 &::-webkit-scrollbar-thumb {
282- background-color : #cbd5e0 ;
247+ background-color : rgb ( var ( --color-scrollbar )) ;
283248 border-radius : 3px ;
284249
285250 &:hover {
286- background-color: #a0aec0 ;
251+ background-color: rgb ( var ( --color-scrollbar-hover )) ;
287252 }
288253 }
289254}
290255
291- /* 暗黑模式下的滚动条样式 */
292- :global(.dark ) .custom-scrollbar {
293- &::-webkit-scrollbar-thumb {
294- background-color: #4a5568 ;
295-
296- &:hover {
297- background-color: #2d3748 ;
298- }
299- }
300- }
301256 </style >
0 commit comments