From 6c4d14d06a9ca1c808940f518bb43b845e266302 Mon Sep 17 00:00:00 2001 From: qingfeng1121 Date: Thu, 23 Oct 2025 18:18:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=95=99=E8=A8=80=E6=9D=BF):=20=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E7=95=99=E8=A8=80=E7=82=B9=E8=B5=9E=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E7=95=99=E8=A8=80=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增留言点赞API接口及前端处理逻辑 - 优化留言时间显示格式,使用统一格式化函数 - 修复留言列表props传递问题,支持外部传入articleid - 移除无用图标和冗余代码,清理样式 --- src/layouts/MainLayout.vue | 2 +- src/services/categoryAttributeService.js | 2 +- src/services/messageService.js | 13 +++- src/views/articlecontents.vue | 8 ++- src/views/messageboard.vue | 91 +++++++++++++++++++++--- 5 files changed, 101 insertions(+), 15 deletions(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 1c5ecfb..eccae98 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -31,7 +31,7 @@
- + 返回
@@ -74,7 +74,7 @@
- +
@@ -84,6 +84,8 @@ import { useRoute, useRouter } from 'vue-router' import { ref, onMounted } from 'vue' import { articleService } from '@/services' +import { messageService } from '@/services' +import {categoryAttributeService} from '@/services' import { ElMessage } from 'element-plus' import type { Article } from '@/types' import { formatDate } from '@/utils/dateUtils' @@ -118,7 +120,7 @@ const fetchArticleDetail = async () => { if (res.data) { article.value = res.data - + article.value.categoryName = await categoryAttributeService.getAttributeById(article.value.categoryId)|| '未分类' // 增加文章浏览量 try { await articleService.incrementArticleViews(Number(articleId)) diff --git a/src/views/messageboard.vue b/src/views/messageboard.vue index 459a2b6..079fe55 100644 --- a/src/views/messageboard.vue +++ b/src/views/messageboard.vue @@ -17,12 +17,15 @@
- + 回复
@@ -32,11 +35,15 @@
{{ reply.displayName || reply.nickname }}
-
{{ reply.createdAt || '刚刚' }}
+
{{ formatDate(reply.createdAt) || '刚刚' }}
{{ reply.content }}
+ 回复
@@ -106,10 +113,19 @@