From 90f3e999e27bb33ae60780cec2d7bd7b63fce1f4 Mon Sep 17 00:00:00 2001 From: gxwebsoft <170083662@qq.com> Date: Wed, 21 Jan 2026 15:31:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(page):=20=E6=B7=BB=E5=8A=A0=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E8=AF=A6=E6=83=85=E5=92=8C=E6=A0=8F=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 创建了 article/[id].vue 页面用于显示栏目下文章列表 - 实现了 item/[id].vue 页面用于展示文章详情内容 - 开发了 page/[id].vue 页面用于单页内容展示 - 集成了 RichText 组件用于安全渲染富文本内容 - 实现了面包屑导航和分页功能 - 添加了搜索和刷新功能 - 完善了 SEO 元数据设置 --- app/components/RichText.vue | 134 +++++++++++++++ app/pages/article/[id].vue | 193 +++++++++++++++++++++ app/pages/item/[id].vue | 125 ++++++++++++++ app/pages/page/[id].vue | 243 +++++++++++++++++++++++++++ server/api/cms-navigation.get.ts | 42 +++++ server/api/cms/cms-navigation.get.ts | 2 + 6 files changed, 739 insertions(+) create mode 100644 app/components/RichText.vue create mode 100644 app/pages/article/[id].vue create mode 100644 app/pages/item/[id].vue create mode 100644 app/pages/page/[id].vue create mode 100644 server/api/cms-navigation.get.ts create mode 100644 server/api/cms/cms-navigation.get.ts diff --git a/app/components/RichText.vue b/app/components/RichText.vue new file mode 100644 index 0000000..f98388d --- /dev/null +++ b/app/components/RichText.vue @@ -0,0 +1,134 @@ + + + + + diff --git a/app/pages/article/[id].vue b/app/pages/article/[id].vue new file mode 100644 index 0000000..791bc71 --- /dev/null +++ b/app/pages/article/[id].vue @@ -0,0 +1,193 @@ + + + + diff --git a/app/pages/item/[id].vue b/app/pages/item/[id].vue new file mode 100644 index 0000000..9c417c8 --- /dev/null +++ b/app/pages/item/[id].vue @@ -0,0 +1,125 @@ + + + + diff --git a/app/pages/page/[id].vue b/app/pages/page/[id].vue new file mode 100644 index 0000000..d838f36 --- /dev/null +++ b/app/pages/page/[id].vue @@ -0,0 +1,243 @@ + + + diff --git a/server/api/cms-navigation.get.ts b/server/api/cms-navigation.get.ts new file mode 100644 index 0000000..d8a4a80 --- /dev/null +++ b/server/api/cms-navigation.get.ts @@ -0,0 +1,42 @@ +import { $fetch } from 'ofetch' +import { createError, defineEventHandler, getHeader, getQuery } from 'h3' +import { useRuntimeConfig } from '#imports' + +// Frontend-friendly endpoint: +// GET /api/cms-navigation?parentId=xxxx +// Proxies to CMS modules API. Some deployments expose "/cms-navigation", others "/cms/cms-navigation". +export default defineEventHandler(async (event) => { + const config = useRuntimeConfig() + const query = getQuery(event) + const modulesApiBase = + config.public.modulesApiBase || config.public.ApiBase || 'https://cms-api.websoft.top/api' + + const tenantId = + getHeader(event, 'tenantid') || + config.public.tenantId || + config.public.TenantId || + '10586' + const authorization = getHeader(event, 'authorization') + + const headers = { + TenantId: String(tenantId), + ...(authorization ? { Authorization: String(authorization) } : {}) + } + + const upstreamCandidates = ['/cms-navigation', '/cms/cms-navigation'] + let lastError: any + + for (const path of upstreamCandidates) { + try { + return await $fetch(path, { baseURL: modulesApiBase, headers, query }) + } catch (error: any) { + lastError = error + } + } + + throw createError({ + statusCode: lastError?.statusCode || lastError?.response?.status || 502, + statusMessage: lastError?.statusMessage || 'Failed to fetch cms navigation' + }) +}) + diff --git a/server/api/cms/cms-navigation.get.ts b/server/api/cms/cms-navigation.get.ts new file mode 100644 index 0000000..eba9a45 --- /dev/null +++ b/server/api/cms/cms-navigation.get.ts @@ -0,0 +1,2 @@ +export { default } from '../cms-navigation.get' +