diff --git a/app/pages/index.vue b/app/pages/index.vue index 1e9ee1a..674c2d9 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -22,8 +22,7 @@ class="recommend-card" @click="handleProductionCardClick(item.documentId || '')">
@@ -38,6 +37,33 @@ +
+

推荐解决方案

+

了解我们的定制解决方案,帮助您优化业务流程,提高效率。

+ + +
+ + +
+ +
+ {{ item.title }} +
+ +
{{ item.summary }}
+
+
+
+
+
+ +
@@ -52,6 +78,7 @@ const strapiLocale = getStrapiLocale() const carouselImages = ref([]) const recommend_productions = ref([]) +const recommend_solutions = ref([]) const pending = ref(true) @@ -68,14 +95,23 @@ onMounted(async () => { populate: '*', }, }, - } + }, + recommend_solutions: { + populate: { + cover: { + populate: '*', + }, + }, + }, }, locale: strapiLocale, }) if (response.data) { carouselImages.value = response.data.carousel || [] recommend_productions.value = response.data.recommend_productions || [] + recommend_solutions.value = response.data.recommend_solutions || [] console.log('推荐产品:', recommend_productions.value) + console.log('推荐解决方案:', recommend_solutions.value) } } catch (error) { console.error('Error fetching homepage data:', error) @@ -92,6 +128,16 @@ const handleProductionCardClick = (documentId: string) => { router.push(localePath(`/productions/${documentId}`)) } } + + +const handleSolutionCardClick = (documentId: string) => { + // 使用路由导航到解决方案详情页 + if (documentId) { + const localePath = useLocalePath() + const router = useRouter() + router.push(localePath(`/solutions/${documentId}`)) + } +} \ No newline at end of file diff --git a/app/types/strapi/singleTypes.ts b/app/types/strapi/singleTypes.ts index 6626af3..fa68b50 100644 --- a/app/types/strapi/singleTypes.ts +++ b/app/types/strapi/singleTypes.ts @@ -9,4 +9,5 @@ export interface StrapiContactInfo extends StrapiEntity { export interface StrapiHomepage extends StrapiEntity { carousel: StrapiImage[]; recommend_productions: StrapiRelation[]; + recommend_solutions: StrapiRelation[]; } \ No newline at end of file