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 @@ + + + + + +