From 81533bbd9f97fed609e477db6f295ba009147d10 Mon Sep 17 00:00:00 2001 From: AdingApkgg Date: Thu, 20 Nov 2025 04:11:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=B8=8E=E7=BB=9F=E8=AE=A1=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 在 `App.vue` 中引入 `SettingsModal` 和 `StatsCorner` 组件,增强用户设置和统计信息的可视化。 * 更新 `TopToolbar` 组件,添加设置按钮以便用户快速访问设置。 * 在 `SearchHeader.vue` 中优化布局,提升视觉效果和用户体验。 --- src/App.vue | 30 ++++- src/components/SearchHeader.vue | 153 +++++++++++------------ src/components/SettingsModal.vue | 203 +++++++++++++++++++++++++++++++ src/components/StatsCorner.vue | 50 ++++++++ src/components/TopToolbar.vue | 48 ++++++++ 5 files changed, 398 insertions(+), 86 deletions(-) create mode 100644 src/components/SettingsModal.vue create mode 100644 src/components/StatsCorner.vue diff --git a/src/App.vue b/src/App.vue index dd3a7ca..e7d7630 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,12 +8,19 @@ />
- - + + + +
@@ -22,12 +29,14 @@ import { computed, onMounted, onUnmounted, ref } from "vue"; import { imageDB } from "@/utils/imageDB"; import { useSearchStore } from "@/stores/search"; +import StatsCorner from "@/components/StatsCorner.vue"; import TopToolbar from "@/components/TopToolbar.vue"; import SearchHeader from "@/components/SearchHeader.vue"; import SearchResults from "@/components/SearchResults.vue"; import FloatingButtons from "@/components/FloatingButtons.vue"; import CommentsModal from "@/components/CommentsModal.vue"; import VndbPanel from "@/components/VndbPanel.vue"; +import SettingsModal from "@/components/SettingsModal.vue"; const searchStore = useSearchStore(); const randomImageUrl = ref(""); @@ -38,6 +47,9 @@ const shuffledQueue = ref([]); let fetchInterval: number | null = null; let displayInterval: number | null = null; +// 设置模态框 +const isSettingsOpen = ref(false); + const MAX_CACHE_SIZE = 10000; // 最大缓存 10000 张图片 const CLEANUP_BATCH_SIZE = 2000; // 每次清理 2000 张 const FETCH_INTERVAL = 5000; // 5秒获取一次 @@ -368,6 +380,20 @@ onUnmounted(() => { // 关闭数据库连接 imageDB.close(); }); + +// 设置相关函数 +function openSettings() { + isSettingsOpen.value = true; +} + +function closeSettings() { + isSettingsOpen.value = false; +} + +function saveSettings(customApi: string) { + // 保存自定义 API 到 store + searchStore.setCustomApi(customApi); +} diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue new file mode 100644 index 0000000..8f7cbeb --- /dev/null +++ b/src/components/SettingsModal.vue @@ -0,0 +1,203 @@ + + + + + + diff --git a/src/components/StatsCorner.vue b/src/components/StatsCorner.vue new file mode 100644 index 0000000..c262b1e --- /dev/null +++ b/src/components/StatsCorner.vue @@ -0,0 +1,50 @@ + + + + + + diff --git a/src/components/TopToolbar.vue b/src/components/TopToolbar.vue index ea679ad..85be1c2 100644 --- a/src/components/TopToolbar.vue +++ b/src/components/TopToolbar.vue @@ -22,6 +22,26 @@ + + + + + + + +