diff --git a/src/@core/components/ThemeSwitcher.vue b/src/@core/components/ThemeSwitcher.vue
index c21a2511..06df70b5 100644
--- a/src/@core/components/ThemeSwitcher.vue
+++ b/src/@core/components/ThemeSwitcher.vue
@@ -195,11 +195,10 @@ onMounted(() => {
-
+
-
{
}
.theme-switcher-options {
- max-block-size: 300px;
- overflow-y: auto;
+ overflow-y: hidden;
}
.theme-option {
diff --git a/src/App.vue b/src/App.vue
index 011e1f64..58f02c65 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,6 +2,7 @@
import { useTheme } from 'vuetify'
import { checkPrefersColorSchemeIsDark } from '@/@core/utils'
import { ensureRenderComplete, removeEl } from './@core/utils/dom'
+import api from '@/api'
// 生效主题
const { global: globalTheme } = useTheme()
@@ -9,9 +10,61 @@ let themeValue = localStorage.getItem('theme') || 'light'
const autoTheme = checkPrefersColorSchemeIsDark() ? 'dark' : 'light'
globalTheme.name.value = themeValue === 'auto' ? autoTheme : themeValue
+// 更新data-theme属性以便CSS选择器能正确匹配
+function updateHtmlThemeAttribute(themeName) {
+ document.documentElement.setAttribute('data-theme', themeName)
+ // 确保body元素也有相同的主题属性,以便更好地选择弹出窗口
+ document.body.setAttribute('data-theme', themeName)
+}
+
// 显示状态
const show = ref(false)
+// 背景图片
+const backgroundImages = ref([])
+const activeImageIndex = ref(0)
+const isTransparentTheme = computed(() => globalTheme.name.value === 'transparent')
+let backgroundRotationTimer: NodeJS.Timeout | null = null
+
+// 获取背景图片
+async function fetchBackgroundImages() {
+ try {
+ backgroundImages.value = await api.get('/login/wallpapers')
+ console.log('获取背景图片成功:', backgroundImages.value)
+ } catch (e) {
+ console.error('获取背景图片失败:', e)
+ }
+}
+
+// 开始背景图片轮换
+function startBackgroundRotation() {
+ if (backgroundRotationTimer) clearInterval(backgroundRotationTimer)
+
+ if (backgroundImages.value.length > 1) {
+ backgroundRotationTimer = setInterval(() => {
+ activeImageIndex.value = (activeImageIndex.value + 1) % backgroundImages.value.length
+ }, 10000) // 每10秒切换一次
+ }
+}
+
+// 监听主题变化
+watch(
+ () => globalTheme.name.value,
+ async newTheme => {
+ // 更新HTML属性
+ updateHtmlThemeAttribute(newTheme)
+
+ if (newTheme === 'transparent' && backgroundImages.value.length === 0) {
+ await fetchBackgroundImages()
+ startBackgroundRotation()
+ } else if (newTheme !== 'transparent' && backgroundRotationTimer) {
+ clearInterval(backgroundRotationTimer)
+ backgroundRotationTimer = null
+ }
+ },
+ { immediate: true },
+)
+
// ApexCharts 全局配置
declare global {
interface Window {
@@ -43,6 +96,9 @@ if (window.Apex) {
}
onMounted(() => {
+ // 初始化data-theme属性
+ updateHtmlThemeAttribute(globalTheme.name.value)
+
ensureRenderComplete(() => {
nextTick(() => {
setTimeout(() => {
@@ -56,10 +112,92 @@ onMounted(() => {
})
})
})
+
+onUnmounted(() => {
+ if (backgroundRotationTimer) {
+ clearInterval(backgroundRotationTimer)
+ backgroundRotationTimer = null
+ }
+})
-
-
-
+
+
+
diff --git a/src/components/dialog/AddDownloadDialog.vue b/src/components/dialog/AddDownloadDialog.vue
index 11a63f99..c6f9ea65 100644
--- a/src/components/dialog/AddDownloadDialog.vue
+++ b/src/components/dialog/AddDownloadDialog.vue
@@ -120,7 +120,7 @@ onMounted(() => {
-
+
{{ torrent?.site_name }} - {{ title }}
确认下载
diff --git a/src/layouts/components/HeaderTab.vue b/src/layouts/components/HeaderTab.vue
index 436ad2ec..1323c37a 100644
--- a/src/layouts/components/HeaderTab.vue
+++ b/src/layouts/components/HeaderTab.vue
@@ -70,7 +70,7 @@ onUnmounted(() => {
})
-