- 后端:ExamQuestion 实体新增 knowledge_code 字段存储关联知识点 - 后端:TextbookController 新增教材下拉列表、知识点列表接口 - 后端:KnowledgeController 新增按编码列表查询知识点接口 - 前端:试题创建/编辑页面增加教材-知识点两级级联选择器 - 支持多选知识点,编辑时自动回显已关联知识点
137 lines
2.9 KiB
TypeScript
137 lines
2.9 KiB
TypeScript
import client from './internal/httpClient';
|
|
|
|
export function list(
|
|
page: number,
|
|
size: number,
|
|
sortField: string,
|
|
sortAlgo: string,
|
|
name: string,
|
|
categoryId: string
|
|
) {
|
|
return client.get('/backend/v1/exam/question/category/index', {
|
|
page,
|
|
size,
|
|
sort_field: sortField,
|
|
sort_algo: sortAlgo,
|
|
name: name,
|
|
category_id: categoryId,
|
|
});
|
|
}
|
|
|
|
export function store(name: string, categoryId: number) {
|
|
return client.post('/backend/v1/exam/question/category/create', {
|
|
name: name,
|
|
category_id: categoryId,
|
|
});
|
|
}
|
|
|
|
export function detail(id: number) {
|
|
return client.get(`/backend/v1/exam/question/category/${id}`, {});
|
|
}
|
|
|
|
export function update(id: number, name: string, categoryId: number) {
|
|
return client.put(`/backend/v1/exam/question/category/${id}`, {
|
|
name: name,
|
|
category_id: categoryId,
|
|
});
|
|
}
|
|
|
|
export function destroy(id: number) {
|
|
return client.destroy(`/backend/v1/exam/question/category/${id}`);
|
|
}
|
|
|
|
export function destroyMulti(ids: number[]) {
|
|
return client.post(`/backend/v1/exam/question/category/destroy-multi`, {
|
|
ids: ids,
|
|
});
|
|
}
|
|
|
|
export function questionList(
|
|
category_id: number,
|
|
page: number,
|
|
size: number,
|
|
sortField: string,
|
|
sortAlgo: string,
|
|
content: string,
|
|
level: any,
|
|
type: any,
|
|
knowledgeCode?: string
|
|
) {
|
|
return client.get('/backend/v1/exam/question/index', {
|
|
category_id,
|
|
page,
|
|
size,
|
|
sort_field: sortField,
|
|
sort_algo: sortAlgo,
|
|
content,
|
|
level,
|
|
type,
|
|
knowledge_code: knowledgeCode,
|
|
});
|
|
}
|
|
|
|
export function questionStore(
|
|
category_id: number,
|
|
content: string,
|
|
level: any,
|
|
type: any,
|
|
knowledge_code?: string
|
|
) {
|
|
return client.post('/backend/v1/exam/question/create', {
|
|
category_id,
|
|
content,
|
|
level,
|
|
type,
|
|
knowledge_code,
|
|
});
|
|
}
|
|
|
|
export function questionDetail(id: number) {
|
|
return client.get(`/backend/v1/exam/question/${id}`, {});
|
|
}
|
|
|
|
export function questionUpdate(
|
|
id: number,
|
|
category_id: number,
|
|
content: string,
|
|
level: any,
|
|
type: any,
|
|
knowledge_code?: string
|
|
) {
|
|
return client.put(`/backend/v1/exam/question/${id}`, {
|
|
category_id,
|
|
content,
|
|
level,
|
|
type,
|
|
knowledge_code,
|
|
});
|
|
}
|
|
|
|
export function questionDestroy(id: number) {
|
|
return client.destroy(`/backend/v1/exam/question/${id}`);
|
|
}
|
|
|
|
export function questionDestroyMulti(ids: number[]) {
|
|
return client.post(`/backend/v1/exam/question/destroy-multi`, {
|
|
ids: ids,
|
|
});
|
|
}
|
|
|
|
export function unbind(questionIds: any[]) {
|
|
return client.post('/backend/v1/exam/question/unbind-multi', {
|
|
questionIds: questionIds,
|
|
});
|
|
}
|
|
|
|
export function storeBatch(categoryId: number, startLine: number, questions: string[][]) {
|
|
return client.post('/backend/v1/exam/question/store-batch', {
|
|
category_id: categoryId,
|
|
start_line: startLine,
|
|
questions: questions,
|
|
});
|
|
}
|
|
|
|
export function uploadTxt(params: any) {
|
|
return client.post('/backend/v1/exam/question/import', params);
|
|
}
|