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 @@ + + + + + + + +