feat(theme): 移除首页主题切换按钮,恢复默认深色主题 ClassicDark
- 首页 index.vue:删除主题切换按钮 DOM、useTheme 引入及 handleToggleTheme 处理函数 - nuxt.config.ts:defaultTheme ClassicLight → ClassicDark;enabledThemes 恢复为 4 主题(System/ClassicDark/ClassicLight/ModernLight);x-default-theme meta 和防闪烁脚本回退值同步改为 ClassicDark - schema.ts / system-settings-defaults / site-config API / POST API / useSiteConfig:7 处主题默认配置全部从 ClassicLight/双浅色列表 同步改为 ClassicDark/四主题完整列表
This commit is contained in:
@@ -62,8 +62,8 @@ export const useSiteConfig = () => {
|
||||
enableReplayRequests: false,
|
||||
enableCollaborativeSubmission: true,
|
||||
enableSubmissionRemarks: false,
|
||||
defaultTheme: 'ClassicLight',
|
||||
enabledThemes: '["ClassicLight","ModernLight"]',
|
||||
defaultTheme: 'ClassicDark',
|
||||
enabledThemes: '["System","ClassicDark","ClassicLight","ModernLight"]',
|
||||
statisticsCode: '',
|
||||
statisticsCodeEnabled: false
|
||||
}
|
||||
|
||||
@@ -350,8 +350,8 @@ export const systemSettings = pgTable('SystemSettings', {
|
||||
autoBackupConfig: text('autoBackupConfig'),
|
||||
statisticsCode: text('statisticsCode'),
|
||||
statisticsCodeEnabled: boolean('statisticsCodeEnabled').default(false).notNull(),
|
||||
defaultTheme: text('defaultTheme').default('ClassicLight').notNull(),
|
||||
enabledThemes: text('enabledThemes').default('[\"ClassicLight\",\"ModernLight\"]').notNull(),
|
||||
defaultTheme: text('defaultTheme').default('ClassicDark').notNull(),
|
||||
enabledThemes: text('enabledThemes').default('[\"System\",\"ClassicDark\",\"ClassicLight\",\"ModernLight\"]').notNull(),
|
||||
enabledPlatforms: text('enabledPlatforms'),
|
||||
platformOrder: text('platformOrder'),
|
||||
});
|
||||
|
||||
@@ -33,18 +33,6 @@
|
||||
<!-- 用户信息区域 -->
|
||||
<div class="user-section">
|
||||
<ClientOnly>
|
||||
<!-- 主题切换按钮 -->
|
||||
<button
|
||||
class="utility-btn theme-toggle-btn"
|
||||
type="button"
|
||||
aria-label="主题"
|
||||
title="切换主题"
|
||||
@click="handleToggleTheme"
|
||||
>
|
||||
<Icon :name="isDark ? 'sun' : 'moon'" :size="18" />
|
||||
<span class="utility-btn-label">主题</span>
|
||||
</button>
|
||||
|
||||
<div v-if="isClientAuthenticated" class="user-info">
|
||||
<div class="user-details-desktop">
|
||||
<span class="user-name">{{ user?.name || '用户' }}</span>
|
||||
@@ -686,19 +674,12 @@ import ConfirmDialog from '~/components/UI/ConfirmDialog.vue'
|
||||
|
||||
import { useNotifications } from '~/composables/useNotifications'
|
||||
import { useSiteConfig } from '~/composables/useSiteConfig'
|
||||
import { useTheme } from '~/composables/useTheme'
|
||||
import CustomSelect from '~/components/UI/Common/CustomSelect.vue'
|
||||
|
||||
// 获取运行时配置
|
||||
const config = useRuntimeConfig()
|
||||
const router = useRouter()
|
||||
|
||||
// 主题
|
||||
const { isDark, toggleTheme } = useTheme()
|
||||
const handleToggleTheme = () => {
|
||||
toggleTheme()
|
||||
}
|
||||
|
||||
// 站点配置
|
||||
const {
|
||||
siteTitle,
|
||||
|
||||
+4
-4
@@ -156,8 +156,8 @@ export default defineNuxtConfig({
|
||||
themeColor: process.env.PWA_THEME_COLOR || '#111111'
|
||||
},
|
||||
// 主题配置
|
||||
defaultTheme: process.env.NUXT_PUBLIC_DEFAULT_THEME || 'ClassicLight',
|
||||
enabledThemes: (process.env.NUXT_PUBLIC_ENABLED_THEMES || 'ClassicLight,ModernLight')
|
||||
defaultTheme: process.env.NUXT_PUBLIC_DEFAULT_THEME || 'ClassicDark',
|
||||
enabledThemes: (process.env.NUXT_PUBLIC_ENABLED_THEMES || 'System,ClassicDark,ClassicLight,ModernLight')
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean),
|
||||
@@ -192,7 +192,7 @@ export default defineNuxtConfig({
|
||||
{ name: 'theme-color', content: '#111111' },
|
||||
{
|
||||
name: 'x-default-theme',
|
||||
content: process.env.NUXT_PUBLIC_DEFAULT_THEME || 'ClassicLight'
|
||||
content: process.env.NUXT_PUBLIC_DEFAULT_THEME || 'ClassicDark'
|
||||
},
|
||||
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
|
||||
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' },
|
||||
@@ -213,7 +213,7 @@ export default defineNuxtConfig({
|
||||
` var meta=document.querySelector('meta[name="x-default-theme"]');`,
|
||||
` if(meta && meta.content){s=meta.content}`,
|
||||
` }catch(e){s=null}`,
|
||||
` if(!s){s='ClassicLight'}`,
|
||||
` if(!s){s='ClassicDark'}`,
|
||||
` }`,
|
||||
` if(s==='System'||s==='system'){eff=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}`,
|
||||
` else if(typeof s==='string'){eff=s.endsWith('Dark')||s==='dark'?'dark':(s.endsWith('Light')||s==='light'?'light':s)}`,
|
||||
|
||||
@@ -833,8 +833,8 @@ export default defineEventHandler(async (event) => {
|
||||
autoBackupIntervalHours: 24,
|
||||
autoBackupRetentionDays: 30,
|
||||
statisticsCodeEnabled: false,
|
||||
defaultTheme: 'ClassicLight',
|
||||
enabledThemes: '["ClassicLight","ModernLight"]'
|
||||
defaultTheme: 'ClassicDark',
|
||||
enabledThemes: '["System","ClassicDark","ClassicLight","ModernLight"]'
|
||||
} as const
|
||||
|
||||
// 获取当前设置,如果不存在则创建
|
||||
|
||||
@@ -90,8 +90,8 @@ export default defineEventHandler(async (event) => {
|
||||
forceBlockAllRequests: false,
|
||||
enableReplayRequests: false,
|
||||
smtpEnabled: false,
|
||||
defaultTheme: 'ClassicLight',
|
||||
enabledThemes: '["ClassicLight","ModernLight"]',
|
||||
defaultTheme: 'ClassicDark',
|
||||
enabledThemes: '["System","ClassicDark","ClassicLight","ModernLight"]',
|
||||
scheduleDaysBeforeEnabled: false,
|
||||
scheduleDaysBefore: 30,
|
||||
scheduleDaysAfterEnabled: false,
|
||||
|
||||
@@ -68,6 +68,6 @@ export const SYSTEM_SETTINGS_DEFAULTS = {
|
||||
autoBackupRetentionDays: 30,
|
||||
statisticsCode: '',
|
||||
statisticsCodeEnabled: false,
|
||||
defaultTheme: 'ClassicLight',
|
||||
enabledThemes: '["ClassicLight","ModernLight"]'
|
||||
defaultTheme: 'ClassicDark',
|
||||
enabledThemes: '["System","ClassicDark","ClassicLight","ModernLight"]'
|
||||
} as const
|
||||
|
||||
Reference in New Issue
Block a user