275 lines
5.6 KiB
TypeScript
275 lines
5.6 KiB
TypeScript
import client from './internal/httpClient';
|
|
// textBook
|
|
|
|
export function GetTextbookListApi(page: number, size: number, title: string) {
|
|
return client.get('/backend/v1/jc/textbook/index', {
|
|
page: page,
|
|
size: size,
|
|
title: title,
|
|
});
|
|
}
|
|
|
|
export function CreateTextbookApi(
|
|
title: string,
|
|
thumb: string,
|
|
shortDesc: string,
|
|
author: string,
|
|
major: string,
|
|
depIds: number[],
|
|
groupIds: number[],
|
|
userIds: number[],
|
|
publishTime: string,
|
|
publishUnit: string,
|
|
createTime: string,
|
|
isbn: string
|
|
) {
|
|
console.log(thumb, thumb, '>>>>');
|
|
return client.post('/backend/v1/jc/textbook', {
|
|
title,
|
|
thumb,
|
|
shortDesc,
|
|
author,
|
|
major,
|
|
dep_ids: depIds,
|
|
groupIds,
|
|
userIds,
|
|
publishTime,
|
|
publishUnit,
|
|
createTime,
|
|
isbn,
|
|
});
|
|
}
|
|
|
|
export function GetTextbookDetailApi(id: number) {
|
|
return client.get(`/backend/v1/jc/textbook/${id}`, {});
|
|
}
|
|
|
|
export function UpdateTextbookApi(
|
|
id: number,
|
|
title: string,
|
|
thumb: string,
|
|
shortDesc: string,
|
|
author: string,
|
|
major: string,
|
|
depIds: number[],
|
|
groupIds: number[],
|
|
userIds: number[],
|
|
publishTime: string,
|
|
publishUnit: string,
|
|
createTime: string,
|
|
isbn: string
|
|
) {
|
|
return client.put(`/backend/v1/jc/textbook`, {
|
|
id,
|
|
title,
|
|
thumb,
|
|
shortDesc,
|
|
author,
|
|
major,
|
|
dep_ids: depIds,
|
|
groupIds,
|
|
userIds,
|
|
publishTime,
|
|
publishUnit,
|
|
createTime,
|
|
isbn,
|
|
});
|
|
}
|
|
|
|
export function DestroyTextbookApi(id: number) {
|
|
return client.destroy(`/backend/v1/jc/textbook/${id}`);
|
|
}
|
|
|
|
/**
|
|
* 关联资源
|
|
**/
|
|
|
|
export function GetResourceListApi(
|
|
page: number = 1,
|
|
size: number = 10,
|
|
type: any = 0,
|
|
sortOrder: any = '',
|
|
sortField: any = '',
|
|
searchData: any = ''
|
|
) {
|
|
return client.get('/backend/v1/jc/resource/index', {
|
|
page,
|
|
size,
|
|
type,
|
|
sortOrder,
|
|
sortField,
|
|
searchData,
|
|
});
|
|
}
|
|
|
|
//删除+ 批量删除
|
|
export function DelResourceItemApi(idList: string) {
|
|
return client.destroy(`/backend/v1/jc/softwareInfo?idList=${idList}`);
|
|
}
|
|
|
|
//根据id查详情
|
|
export function GetDetailApi(id: number) {
|
|
return client.get(`/backend/v1/jc/resource/${id}`, {});
|
|
}
|
|
|
|
export function UpdateDetailApi(
|
|
id: number,
|
|
softwareName: string,
|
|
version: string,
|
|
company: string,
|
|
desc: string,
|
|
softNo: string,
|
|
type: string,
|
|
softPath: string,
|
|
maxConnect: string,
|
|
minSpeed: string,
|
|
shareSchoolId: string[],
|
|
videoResourceInfos?: SoftwareResourceInfo[],
|
|
docResourceInfos?: SoftwareResourceInfo[],
|
|
softwareItemInfos?: SoftwareItemInfo[]
|
|
) {
|
|
return client.post(`/backend/v1/virtual/update`, {
|
|
id,
|
|
softwareName,
|
|
type,
|
|
softNo,
|
|
softPath,
|
|
version,
|
|
company,
|
|
desc,
|
|
maxConnect,
|
|
minSpeed,
|
|
shareSchoolId,
|
|
softwareItemInfos,
|
|
videoResourceInfos,
|
|
docResourceInfos,
|
|
});
|
|
}
|
|
|
|
/*
|
|
* Chapter相关信息
|
|
* */
|
|
|
|
export function GetChapterListApi(params: any) {
|
|
return client.get('/backend/v1/jc/chapter/index', params);
|
|
}
|
|
export function GetChapterTreeApi(params: any) {
|
|
return client.get(`/backend/v1/jc/chapter/tree`, params);
|
|
}
|
|
export function GetChapterDetailApi(id: any, bookId: number) {
|
|
return client.get(`/backend/v1/jc/chapter/${id}`, { bookId });
|
|
}
|
|
|
|
// 包含嵌套的
|
|
export function DropDiffClassApi(id: number, parent_id: number, ids: number[], book_id: number) {
|
|
return client.put(`/backend/v1/jc/chapter/update/parent`, {
|
|
id: id,
|
|
parent_id: parent_id,
|
|
ids: ids,
|
|
book_id: book_id,
|
|
});
|
|
}
|
|
|
|
export function DropSameClassApi(ids: number[], book_id: number) {
|
|
return client.put(`/backend/v1/jc/chapter/update/sort`, {
|
|
ids: ids,
|
|
book_id: book_id,
|
|
});
|
|
}
|
|
|
|
export function GetPreDestroyChapterApi(id: number, bookId: number) {
|
|
return client.get(`/backend/v1/jc/chapter/${id}/destroy`, { bookId });
|
|
}
|
|
|
|
export function DestroyChapterApi(id: number, bookId: number) {
|
|
return client.destroy(`/backend/v1/jc/chapter/${id}?bookId=${bookId}`);
|
|
}
|
|
|
|
export function CreateChapterApi(name: string, parentId: number, sort: number, bookId: number) {
|
|
return client.post('/backend/v1/jc/chapter/create', {
|
|
name,
|
|
parentId,
|
|
sort,
|
|
bookId,
|
|
});
|
|
}
|
|
export function EditChapterApi(
|
|
id: number,
|
|
name: string,
|
|
parentId: number,
|
|
sort: number,
|
|
bookId: number
|
|
) {
|
|
return client.put(`/backend/v1/jc/chapter/${id}`, {
|
|
name,
|
|
parentId,
|
|
sort,
|
|
bookId,
|
|
});
|
|
}
|
|
|
|
/*chapterContent*/
|
|
export function SaveChapterContentApi(
|
|
chapterId: number,
|
|
content: string,
|
|
resourceIds: any[],
|
|
knowledgeIds: any[],
|
|
highlight: string
|
|
) {
|
|
return client.post(`/backend/v1/jc/chapter-content/${chapterId}`, {
|
|
content,
|
|
resourceIds,
|
|
knowledgeIds,
|
|
highlight,
|
|
});
|
|
}
|
|
|
|
export function GetChapterContentApi(chapterId: number, bookId: number) {
|
|
return client.get(`/backend/v1/jc/chapter-content/${chapterId}`, { bookId });
|
|
}
|
|
|
|
/*
|
|
* Knowledge 知识点
|
|
* */
|
|
|
|
// 获取知识点列表
|
|
export function getKnowledgeListApi(bookId?: number) {
|
|
return client.get('/backend/v1/jc/knowledge/list', { bookId: bookId });
|
|
}
|
|
|
|
// 获取教材下拉列表(不分页,用于选择器)
|
|
export function getTextbookSelectListApi() {
|
|
return client.get('/backend/v1/jc/textbook/selectList', {});
|
|
}
|
|
|
|
// 根据知识点编码列表获取知识点详情(用于编辑回显)
|
|
export function getKnowledgeByCodesApi(codes: string) {
|
|
return client.get('/backend/v1/jc/knowledge/byCodes', { codes });
|
|
}
|
|
|
|
/*
|
|
* resource List
|
|
* */
|
|
|
|
export function AddResourceItemApi(
|
|
bookId: number,
|
|
name: string,
|
|
knowledgeCode: string,
|
|
txtDesc: string,
|
|
extension: string,
|
|
size: number,
|
|
path: string,
|
|
chapterId?: string
|
|
) {
|
|
return client.post(`/jc/resource`, {
|
|
bookId,
|
|
name,
|
|
knowledgeCode,
|
|
txtDesc,
|
|
extension,
|
|
size,
|
|
path,
|
|
chapterId,
|
|
});
|
|
}
|