From 739d053cf07bb2cc8b7ca0fdf9633cf18e51e8ba Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Tue, 9 Sep 2025 16:45:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增添推荐解决方案的section --- app/pages/index.vue | 62 +++++++++++++++++++++++++++++---- app/types/strapi/singleTypes.ts | 1 + 2 files changed, 57 insertions(+), 6 deletions(-) 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