feat(分类系统): 实现分类属性功能并重构文章列表
重构文章分类系统,新增分类属性服务及相关API接口 修改文章列表页面以支持按属性筛选文章 调整路由和样式以适配新功能
This commit is contained in:
@@ -23,6 +23,15 @@ class ArticleService {
|
||||
return apiService.get(`/articles/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性ID获取文章列表
|
||||
* @param {number} attributeId - 属性ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getArticlesByAttributeId(attributeId) {
|
||||
return apiService.get(`/articles/attribute/${attributeId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据标题查询文章列表
|
||||
* @param {string} title - 文章标题
|
||||
@@ -68,7 +77,7 @@ class ArticleService {
|
||||
deleteArticle(id) {
|
||||
return apiService.delete(`/articles/${id}`)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加文章浏览量
|
||||
* @param {number} id - 文章ID
|
||||
@@ -77,6 +86,33 @@ class ArticleService {
|
||||
incrementArticleViews(id) {
|
||||
return apiService.post(`/articles/${id}/views`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类ID获取文章(兼容旧接口)
|
||||
* @param {number} categoryId - 分类ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getArticlesByCategory(categoryId) {
|
||||
return apiService.get(`/articles/category/${categoryId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性ID获取文章
|
||||
* @param {number} attributeId - 属性ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getArticlesByAttribute(attributeId) {
|
||||
return apiService.get(`/articles/attribute/${attributeId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性ID获取最新文章
|
||||
* @param {number} attributeId - 属性ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getLatestArticlesByAttribute(attributeId) {
|
||||
return apiService.get(`/articles/attribute/${attributeId}/latest`)
|
||||
}
|
||||
}
|
||||
|
||||
// 导出文章服务实例
|
||||
|
||||
Reference in New Issue
Block a user