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 <noreply@anthropic.com>
This commit is contained in:
@@ -60,8 +60,8 @@ server {
|
|||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 静态资源缓存
|
# 静态资源缓存(排除 /api/ 路径,避免拦截 PB 文件请求)
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
location ~* ^/(?!api/|voice-api/).*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp)$ {
|
||||||
expires 1y;
|
expires 1y;
|
||||||
add_header Cache-Control "public, immutable";
|
add_header Cache-Control "public, immutable";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { GamePlatform } from '@/types'
|
|||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { getAllPlatforms } from '@/api/games'
|
import { getAllPlatforms } from '@/api/games'
|
||||||
import { Plus } from '@element-plus/icons-vue'
|
import { Plus } from '@element-plus/icons-vue'
|
||||||
import type { UploadFile } from 'element-plus'
|
import type { UploadFile, UploadInstance } from 'element-plus'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: boolean
|
modelValue: boolean
|
||||||
@@ -27,6 +27,7 @@ const platform = ref<GamePlatform | ''>('')
|
|||||||
const tagsInput = ref('')
|
const tagsInput = ref('')
|
||||||
const coverFile = ref<File | null>(null)
|
const coverFile = ref<File | null>(null)
|
||||||
const coverPreview = ref('')
|
const coverPreview = ref('')
|
||||||
|
const uploadRef = ref<UploadInstance>()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const platforms = getAllPlatforms()
|
const platforms = getAllPlatforms()
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ async function handleSubmit() {
|
|||||||
tagsInput.value = ''
|
tagsInput.value = ''
|
||||||
coverFile.value = null
|
coverFile.value = null
|
||||||
coverPreview.value = ''
|
coverPreview.value = ''
|
||||||
|
uploadRef.value?.clearFiles()
|
||||||
emit('created')
|
emit('created')
|
||||||
visible.value = false
|
visible.value = false
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -92,6 +94,7 @@ async function handleSubmit() {
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<label>封面图</label>
|
<label>封面图</label>
|
||||||
<el-upload
|
<el-upload
|
||||||
|
ref="uploadRef"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
accept="image/*"
|
accept="image/*"
|
||||||
|
|||||||
Reference in New Issue
Block a user