You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
3.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { request } from 'umi';
import type { TableListItem } from './data';
/** 获取课程列表 GET /dsideal_yy/ypt/careerTraining/course/list */
export async function queryCourseList(
params: {
// query
/** 当前的页码 */
current?: number;
/** 页面的容量 */
pageSize?: number;
},
options?: Record<string, any>,
) {
return request<{
data: TableListItem[];
/** 列表的内容总数 */
total_row?: number;
/** 页面的容量 */
page_size?: number;
success?: boolean;
}>('/dsideal_yy/ypt/careerTraining/course/list', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 获取课程列表(不分页) GET /dsideal_yy/ypt/careerTraining/course/list */
export async function queryCourseListByTag(
params: {
tag_ids?: string; // 过滤标签
},
options?: Record<string, any>,
) {
return request<{
data: TableListItem[];
/** 列表的内容总数 */
total_row?: number;
/** 页面的容量 */
page_size?: number;
success?: boolean;
}>('/dsideal_yy/ypt/careerTraining/component/listCourseByTag', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/**
* 获取主题列表
* http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426
* @param params
* @returns
*/
export async function querySubjectList(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', {
params,
});
}
/** 新建/修改课程 POST /dsideal_yy/ypt/careerTraining/course/save */
export async function saveCourse(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/course/save', {
data,
method: 'POST',
requestType: 'form',
...(options || {}),
});
}
/** 删除课程 POST /dsideal_yy/ypt/careerTraining/course/delete */
export async function removeCourse(data: { key: number[] }, options?: Record<string, any>) {
console.log('data:::', data);
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
data: { course_id: data?.key[0] }, // 当前接口不支持批量操作
method: 'POST',
requestType: 'form',
...(options || {}),
});
}
/** 查看课程仅仅获取课程详情不标记浏览量GET /dsideal_yy/ypt/careerTraining/course/view */
export async function queryCourseView(params: {
course_id: number;
//count: number;
}): Promise<{ data: { list: any } }> {
return request('/dsideal_yy/ypt/careerTraining/course/view', {
params,
});
}
/** 新建/修改主题 POST /dsideal_yy/ypt/careerTraining/subject/saveSubject */
export async function saveSubject(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/subject/saveSubject', {
data,
method: 'POST',
requestType: 'form',
...(options || {}),
});
}
/** 新建/修改课程标签 POST /dsideal_yy/ypt/careerTraining/course/save */
export async function saveTag(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/tag/save', {
data,
method: 'POST',
requestType: 'form',
...(options || {}),
});
}
/** 获取标签列表 GET /dsideal_yy/ypt/careerTraining/tag/list */
export async function queryTagList(
params: {
// query
/** 当前的页码 */
current?: number;
/** 页面的容量 */
pageSize?: number;
},
options?: Record<string, any>,
) {
return request<{
data: TableListItem[];
/** 列表的内容总数 */
total?: number;
success?: boolean;
}>('/dsideal_yy/ypt/careerTraining/tag/list', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}