From f3fe7d4f2df5cb3453fd52b40087d23e6925987f Mon Sep 17 00:00:00 2001 From: congsh Date: Fri, 24 Apr 2026 14:29:32 +0800 Subject: [PATCH] fix: PNG cover 404 via nginx + clear upload residual after submit - Fix UAT nginx static cache rule intercepting /api/files/*.png requests, use negative lookahead to exclude /api/ paths (same as Dev config) - Clear el-upload file list after successful game creation to prevent residual file path showing in next upload Co-Authored-By: Claude Opus 4.7 --- frontend/nginx.uat.conf | 4 ++-- frontend/src/components/game/AddGameDialog.vue | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/nginx.uat.conf b/frontend/nginx.uat.conf index fb55ea6..7e422b5 100644 --- a/frontend/nginx.uat.conf +++ b/frontend/nginx.uat.conf @@ -60,8 +60,8 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } - # 静态资源缓存 - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + # 静态资源缓存(排除 /api/ 路径,避免拦截 PB 文件请求) + location ~* ^/(?!api/|voice-api/).*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp)$ { expires 1y; add_header Cache-Control "public, immutable"; } diff --git a/frontend/src/components/game/AddGameDialog.vue b/frontend/src/components/game/AddGameDialog.vue index 4b3588c..9347764 100644 --- a/frontend/src/components/game/AddGameDialog.vue +++ b/frontend/src/components/game/AddGameDialog.vue @@ -5,7 +5,7 @@ import type { GamePlatform } from '@/types' import { ElMessage } from 'element-plus' import { getAllPlatforms } from '@/api/games' import { Plus } from '@element-plus/icons-vue' -import type { UploadFile } from 'element-plus' +import type { UploadFile, UploadInstance } from 'element-plus' const props = defineProps<{ modelValue: boolean @@ -27,6 +27,7 @@ const platform = ref('') const tagsInput = ref('') const coverFile = ref(null) const coverPreview = ref('') +const uploadRef = ref() const loading = ref(false) const platforms = getAllPlatforms() @@ -62,6 +63,7 @@ async function handleSubmit() { tagsInput.value = '' coverFile.value = null coverPreview.value = '' + uploadRef.value?.clearFiles() emit('created') visible.value = false } catch (error: any) { @@ -92,6 +94,7 @@ async function handleSubmit() {