feat(分类系统): 实现分类属性功能并重构文章列表

重构文章分类系统,新增分类属性服务及相关API接口
修改文章列表页面以支持按属性筛选文章
调整路由和样式以适配新功能
This commit is contained in:
qingfeng1121
2025-10-18 10:28:49 +08:00
parent 266310dea3
commit 02d17d7260
13 changed files with 648 additions and 433 deletions

View File

@@ -0,0 +1,54 @@
import apiService from './apiService'
/**
* 分类服务
*/
class CategoryService {
/**
* 获取所有分类
* @returns {Promise}
*/
getAllCategories() {
return apiService.get('/categories')
}
/**
* 获取指定分类
* @param {number} id - 分类ID
* @returns {Promise}
*/
getCategory(id) {
return apiService.get(`/categories/${id}`)
}
/**
* 创建新分类
* @param {Object} categoryData - 分类数据
* @returns {Promise}
*/
createCategory(categoryData) {
return apiService.post('/categories', categoryData)
}
/**
* 更新分类
* @param {number} id - 分类ID
* @param {Object} categoryData - 分类数据
* @returns {Promise}
*/
updateCategory(id, categoryData) {
return apiService.put(`/categories/${id}`, categoryData)
}
/**
* 删除分类
* @param {number} id - 分类ID
* @returns {Promise}
*/
deleteCategory(id) {
return apiService.delete(`/categories/${id}`)
}
}
// 导出分类服务实例
export default new CategoryService()