serv\web-侧边栏 标签统一
This commit is contained in:
@@ -199,17 +199,17 @@ export const resourceApi = {
|
||||
/**
|
||||
* 搜索资源
|
||||
* @param keyword 搜索关键词
|
||||
* @param categoryID 分类ID(可选)
|
||||
* @param tagID 分类ID(可选)
|
||||
* @param status 状态(可选)
|
||||
* @returns Promise<ResultDomain<Resource>>
|
||||
*/
|
||||
async searchResources(
|
||||
keyword: string,
|
||||
categoryID?: string,
|
||||
tagID?: string,
|
||||
status?: number
|
||||
): Promise<ResultDomain<Resource>> {
|
||||
const params: any = { keyword };
|
||||
if (categoryID) params.categoryID = categoryID;
|
||||
if (tagID) params.tagID = tagID;
|
||||
if (status !== undefined) params.status = status;
|
||||
|
||||
const response = await api.get<Resource>('/news/resources/search', params);
|
||||
|
||||
@@ -4,6 +4,24 @@
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
* @since 2025-10-15
|
||||
*
|
||||
* ⚠️ 注意:此API已废弃!
|
||||
*
|
||||
* 从2025-10-27起,资源分类功能已迁移到标签系统(Tag)中。
|
||||
*
|
||||
* 迁移说明:
|
||||
* - 原 tb_resource_category 表已废弃
|
||||
* - 改为使用 tb_tag 表的 tag_type=1 表示文章分类标签
|
||||
* - 请使用 resourceTagApi.getTagsByType(1) 替代本 API 的方法
|
||||
*
|
||||
* API 迁移对照:
|
||||
* - getCategoryList() → resourceTagApi.getTagsByType(1)
|
||||
* - getCategoryById(id) → resourceTagApi.getTagById(id)
|
||||
* - createCategory(category) → resourceTagApi.createTag({...category, tagType: 1})
|
||||
* - updateCategory(category) → resourceTagApi.updateTag(category)
|
||||
* - deleteCategory(id) → resourceTagApi.deleteTag(id)
|
||||
*
|
||||
* @deprecated 请使用 resourceTagApi 代替
|
||||
*/
|
||||
|
||||
import { api } from '@/apis';
|
||||
@@ -11,6 +29,7 @@ import type { ResultDomain, ResourceCategory } from '@/types';
|
||||
|
||||
/**
|
||||
* 资源分类API服务
|
||||
* @deprecated 已废弃,请使用 resourceTagApi.getTagsByType(1) 获取文章分类标签
|
||||
*/
|
||||
export const resourceCategoryApi = {
|
||||
/**
|
||||
@@ -24,11 +43,11 @@ export const resourceCategoryApi = {
|
||||
|
||||
/**
|
||||
* 根据ID获取分类详情
|
||||
* @param categoryID 分类ID
|
||||
* @param tagID 分类ID
|
||||
* @returns Promise<ResultDomain<ResourceCategory>>
|
||||
*/
|
||||
async getCategoryById(categoryID: string): Promise<ResultDomain<ResourceCategory>> {
|
||||
const response = await api.get<ResourceCategory>(`/news/categorys/category/${categoryID}`);
|
||||
async getCategoryById(tagID: string): Promise<ResultDomain<ResourceCategory>> {
|
||||
const response = await api.get<ResourceCategory>(`/news/categorys/category/${tagID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
@@ -54,22 +73,22 @@ export const resourceCategoryApi = {
|
||||
|
||||
/**
|
||||
* 删除分类
|
||||
* @param categoryID 分类ID
|
||||
* @param tagID 分类ID
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async deleteCategory(categoryID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`/news/categorys/category/${categoryID}`);
|
||||
async deleteCategory(tagID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`/news/categorys/category/${tagID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新分类状态
|
||||
* @param categoryID 分类ID
|
||||
* @param tagID 分类ID
|
||||
* @param status 状态值
|
||||
* @returns Promise<ResultDomain<ResourceCategory>>
|
||||
*/
|
||||
async updateCategoryStatus(categoryID: string, status: number): Promise<ResultDomain<ResourceCategory>> {
|
||||
const response = await api.put<ResourceCategory>(`/news/categorys/category/${categoryID}/status`, null, {
|
||||
async updateCategoryStatus(tagID: string, status: number): Promise<ResultDomain<ResourceCategory>> {
|
||||
const response = await api.put<ResourceCategory>(`/news/categorys/category/${tagID}/status`, null, {
|
||||
params: { status }
|
||||
});
|
||||
return response.data;
|
||||
|
||||
@@ -16,7 +16,7 @@ export const resourceTagApi = {
|
||||
// ==================== 标签基础操作 ====================
|
||||
|
||||
/**
|
||||
* 获取标签列表
|
||||
* 获取标签列表(获取所有标签)
|
||||
* @returns Promise<ResultDomain<Tag>>
|
||||
*/
|
||||
async getTagList(): Promise<ResultDomain<Tag>> {
|
||||
@@ -24,6 +24,16 @@ export const resourceTagApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据标签类型获取标签列表
|
||||
* @param tagType 标签类型(1-文章分类标签 2-课程分类标签 3-学习任务分类标签)
|
||||
* @returns Promise<ResultDomain<Tag>>
|
||||
*/
|
||||
async getTagsByType(tagType: number): Promise<ResultDomain<Tag>> {
|
||||
const response = await api.get<Tag>(`/news/tags/type/${tagType}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据ID获取标签详情
|
||||
* @param tagID 标签ID
|
||||
|
||||
Reference in New Issue
Block a user