Fix:修正前后端Bug

This commit is contained in:
2025-08-25 16:21:19 +08:00
parent ad1e520c07
commit 321e990dff
8 changed files with 160 additions and 13 deletions

View File

@ -16,7 +16,7 @@
<div class="production-header">
<div class="production-image">
<el-image
:src="useStrapiMedia(production?.production_image?.url || '')" :alt="production.title"
:src="useStrapiMedia(production?.cover?.url || '')" :alt="production.title"
fit="contain" />
</div>
<div class="production-info">
@ -84,7 +84,10 @@ onMounted(async () => {
production_specs: {
populate: '*',
},
production_image: {
production_images: {
populate: '*',
},
cover: {
populate: '*',
},
},

View File

@ -20,7 +20,7 @@ v-for="(group, type) in groupedProductions" :key="type" :title="type || '未分
<production-card
v-for="production in group" :key="production.documentId || production.id"
:slug="production.documentId"
:image-url="useStrapiMedia(production?.production_image?.url || '')"
:image-url="useStrapiMedia(production?.cover?.url || '')"
:name="production.title" :description="production.summary || ''" />
</div>
</el-collapse-item>
@ -62,7 +62,10 @@ onMounted(async () => {
try {
const response = await find<Production>('productions', {
populate: {
production_image: {
cover: {
populate: '*',
},
production_images: {
populate: '*',
},
production_type: {
@ -76,6 +79,7 @@ onMounted(async () => {
},
locale: strapiLocale,
})
console.log('Fetched productions:', response.data)
productions.value = response.data.map((item: Production) => ({
...item,
// 保持 production_type 原始类型,兼容对象或字符串