feat(留言板): 实现留言点赞功能并优化留言显示

- 新增留言点赞API接口及前端处理逻辑
- 优化留言时间显示格式,使用统一格式化函数
- 修复留言列表props传递问题,支持外部传入articleid
- 移除无用图标和冗余代码,清理样式
This commit is contained in:
qingfeng1121
2025-10-23 18:18:40 +08:00
parent 5b3fba7bfb
commit 6c4d14d06a
5 changed files with 101 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ import apiService from './apiService'
class CategoryAttributeService {
/**
* 根据ID获取分类属性
* @param {number} id - 属性ID
* @param {number} id - 属性ID
* @returns {Promise}
*/
getAttributeById(id) {

View File

@@ -45,7 +45,7 @@ class MessageService {
* @returns {Promise}
*/
getRepliesByParentId(parentId) {
return apiService.get(`/messages/parent/${parentId}`)
return apiService.get(`/messages/${parentId}/replies`)
}
/**
@@ -63,7 +63,7 @@ class MessageService {
* @returns {Promise}
*/
getMessageCountByArticleId(articleId) {
return apiService.get(`/messages/count/${articleId}`)
return apiService.get(`/messages/count/article/${articleId}`)
}
/**
@@ -83,6 +83,15 @@ class MessageService {
deleteMessage(id) {
return apiService.delete(`/messages/${id}`)
}
/**
* 点赞留言
* @param {number} id - 留言ID
* @returns {Promise}
*/
likeMessage(id) {
return apiService.post(`/messages/${id}/like`)
}
}
// 导出留言服务实例