From 08ac4418706b080a517527733957d3a798643223 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Fri, 31 Oct 2025 17:09:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E7=AB=A0=E8=AF=A6?= =?UTF-8?q?=E7=BB=86=E9=A1=B5=E5=92=8C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/DevelopNews.vue | 10 +- app/config/api.ts | 31 +++++ app/pages/article/[id].vue | 203 +++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+), 6 deletions(-) create mode 100644 app/pages/article/[id].vue diff --git a/app/components/DevelopNews.vue b/app/components/DevelopNews.vue index 34bb39f..6cc3aad 100644 --- a/app/components/DevelopNews.vue +++ b/app/components/DevelopNews.vue @@ -75,8 +75,8 @@ const fetchNewsData = async (): Promise => { } }) - const results = await Promise.all(promises) - newsData.value = results + newsData.value = await Promise.all(promises) + } catch (err) { error.value = err instanceof Error ? err.message : '获取新闻数据失败' @@ -95,9 +95,9 @@ onMounted(() => {
-
+
开发资讯
@@ -161,8 +161,6 @@ onMounted(() => {
暂无文章
- -
diff --git a/app/config/api.ts b/app/config/api.ts index 479fa14..e9b9f1c 100644 --- a/app/config/api.ts +++ b/app/config/api.ts @@ -158,3 +158,34 @@ export async function getArticleList( } } +/** + * 获取文章详情 + * @param id 文章ID + * @returns Promise
返回文章详情数据 + */ +export async function getArticleDetail(id: string): Promise
{ + try { + const response = await $fetch>( + `${API_BASE_URL}/app/owArticle/detail`, + { + method: 'GET', + params: { id }, + headers: { + 'Content-Type': 'application/json', + }, + } + ) + + // 检查响应状态 + if (response.code === 200 && response.data) { + return response.data + } + + console.warn('获取文章详情失败', response) + return null + } catch (error) { + console.error('获取文章详情时发生错误:', error) + return null + } +} + diff --git a/app/pages/article/[id].vue b/app/pages/article/[id].vue new file mode 100644 index 0000000..6868713 --- /dev/null +++ b/app/pages/article/[id].vue @@ -0,0 +1,203 @@ + + + + + +