FEATURE: 网站的基本前端服务 #2
@ -36,7 +36,7 @@
|
||||
<question-list :questions="production.questions" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="相关文档" name="documents">
|
||||
<document-list :documents="production.documents" />
|
||||
<document-list :documents="production.production_documents.map(item => item.document) || []" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
@ -95,8 +95,8 @@ onMounted(async () => {
|
||||
questions: {
|
||||
populate: '*',
|
||||
},
|
||||
documents: {
|
||||
populate: '*',
|
||||
production_documents: {
|
||||
populate: 'document',
|
||||
},
|
||||
},
|
||||
locale: strapiLocale,
|
||||
@ -106,6 +106,7 @@ onMounted(async () => {
|
||||
production.value = {
|
||||
...item,
|
||||
}
|
||||
console.log('Fetched production:', production.value)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch production:', error)
|
||||
|
||||
@ -19,8 +19,7 @@ v-for="(group, type) in groupedProductions" :key="type" :title="type || '未分
|
||||
<div class="group-list">
|
||||
<production-card
|
||||
v-for="production in group" :key="production.documentId || production.id"
|
||||
:slug="production.documentId"
|
||||
:image-url="useStrapiMedia(production?.cover?.url || '')"
|
||||
:slug="production.documentId" :image-url="useStrapiMedia(production?.cover?.url || '')"
|
||||
:name="production.title" :description="production.summary || ''" />
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
@ -65,12 +64,9 @@ onMounted(async () => {
|
||||
cover: {
|
||||
populate: '*',
|
||||
},
|
||||
production_images: {
|
||||
populate: '*',
|
||||
},
|
||||
production_type: {
|
||||
populate: '*',
|
||||
}
|
||||
populate: '*'
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
show_in_production_list: {
|
||||
|
||||
@ -44,4 +44,6 @@ export interface StrapiResponse<T> {
|
||||
total: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type StrapiRelation<T, K extends keyof T = never> = Omit<T, K | keyof StrapiEntity> & StrapiEntity;
|
||||
@ -1,4 +1,4 @@
|
||||
import type { StrapiEntity, StrapiImage, StrapiMedia } from './common';
|
||||
import type { StrapiEntity, StrapiImage, StrapiMedia, StrapiRelation } from './common';
|
||||
|
||||
export interface ProductionType extends StrapiEntity {
|
||||
type: string;
|
||||
@ -22,7 +22,12 @@ export interface Production extends StrapiEntity {
|
||||
production_images: StrapiImage[];
|
||||
production_details: string;
|
||||
production_specs: ProductionSpecGroup[];
|
||||
questions: Question[];
|
||||
documents: StrapiMedia[];
|
||||
production_documents: StrapiRelation<ProductionDocument, 'related_productions'>[];
|
||||
questions: StrapiRelation<Question, 'related_productions'>[];
|
||||
show_in_production_list: boolean;
|
||||
}
|
||||
|
||||
export interface ProductionDocument extends StrapiEntity {
|
||||
document: StrapiMedia;
|
||||
related_productions: StrapiRelation<Production, 'production_documents'>[];
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
export interface Question extends StrapiEntity {
|
||||
title: string;
|
||||
content: string;
|
||||
related_productions: StrapiRelation<Production, 'questions'>[];
|
||||
}
|
||||
Reference in New Issue
Block a user