mirror of
https://github.com/vastsa/FileCodeBoxFronted.git
synced 2026-11-24 21:58:01 +08:00
fix: improve admin theme color adaptation
This commit is contained in:
1 parent
45ef99a336
commit
ce4af6678c
5 files changed
+157
-89
No files matched your search
+9
-7
@@ -85,11 +85,13 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.light {
|
||||
@apply bg-[#f5f5f7] text-zinc-900;
|
||||
background-color: rgb(var(--color-page));
|
||||
color: rgb(var(--color-text));
|
||||
}
|
||||
|
||||
.dark {
|
||||
@apply bg-zinc-950 text-zinc-100;
|
||||
background-color: rgb(var(--color-page));
|
||||
color: rgb(var(--color-text));
|
||||
}
|
||||
|
||||
.fade-enter-active,
|
||||
@@ -132,7 +134,7 @@ onMounted(() => {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
background-color: rgb(var(--color-overlay) / var(--loading-overlay-opacity));
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
@@ -140,10 +142,10 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 3px solid #fff;
|
||||
border-top: 3px solid #27272a;
|
||||
width: var(--spinner-size);
|
||||
height: var(--spinner-size);
|
||||
border: var(--spinner-border-width) solid rgb(var(--color-accent-contrast));
|
||||
border-top-color: rgb(var(--color-accent));
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,68 @@
|
||||
@import 'tailwindcss/components';
|
||||
@import 'tailwindcss/utilities';
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--color-page: 245 245 247;
|
||||
--color-surface: 255 255 255;
|
||||
--color-surface-raised: 255 255 255;
|
||||
--color-surface-muted: 244 244 245;
|
||||
--color-surface-input: 255 255 255;
|
||||
--color-text: 24 24 27;
|
||||
--color-text-strong: 9 9 11;
|
||||
--color-text-muted: 82 82 91;
|
||||
--color-text-subtle: 113 113 122;
|
||||
--color-border: 228 228 231;
|
||||
--color-border-strong: 161 161 170;
|
||||
--color-accent: 24 24 27;
|
||||
--color-accent-contrast: 255 255 255;
|
||||
--color-danger: 220 38 38;
|
||||
--color-warning: 217 119 6;
|
||||
--color-success: 4 120 87;
|
||||
--color-overlay: 9 9 11;
|
||||
--surface-glass: rgb(var(--color-surface) / 0.78);
|
||||
--surface-glass-strong: rgb(var(--color-surface) / 0.92);
|
||||
--border-glass: rgb(var(--color-border) / 0.85);
|
||||
--shadow-color: 24 24 27;
|
||||
--shadow-panel: 0 22px 54px -36px rgb(var(--shadow-color) / 0.28);
|
||||
--shadow-sidebar: 12px 0 40px -28px rgb(var(--shadow-color) / 0.24);
|
||||
--color-scrollbar: 161 161 170;
|
||||
--color-scrollbar-hover: 113 113 122;
|
||||
--color-focus-ring: 113 113 122;
|
||||
--loading-overlay-opacity: 0.5;
|
||||
--spinner-size: 50px;
|
||||
--spinner-border-width: 3px;
|
||||
}
|
||||
|
||||
:root.dark {
|
||||
color-scheme: dark;
|
||||
--color-page: 16 16 18;
|
||||
--color-surface: 24 24 27;
|
||||
--color-surface-raised: 39 39 42;
|
||||
--color-surface-muted: 39 39 42;
|
||||
--color-surface-input: 9 9 11;
|
||||
--color-text: 228 228 231;
|
||||
--color-text-strong: 250 250 250;
|
||||
--color-text-muted: 161 161 170;
|
||||
--color-text-subtle: 113 113 122;
|
||||
--color-border: 63 63 70;
|
||||
--color-border-strong: 113 113 122;
|
||||
--color-accent: 244 244 245;
|
||||
--color-accent-contrast: 9 9 11;
|
||||
--color-danger: 248 113 113;
|
||||
--color-warning: 251 191 36;
|
||||
--color-success: 52 211 153;
|
||||
--surface-glass: rgb(var(--color-surface) / 0.82);
|
||||
--surface-glass-strong: rgb(var(--color-surface) / 0.94);
|
||||
--border-glass: rgb(var(--color-border) / 0.7);
|
||||
--shadow-color: 255 255 255;
|
||||
--shadow-panel: 0 22px 54px -36px rgb(var(--shadow-color) / 0.2);
|
||||
--shadow-sidebar: 12px 0 40px -28px rgb(var(--shadow-color) / 0.18);
|
||||
--color-scrollbar: 82 82 91;
|
||||
--color-scrollbar-hover: 113 113 122;
|
||||
--color-focus-ring: 161 161 170;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'DingTalk';
|
||||
src: url('@/assets/font/DingTalk.ttf') format('truetype');
|
||||
@@ -10,4 +72,32 @@
|
||||
|
||||
body {
|
||||
font-family: 'DingTalk', sans-serif;
|
||||
background-color: rgb(var(--color-page));
|
||||
color: rgb(var(--color-text));
|
||||
}
|
||||
|
||||
::selection {
|
||||
background-color: rgb(var(--color-accent) / 0.16);
|
||||
}
|
||||
|
||||
@layer components {
|
||||
.theme-page { background-color: rgb(var(--color-page)); color: rgb(var(--color-text)); }
|
||||
.theme-surface { background: var(--surface-glass); border-color: var(--border-glass); }
|
||||
.theme-surface-strong { background: var(--surface-glass-strong); border-color: var(--border-glass); }
|
||||
.theme-panel { background: var(--surface-glass); border-color: var(--border-glass); box-shadow: var(--shadow-panel); }
|
||||
.theme-divider { border-color: rgb(var(--color-border) / 0.7); }
|
||||
.theme-text { color: rgb(var(--color-text)); }
|
||||
.theme-text-strong { color: rgb(var(--color-text-strong)); }
|
||||
.theme-text-muted { color: rgb(var(--color-text-muted)); }
|
||||
.theme-icon-button { color: rgb(var(--color-text-muted)); }
|
||||
.theme-icon-button:hover { background-color: rgb(var(--color-accent) / 0.08); color: rgb(var(--color-text-strong)); }
|
||||
.theme-brand { background-color: rgb(var(--color-accent)); color: rgb(var(--color-accent-contrast)); }
|
||||
.theme-nav-item { border-color: transparent; color: rgb(var(--color-text-muted)); }
|
||||
.theme-nav-item:hover { background-color: rgb(var(--color-accent) / 0.06); color: rgb(var(--color-text-strong)); }
|
||||
.theme-nav-item-active { border-color: rgb(var(--color-accent)); background-color: rgb(var(--color-accent) / 0.1); color: rgb(var(--color-text-strong)); }
|
||||
.theme-control { background-color: rgb(var(--color-surface-input) / 0.8); border-color: rgb(var(--color-border)); color: rgb(var(--color-text-strong)); }
|
||||
.theme-control::placeholder { color: rgb(var(--color-text-subtle)); }
|
||||
.theme-control:hover { border-color: rgb(var(--color-border-strong)); }
|
||||
.theme-control:focus { border-color: rgb(var(--color-focus-ring)); --tw-ring-color: rgb(var(--color-focus-ring) / 0.25); }
|
||||
.theme-warning { color: rgb(var(--color-warning)); }
|
||||
}
|
||||
@@ -1,41 +1,34 @@
|
||||
<template>
|
||||
<div
|
||||
class="flex h-screen overflow-hidden flex-col transition-colors duration-300 lg:flex-row"
|
||||
:class="[isDarkMode ? 'bg-[#101012]' : 'bg-[#f5f5f7]']"
|
||||
class="theme-page flex h-screen overflow-hidden flex-col transition-colors duration-300 lg:flex-row"
|
||||
>
|
||||
<!-- Sidebar -->
|
||||
<aside
|
||||
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"
|
||||
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"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'border-white/10 bg-zinc-900/80 backdrop-blur-2xl shadow-[12px_0_40px_-28px_rgba(255,255,255,0.18)]'
|
||||
: 'border-white/80 bg-white/70 backdrop-blur-2xl shadow-[12px_0_40px_-28px_rgba(24,24,27,0.24)]',
|
||||
isSidebarOpen ? 'translate-x-0' : '-translate-x-full',
|
||||
'transition-transform duration-300 ease-in-out lg:transition-none'
|
||||
]"
|
||||
>
|
||||
<!-- Logo区域 -->
|
||||
<div
|
||||
class="flex h-16 shrink-0 items-center justify-between gap-3 border-b px-4"
|
||||
:class="[isDarkMode ? 'border-white/10' : 'border-zinc-200/70']"
|
||||
class="theme-divider flex h-16 shrink-0 items-center justify-between gap-3 border-b px-4"
|
||||
>
|
||||
<div class="flex min-w-0 items-center">
|
||||
<div
|
||||
class="flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl transition-colors"
|
||||
:class="[isDarkMode ? 'bg-white/10 text-zinc-100' : 'bg-zinc-950 text-white']"
|
||||
class="theme-brand flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl transition-colors"
|
||||
>
|
||||
<BoxIcon class="h-5 w-5 shrink-0" />
|
||||
</div>
|
||||
<h1
|
||||
@click="router.push('/')"
|
||||
class="ml-2 min-w-0 truncate text-xl font-semibold cursor-pointer"
|
||||
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
|
||||
class="theme-text-strong ml-2 min-w-0 truncate text-xl font-semibold cursor-pointer"
|
||||
>
|
||||
{{ t('common.appName') }}
|
||||
</h1>
|
||||
</div>
|
||||
<button @click="toggleSidebar" class="shrink-0 lg:hidden">
|
||||
<XIcon class="w-6 h-6" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']" />
|
||||
<XIcon class="theme-text-muted w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -46,15 +39,7 @@
|
||||
<RouterLink
|
||||
:to="item.redirect"
|
||||
class="flex h-10 w-full items-center rounded-lg border-l-4 px-3 text-sm font-medium"
|
||||
:class="[
|
||||
route.name === item.id
|
||||
? isDarkMode
|
||||
? 'border-zinc-200 bg-white/10 text-zinc-50 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]'
|
||||
: 'border-zinc-900 bg-zinc-900/[0.06] text-zinc-950 shadow-sm'
|
||||
: isDarkMode
|
||||
? 'border-transparent text-zinc-400 hover:bg-white/5 hover:text-zinc-100'
|
||||
: 'border-transparent text-zinc-500 hover:bg-zinc-900/[0.04] hover:text-zinc-900'
|
||||
]"
|
||||
:class="route.name === item.id ? 'theme-nav-item-active' : 'theme-nav-item'"
|
||||
>
|
||||
<component :is="item.icon" class="mr-3 h-5 w-5 shrink-0" />
|
||||
{{ item.name }}
|
||||
@@ -64,15 +49,10 @@
|
||||
</nav>
|
||||
|
||||
<!-- 退出登录按钮 -->
|
||||
<div class="p-4 border-t" :class="[isDarkMode ? 'border-white/10' : 'border-zinc-200/70']">
|
||||
<div class="theme-divider p-4 border-t">
|
||||
<button
|
||||
@click="handleLogout"
|
||||
class="flex items-center w-full p-2 rounded-lg transition-colors duration-200"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'text-zinc-400 hover:bg-white/5 hover:text-white'
|
||||
: 'text-zinc-500 hover:bg-zinc-900/[0.04] hover:text-zinc-950'
|
||||
]"
|
||||
class="theme-icon-button flex items-center w-full p-2 rounded-lg transition-colors duration-200"
|
||||
>
|
||||
<LogOutIcon class="w-5 h-5 mr-3" />
|
||||
{{ t('admin.logout') }}
|
||||
@@ -84,20 +64,18 @@
|
||||
<div class="flex h-full min-h-0 min-w-0 flex-1 flex-col">
|
||||
<!-- Header -->
|
||||
<header
|
||||
class="border-b transition-colors duration-300 h-16 backdrop-blur-xl"
|
||||
:class="[isDarkMode ? 'border-white/10 bg-zinc-900/70' : 'border-white/80 bg-white/60']"
|
||||
class="theme-surface border-b transition-colors duration-300 h-16 backdrop-blur-xl"
|
||||
>
|
||||
<div class="flex items-center justify-between h-16 px-4">
|
||||
<button @click="toggleSidebar" class="lg:hidden">
|
||||
<MenuIcon class="w-6 h-6" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']" />
|
||||
<MenuIcon class="theme-text-muted w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Content -->
|
||||
<main
|
||||
class="min-h-0 flex-1 overflow-y-auto transition-colors duration-300 custom-scrollbar"
|
||||
:class="[isDarkMode ? 'bg-[#101012]' : 'bg-[#f5f5f7]']"
|
||||
class="theme-page min-h-0 flex-1 overflow-y-auto transition-colors duration-300 custom-scrollbar"
|
||||
>
|
||||
<router-view />
|
||||
</main>
|
||||
@@ -106,7 +84,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, inject, onMounted, onUnmounted } from 'vue'
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import {
|
||||
BoxIcon,
|
||||
MenuIcon,
|
||||
@@ -131,7 +109,6 @@ interface MenuItem {
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { t } = useI18n()
|
||||
const isDarkMode = inject('isDarkMode')
|
||||
const { verifySession, logout } = useAdminSession()
|
||||
const menuItems: MenuItem[] = [
|
||||
{
|
||||
@@ -210,20 +187,12 @@ const handleLogout = async () => {
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #e5e7eb;
|
||||
background-color: rgb(var(--color-surface-muted));
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
.dark .slider {
|
||||
background-color: #4b5563;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #18181b;
|
||||
}
|
||||
|
||||
.dark input:checked + .slider {
|
||||
background-color: #f4f4f5;
|
||||
background-color: rgb(var(--color-accent));
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
@@ -233,14 +202,10 @@ input:checked + .slider {
|
||||
width: 26px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
background-color: rgb(var(--color-accent-contrast));
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
.dark .slider:before {
|
||||
background-color: #e5e7eb;
|
||||
}
|
||||
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
@@ -279,23 +244,13 @@ input:checked + .slider {
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: #cbd5e0;
|
||||
background-color: rgb(var(--color-scrollbar));
|
||||
border-radius: 3px;
|
||||
|
||||
&:hover {
|
||||
background-color: #a0aec0;
|
||||
background-color: rgb(var(--color-scrollbar-hover));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 暗黑模式下的滚动条样式 */
|
||||
:global(.dark) .custom-scrollbar {
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: #4a5568;
|
||||
|
||||
&:hover {
|
||||
background-color: #2d3748;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -175,12 +175,12 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="rounded-lg p-5 shadow-sm" :class="[panelClass]">
|
||||
<section class="theme-text rounded-lg p-5 shadow-sm" :class="[panelClass]">
|
||||
<div class="mb-5">
|
||||
<h3 class="text-lg font-semibold" :class="[primaryTextClass]">
|
||||
<h3 class="theme-text-strong text-lg font-semibold">
|
||||
{{ t('admin.dashboard.storagePolicy') }}
|
||||
</h3>
|
||||
<p class="text-sm" :class="[mutedTextClass]">
|
||||
<p class="theme-text-muted text-sm">
|
||||
{{ t('admin.dashboard.storagePolicyDesc') }}
|
||||
</p>
|
||||
</div>
|
||||
@@ -203,15 +203,14 @@
|
||||
|
||||
<div class="mt-5">
|
||||
<div class="mb-2 flex items-center justify-between text-sm">
|
||||
<span :class="[mutedTextClass]">{{ t('admin.dashboard.todayCapacityReference') }}</span>
|
||||
<span :class="[primaryTextClass]">{{ dashboardData.todaySizeRatio }}%</span>
|
||||
<span class="theme-text-muted">{{ t('admin.dashboard.todayCapacityReference') }}</span>
|
||||
<span class="theme-text-strong">{{ dashboardData.todaySizeRatio }}%</span>
|
||||
</div>
|
||||
<div
|
||||
class="h-2 overflow-hidden rounded-full"
|
||||
:class="[isDarkMode ? 'bg-gray-700' : 'bg-gray-100']"
|
||||
class="h-2 overflow-hidden rounded-full bg-[rgb(var(--color-surface-muted))]"
|
||||
>
|
||||
<div
|
||||
class="h-full rounded-full bg-zinc-500"
|
||||
class="h-full rounded-full bg-[rgb(var(--color-accent))]"
|
||||
:style="{ width: `${dashboardData.todaySizeRatio}%` }"
|
||||
></div>
|
||||
</div>
|
||||
@@ -414,11 +413,11 @@ const PolicyRow = defineComponent({
|
||||
'div',
|
||||
{
|
||||
class:
|
||||
'flex items-center justify-between gap-4 border-b border-gray-200/60 pb-3 last:border-b-0 dark:border-gray-700'
|
||||
'theme-divider flex items-center justify-between gap-4 border-b pb-3 last:border-b-0'
|
||||
},
|
||||
[
|
||||
h('span', { class: 'text-sm text-gray-500 dark:text-gray-400' }, props.label),
|
||||
h('span', { class: 'text-sm font-medium text-gray-900 dark:text-white' }, props.value)
|
||||
h('span', { class: 'theme-text-muted text-sm' }, props.label),
|
||||
h('span', { class: 'theme-text-strong text-sm font-medium' }, props.value)
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -40,19 +40,18 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="p-6">
|
||||
<div class="settings-page p-6">
|
||||
<div
|
||||
class="sticky top-0 z-20 -mx-6 -mt-6 mb-6 border-b px-6 py-4 backdrop-blur"
|
||||
:class="[isDarkMode ? 'border-white/10 bg-[#101012]/85' : 'border-white/80 bg-white/70']"
|
||||
class="theme-surface sticky top-0 z-20 -mx-6 -mt-6 mb-6 border-b px-6 py-4 backdrop-blur"
|
||||
>
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold" :class="[isDarkMode ? 'text-white' : 'text-zinc-800']">
|
||||
<h2 class="theme-text-strong text-2xl font-bold">
|
||||
{{ t('admin.settings.title') }}
|
||||
</h2>
|
||||
<p
|
||||
class="mt-1 text-sm"
|
||||
:class="[isDirty ? 'text-amber-500' : isDarkMode ? 'text-zinc-400' : 'text-zinc-500']"
|
||||
:class="isDirty ? 'theme-warning' : 'theme-text-muted'"
|
||||
>
|
||||
{{
|
||||
isDirty ? t('manage.settings.unsavedChanges') : t('manage.settings.allChangesSaved')
|
||||
@@ -93,8 +92,7 @@ onMounted(() => {
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="space-y-6 rounded-2xl border p-6 shadow-sm backdrop-blur-xl"
|
||||
:class="[isDarkMode ? 'border-white/10 bg-white/[0.06]' : 'border-white/80 bg-white/70']"
|
||||
class="theme-panel space-y-6 rounded-2xl border p-6 backdrop-blur-xl"
|
||||
>
|
||||
<!-- 基本设置 -->
|
||||
<section class="space-y-4">
|
||||
@@ -857,4 +855,28 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
.settings-page :deep(input:not([type='checkbox'])),
|
||||
.settings-page :deep(select),
|
||||
.settings-page :deep(textarea) {
|
||||
background-color: rgb(var(--color-surface-input) / 0.8) !important;
|
||||
border-color: rgb(var(--color-border)) !important;
|
||||
color: rgb(var(--color-text-strong)) !important;
|
||||
}
|
||||
|
||||
.settings-page :deep(input::placeholder),
|
||||
.settings-page :deep(textarea::placeholder) {
|
||||
color: rgb(var(--color-text-subtle)) !important;
|
||||
}
|
||||
|
||||
.settings-page :deep(input:hover),
|
||||
.settings-page :deep(select:hover),
|
||||
.settings-page :deep(textarea:hover) {
|
||||
border-color: rgb(var(--color-border-strong)) !important;
|
||||
}
|
||||
|
||||
.settings-page :deep(label),
|
||||
.settings-page :deep(h3) {
|
||||
color: rgb(var(--color-text)) !important;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user