From a59e026c97ae79a092f5e6c8a91d870e078c8d9d Mon Sep 17 00:00:00 2001 From: chaos-zhu Date: Sun, 14 Dec 2025 16:26:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/UploadArea.vue | 128 +++++++++++++++++++++------------- app/pages/index.vue | 4 +- 2 files changed, 80 insertions(+), 52 deletions(-) diff --git a/app/components/UploadArea.vue b/app/components/UploadArea.vue index 254ad6f..f3eac49 100644 --- a/app/components/UploadArea.vue +++ b/app/components/UploadArea.vue @@ -4,11 +4,13 @@
- - + +
+ + - - + + +
{ // 配置 const allowedFormats = ref(['jpeg', 'jpg', 'png', 'gif', 'webp', 'avif', 'svg', 'bmp', 'ico', 'apng', 'tiff', 'tif']) const maxFileSize = ref(10 * 1024 * 1024) // 10MB -const publicApiEnabled = ref(true) +// 初始值为 null,表示配置尚未加载 +const publicApiEnabled = ref(null) const defaultApiKey = ref('') // 计算是否禁用上传(未登录且公共上传已禁用) +// 配置未加载时(null),不显示禁用状态,避免闪烁 const isDisabled = computed(() => { - return !authStore.isAuthenticated && !publicApiEnabled.value + if (!configLoaded.value) return false + return !authStore.isAuthenticated && publicApiEnabled.value === false }) // 计算接受的文件类型 @@ -225,6 +250,9 @@ async function fetchConfig() { } } catch (error) { console.error('获取配置失败:', error) + } finally { + // 标记配置已加载完成 + configLoaded.value = true } } diff --git a/app/pages/index.vue b/app/pages/index.vue index d844527..01b3515 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -84,9 +84,9 @@ - +