web-课程任务
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { api } from '@/apis/index';
|
||||
import type { Course, CourseChapter, ResultDomain,CourseVO,PageRequest, PageParam } from '@/types';
|
||||
import type { Course, CourseChapter, ResultDomain,CourseVO,PageRequest, PageParam, CourseNode } from '@/types';
|
||||
|
||||
/**
|
||||
* 课程API服务
|
||||
@@ -60,8 +60,8 @@ export const courseApi = {
|
||||
* @param course 课程数据
|
||||
* @returns Promise<ResultDomain<Course>>
|
||||
*/
|
||||
async updateCourse(course: Course): Promise<ResultDomain<Course>> {
|
||||
const response = await api.put<Course>(`${this.prefixCourse}/course`, course);
|
||||
async updateCourse(courseVO: CourseVO): Promise<ResultDomain<CourseVO>> {
|
||||
const response = await api.put<CourseVO>(`${this.prefixCourse}/course`, courseVO);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
@@ -81,10 +81,68 @@ export const courseApi = {
|
||||
* @param status 状态
|
||||
* @returns Promise<ResultDomain<Course>>
|
||||
*/
|
||||
async updateCourseStatus(courseID: string, status: number): Promise<ResultDomain<Course>> {
|
||||
const response = await api.put<Course>(`${this.prefixCourse}/${courseID}/status`, null, {
|
||||
params: { status }
|
||||
});
|
||||
async updateCourseStatus(course: Course): Promise<ResultDomain<Course>> {
|
||||
const response = await api.put<Course>(`${this.prefixCourse}/course/status`, course);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建课程章节
|
||||
* @param chapter 章节数据
|
||||
* @returns Promise<ResultDomain<CourseChapter>>
|
||||
*/
|
||||
async createCourseChapter(chapter: CourseChapter): Promise<ResultDomain<CourseChapter>> {
|
||||
const response = await api.post<CourseChapter>(`${this.prefixCourse}/course/chapter`, chapter);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新课程章节
|
||||
* @param chapter 章节数据
|
||||
* @returns Promise<ResultDomain<CourseChapter>>
|
||||
*/
|
||||
async updateCourseChapter(chapter: CourseChapter): Promise<ResultDomain<CourseChapter>> {
|
||||
const response = await api.put<CourseChapter>(`${this.prefixCourse}/course/chapter`, chapter);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除课程章节
|
||||
* @param chapterID 章节ID
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async deleteCourseChapter(chapterID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.prefixCourse}/course/chapter/${chapterID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建课程章节节点
|
||||
* @param node 节点数据
|
||||
* @returns Promise<ResultDomain<CourseNode>>
|
||||
*/
|
||||
async createCourseChapterNode(node: CourseNode): Promise<ResultDomain<CourseNode>> {
|
||||
const response = await api.post<CourseNode>(`${this.prefixCourse}/course/chapter/node`, node);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新课程章节节点
|
||||
* @param node 节点数据
|
||||
* @returns Promise<ResultDomain<CourseNode>>
|
||||
*/
|
||||
async updateCourseChapterNode(node: CourseNode): Promise<ResultDomain<CourseNode>> {
|
||||
const response = await api.put<CourseNode>(`${this.prefixCourse}/course/chapter/node`, node);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除课程章节节点
|
||||
* @param nodeID 节点ID
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async deleteCourseChapterNode(nodeID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.prefixCourse}/course/chapter/node/${nodeID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
|
||||
@@ -5,49 +5,60 @@
|
||||
*/
|
||||
|
||||
import { api } from '@/apis/index';
|
||||
import type { LearningTask, LearningProgress, ResultDomain } from '@/types';
|
||||
import type { LearningTask, LearningProgress, ResultDomain, PageParam, TaskVO, TaskUser, TaskItemVO } from '@/types';
|
||||
|
||||
/**
|
||||
* 学习任务API服务
|
||||
*/
|
||||
export const learningTaskApi = {
|
||||
learningTaskPrefix: '/study/tasks',
|
||||
/**
|
||||
* 获取学习任务列表
|
||||
* @param filter 过滤条件
|
||||
* @returns Promise<ResultDomain<LearningTask>>
|
||||
*/
|
||||
async getTaskList(filter?: Partial<LearningTask>): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.get<LearningTask>('/study/learning-task/list', filter);
|
||||
const response = await api.get<LearningTask>(`${this.learningTaskPrefix}/list`, filter);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据ID获取任务详情
|
||||
* @param taskID 任务ID
|
||||
* @returns Promise<ResultDomain<LearningTask>>
|
||||
* @returns Promise<ResultDomain<TaskVO>>
|
||||
*/
|
||||
async getTaskById(taskID: string): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.get<LearningTask>(`/study/learning-task/${taskID}`);
|
||||
async getTaskById(taskID: string): Promise<ResultDomain<TaskVO>> {
|
||||
const response = await api.get<TaskVO>(`${this.learningTaskPrefix}/${taskID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建学习任务
|
||||
* @param task 任务数据
|
||||
* 获取任务分页列表
|
||||
* @param pageParam 分页参数
|
||||
* @param filter 过滤条件
|
||||
* @returns Promise<ResultDomain<LearningTask>>
|
||||
*/
|
||||
async createTask(task: LearningTask): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.post<LearningTask>('/study/learning-task/create', task);
|
||||
async getTaskPage(pageParam: PageParam, filter: LearningTask): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.post<LearningTask>(`${this.learningTaskPrefix}/page`, {pageParam, filter});
|
||||
return response.data;
|
||||
},
|
||||
/**
|
||||
* 创建学习任务
|
||||
* @param task 任务数据
|
||||
* @returns Promise<ResultDomain<TaskVO>>
|
||||
*/
|
||||
async createTask(task: TaskVO): Promise<ResultDomain<TaskVO>> {
|
||||
const response = await api.post<TaskVO>(`${this.learningTaskPrefix}/task`, task);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新学习任务
|
||||
* @param task 任务数据
|
||||
* @returns Promise<ResultDomain<LearningTask>>
|
||||
* @returns Promise<ResultDomain<TaskVO>>
|
||||
*/
|
||||
async updateTask(task: LearningTask): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.put<LearningTask>('/study/learning-task/update', task);
|
||||
async updateTask(task: TaskVO): Promise<ResultDomain<TaskVO>> {
|
||||
const response = await api.put<TaskVO>(`${this.learningTaskPrefix}/task`, task);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
@@ -57,7 +68,7 @@ export const learningTaskApi = {
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async deleteTask(taskID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`/study/learning-task/${taskID}`);
|
||||
const response = await api.delete<boolean>(`${this.learningTaskPrefix}/task/${taskID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
@@ -66,8 +77,8 @@ export const learningTaskApi = {
|
||||
* @param taskID 任务ID
|
||||
* @returns Promise<ResultDomain<LearningTask>>
|
||||
*/
|
||||
async publishTask(taskID: string): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.post<LearningTask>(`/study/learning-task/${taskID}/publish`);
|
||||
async publishTask(task: LearningTask): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.put<LearningTask>(`${this.learningTaskPrefix}/status`, task);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
@@ -78,9 +89,47 @@ export const learningTaskApi = {
|
||||
* @returns Promise<ResultDomain<LearningProgress>>
|
||||
*/
|
||||
async getUserTaskProgress(userID: string, taskID: string): Promise<ResultDomain<LearningProgress>> {
|
||||
const response = await api.get<LearningProgress>(`/study/learning-task/${taskID}/progress`, {
|
||||
const response = await api.get<LearningProgress>(`${this.learningTaskPrefix}/task/${taskID}/progress`, {
|
||||
userID
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 分配任务给用户
|
||||
* @param taskID 任务ID
|
||||
* @param userID 用户ID
|
||||
* @returns Promise<ResultDomain<TaskUser>>
|
||||
*/
|
||||
async assignTaskToUser(taskID: string, userID: string): Promise<ResultDomain<TaskUser>> {
|
||||
const response = await api.post<TaskUser>(`${this.learningTaskPrefix}/${taskID}/assign`, null, {
|
||||
params: { userID }
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 从用户移除任务
|
||||
* @param taskID 任务ID
|
||||
* @param userID 用户ID
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async removeTaskFromUser(taskID: string, userID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.learningTaskPrefix}/${taskID}/user/${userID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户获取个人任务列表(用户视角)
|
||||
* @param pageParam 分页参数
|
||||
* @param filter 过滤条件
|
||||
* @returns Promise<ResultDomain<LearningTask>>
|
||||
*/
|
||||
async getUserTaskPage(pageParam: PageParam, filter?: TaskItemVO): Promise<ResultDomain<LearningTask>> {
|
||||
const response = await api.post<LearningTask>(`${this.learningTaskPrefix}/users/page`, {
|
||||
pageParam,
|
||||
filter
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { api } from '@/apis/index';
|
||||
import type { SysUser, SysUserInfo, UserVO, UserDeptRoleVO, SysUserDeptRole, ResultDomain } from '@/types';
|
||||
import type { SysUser, SysUserInfo, UserVO, UserDeptRoleVO, SysUserDeptRole, ResultDomain, PageParam } from '@/types';
|
||||
import { useStore } from 'vuex';
|
||||
|
||||
const store = useStore();
|
||||
@@ -48,6 +48,31 @@ export const userApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户分页列表
|
||||
* @param pageParam 分页参数
|
||||
* @param filter 过滤条件
|
||||
* @returns Promise<ResultDomain<UserVO>>
|
||||
*/
|
||||
async getUserPage(pageParam: PageParam, filter?: any): Promise<ResultDomain<UserVO>> {
|
||||
const response = await api.post<UserVO>('/users/page', {
|
||||
pageParam,
|
||||
filter
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户分页列表
|
||||
* @param pageParam 分页参数
|
||||
* @param filter 过滤条件
|
||||
* @returns Promise<ResultDomain<SysUser>>
|
||||
*/
|
||||
async getUserPage(pageParam: PageParam, filter: SysUser): Promise<ResultDomain<SysUser>> {
|
||||
const response = await api.post<SysUser>('/users/page', { pageParam, filter });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
* @param user 用户信息
|
||||
|
||||
Reference in New Issue
Block a user