From 509a6fae36bb2bd79a2f539891dfe31bbc3cd514 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Sun, 28 Sep 2025 14:18:27 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat(SSR):=20=E5=B0=86=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BASSR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将CMS数据的获取方式改为Nuxt的useAsyncData - 将加载模式改为渐进式 --- app/pages/index.vue | 121 +++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 53 deletions(-) diff --git a/app/pages/index.vue b/app/pages/index.vue index b11e9dd..03b3947 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -1,6 +1,6 @@ @@ -133,47 +144,47 @@ const { getStrapiLocale } = useLocalizations(); const strapiLocale = getStrapiLocale(); - const carouselImages = ref([]); - const recommend_productions = ref([]); - const recommend_solutions = ref([]); - - const pending = ref(true); - - onMounted(async () => { - try { - const response = await findOne('homepage', undefined, { - populate: { - carousel: { - populate: '*', - }, - recommend_productions: { - populate: { - cover: { - populate: '*', - }, - }, - }, - recommend_solutions: { - populate: { - cover: { - populate: '*', - }, + const { data, pending, error } = useAsyncData('homepage', () => + findOne('homepage', undefined, { + populate: { + carousel: { + populate: '*', + }, + recommend_productions: { + populate: { + cover: { + populate: '*', }, }, }, - locale: strapiLocale, + recommend_solutions: { + populate: { + cover: { + populate: '*', + }, + }, + }, + }, + locale: strapiLocale, + }) + ); + + const carousel = computed(() => data.value?.data.carousel || []); + const recommend_productions = computed( + () => data.value?.data.recommend_productions || [] + ); + const recommend_solutions = computed( + () => data.value?.data.recommend_solutions || [] + ); + + watch(error, (value) => { + if (value) { + console.error('数据获取失败: ', value); + throw createError({ + statusCode: 500, + statusMessage: 'CMS数据获取失败', + fatal: true, }); - 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); - } finally { - pending.value = false; } }); @@ -213,6 +224,10 @@ line-height: 1.6; } + .carousel-section { + padding: 0; + } + .homepage-carousel .el-carousel__item { width: 100%; height: 33vw; From 94196ffdfe6b803ba4863cf759e0868e409638b0 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Sun, 28 Sep 2025 15:50:31 +0800 Subject: [PATCH 2/8] =?UTF-8?q?feat(SSR):=20=E5=B0=86=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E9=A1=B5=E6=94=B9=E4=B8=BASSR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pages/productions/[...slug].vue | 266 ++++++++++++++-------------- app/pages/productions/index.vue | 84 +++++---- 2 files changed, 186 insertions(+), 164 deletions(-) diff --git a/app/pages/productions/[...slug].vue b/app/pages/productions/[...slug].vue index e5be376..2be1dc4 100644 --- a/app/pages/productions/[...slug].vue +++ b/app/pages/productions/[...slug].vue @@ -1,90 +1,108 @@ From dbd934636215b43467046ccfc76e00c102f38b2e Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Sun, 28 Sep 2025 15:57:40 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移出抛出错误的方法 --- app/pages/index.vue | 5 ----- app/pages/productions/[...slug].vue | 5 ----- app/pages/productions/index.vue | 5 ----- 3 files changed, 15 deletions(-) diff --git a/app/pages/index.vue b/app/pages/index.vue index b4ca42c..bb355b7 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -180,11 +180,6 @@ watch(error, (value) => { if (value) { console.error('数据获取失败: ', value); - throw createError({ - statusCode: 500, - statusMessage: 'CMS数据获取失败', - fatal: true, - }); } }); diff --git a/app/pages/productions/[...slug].vue b/app/pages/productions/[...slug].vue index 2be1dc4..21e95fc 100644 --- a/app/pages/productions/[...slug].vue +++ b/app/pages/productions/[...slug].vue @@ -154,11 +154,6 @@ watch(error, (value) => { if (value) { console.error('数据获取失败: ', value); - throw createError({ - statusCode: 500, - statusMessage: 'CMS数据获取失败', - fatal: true, - }); } }); diff --git a/app/pages/productions/index.vue b/app/pages/productions/index.vue index 06bec9c..ad105ed 100644 --- a/app/pages/productions/index.vue +++ b/app/pages/productions/index.vue @@ -110,11 +110,6 @@ watch(error, (value) => { if (value) { console.error('数据获取失败: ', value); - throw createError({ - statusCode: 500, - statusMessage: 'CMS数据获取失败', - fatal: true, - }); } }); From a7a4551528af2ff0d9248491fe7c976c530c6d48 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Sun, 28 Sep 2025 16:11:35 +0800 Subject: [PATCH 4/8] =?UTF-8?q?feat(SSR):=20=E5=B0=86=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E9=A1=B5=E6=94=B9=E4=B8=BASSR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用Nuxt的useAsyncData - 添加i18n信息 --- app/pages/solutions/[...slug].vue | 109 ++++++++++++++++++------------ app/pages/solutions/index.vue | 46 ++++++------- i18n/locales/en.json | 3 + i18n/locales/zh.json | 3 + 4 files changed, 92 insertions(+), 69 deletions(-) diff --git a/app/pages/solutions/[...slug].vue b/app/pages/solutions/[...slug].vue index 6803705..79ac81a 100644 --- a/app/pages/solutions/[...slug].vue +++ b/app/pages/solutions/[...slug].vue @@ -1,36 +1,52 @@ diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 3922894..cfd549c 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -51,6 +51,9 @@ "product-not-found": "Product Not Found", "product-not-found-desc": "Sorry, the product you are looking for does not exist or has been removed.", "back-to-productions": "Back to Products", + "solution-not-found": "Solution Not Found", + "solution-not-found-desc": "Sorry, the solution you are lokking for does not exist or has been removed.", + "back-to-solutions": "Back to Solutions", "no-content-available": "No detailed information available", "loading": "Loading...", "our-productions": "Our Productions", diff --git a/i18n/locales/zh.json b/i18n/locales/zh.json index 9a94dde..cd59a96 100644 --- a/i18n/locales/zh.json +++ b/i18n/locales/zh.json @@ -51,6 +51,9 @@ "product-not-found": "产品未找到", "product-not-found-desc": "抱歉,您访问的产品不存在或已被删除。", "back-to-productions": "返回产品列表", + "solution-not-found": "解决方案未找到", + "solution-not-found-desc": "抱歉,您访问的解决方案不存在或已被删除", + "back-to-solutions": "返回解决方案列表", "no-content-available": "暂无详细信息", "loading": "加载中...", "our-productions": "我们的产品", From d4c079286eb3343a3bc8fafadee8459705ecb95b Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Sun, 28 Sep 2025 16:27:01 +0800 Subject: [PATCH 5/8] =?UTF-8?q?feat(SSR):=20=E5=B0=86=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=A1=B5=E9=9D=A2=E6=94=B9=E4=B8=BASSR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pages/support/contact-us.vue | 78 ++++++++++++++------------------ app/pages/support/documents.vue | 33 ++++++-------- app/pages/support/faq.vue | 25 ++++------ 3 files changed, 59 insertions(+), 77 deletions(-) diff --git a/app/pages/support/contact-us.vue b/app/pages/support/contact-us.vue index e804639..44ad63d 100644 --- a/app/pages/support/contact-us.vue +++ b/app/pages/support/contact-us.vue @@ -1,31 +1,29 @@