视图修改、接口修改
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { api } from '@/apis/index';
|
||||
import type { Course, CourseChapter, ResultDomain,CourseVO,PageRequest, PageParam, CourseNode } from '@/types';
|
||||
import type { Course, CourseChapter, ResultDomain, CourseItemVO, PageParam, CourseNode } from '@/types';
|
||||
|
||||
/**
|
||||
* 课程API服务
|
||||
@@ -38,30 +38,40 @@ export const courseApi = {
|
||||
/**
|
||||
* 根据ID获取课程详情
|
||||
* @param courseID 课程ID
|
||||
* @returns Promise<ResultDomain<Course>>
|
||||
* @returns Promise<ResultDomain<CourseItemVO>>
|
||||
*/
|
||||
async getCourseById(courseID: string): Promise<ResultDomain<CourseVO>> {
|
||||
const response = await api.get<CourseVO>(`${this.prefixCourse}/${courseID}`);
|
||||
async getCourseById(courseID: string): Promise<ResultDomain<CourseItemVO>> {
|
||||
const response = await api.get<CourseItemVO>(`${this.prefixCourse}/${courseID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取课程学习进度
|
||||
* @param courseID 课程ID
|
||||
* @returns Promise<ResultDomain<CourseItemVO>>
|
||||
*/
|
||||
async getCourseProgress(courseID: string): Promise<ResultDomain<CourseItemVO>> {
|
||||
const response = await api.get<CourseItemVO>(`${this.prefixCourse}/${courseID}/progress`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建课程
|
||||
* @param course 课程数据
|
||||
* @returns Promise<ResultDomain<Course>>
|
||||
* @param courseItemVO 课程数据
|
||||
* @returns Promise<ResultDomain<CourseItemVO>>
|
||||
*/
|
||||
async createCourse(course: CourseVO): Promise<ResultDomain<CourseVO>> {
|
||||
const response = await api.post<CourseVO>(`${this.prefixCourse}/course`, course);
|
||||
async createCourse(courseItemVO: CourseItemVO): Promise<ResultDomain<CourseItemVO>> {
|
||||
const response = await api.post<CourseItemVO>(`${this.prefixCourse}/course`, courseItemVO);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新课程
|
||||
* @param course 课程数据
|
||||
* @returns Promise<ResultDomain<Course>>
|
||||
* @param courseItemVO 课程数据
|
||||
* @returns Promise<ResultDomain<CourseItemVO>>
|
||||
*/
|
||||
async updateCourse(courseVO: CourseVO): Promise<ResultDomain<CourseVO>> {
|
||||
const response = await api.put<CourseVO>(`${this.prefixCourse}/course`, courseVO);
|
||||
async updateCourse(courseItemVO: CourseItemVO): Promise<ResultDomain<CourseItemVO>> {
|
||||
const response = await api.put<CourseItemVO>(`${this.prefixCourse}/course`, courseItemVO);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ export const learningTaskApi = {
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async deleteTask(taskID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.learningTaskPrefix}/task/${taskID}`);
|
||||
const response = await api.delete<boolean>(`${this.learningTaskPrefix}/task`, {taskID});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user