plus-ui/src/api/question/label/index.ts
lvxudong c7ea6db08f up
2023-11-17 18:20:20 +08:00

89 lines
1.6 KiB
TypeScript

import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LabelVO, LabelForm, LabelQuery, QuestionLabel } from '@/api/question/label/types';
/**
* 查询题目标签列表
* @param query
* @returns {*}
*/
export const listLabel = (query?: LabelQuery): AxiosPromise<LabelVO[]> => {
return request({
url: '/question/label/list',
method: 'get',
params: query
});
};
/**
* 查询所有的标签
* @returns {*}
*/
export const queryAllLabel = (): AxiosPromise<QuestionLabel[]> => {
return request({
url: '/question/label/queryLabels',
method: 'get'
});
};
/**
* 状态修改
*/
export const changeLabelStatus = (id: string | number, status: number) => {
const data = {
id,
status
};
return request({
url: '/question/label/changeStatus',
method: 'put',
data: data
});
};
/**
* 查询题目标签详细
* @param id
*/
export const getLabel = (id: string | number): AxiosPromise<LabelVO> => {
return request({
url: '/question/label/' + id,
method: 'get'
});
};
/**
* 新增题目标签
* @param data
*/
export const addLabel = (data: LabelForm) => {
return request({
url: '/question/label',
method: 'post',
data: data
});
};
/**
* 修改题目标签
* @param data
*/
export const updateLabel = (data: LabelForm) => {
return request({
url: '/question/label',
method: 'put',
data: data
});
};
/**
* 删除题目标签
* @param id
*/
export const delLabel = (id: string | number | Array<string | number>) => {
return request({
url: '/question/label/' + id,
method: 'delete'
});
};