import request from '@/utils/request'

const courseApi = {
    add: '/courseManagement/course/addOrUpdate',
    get: '/courseManagement/course/details',
    //   update: 'sys/menu/update',
    del: 'courseManagement/course/delete',
    //   updateStatus: 'sys/menu/updateStatus',
    list: '/courseManagement/course/listPage',
    coursewareList: '/courseManagement/course/courseware/details',
    questionList: '/courseManagement/course/questionList',
    listByClass: '/courseManagement/course/list',
}

export function courseAdd(params) {
    return request({
        url: courseApi.add,
        method: 'post',
        data: params
    })
}
export function listByClass(params) {
    return request({
        url: courseApi.listByClass,
        method: 'get',
        params: params
    })
}
// export function menuUpdate (params) {
//   return request({
//     url: menuApi.update,
//     method: 'post',
//     data: params
//   })
// }

export function deleteCourse(params) {
    return request({
        url: courseApi.del,
        method: 'delete',
        params: params
    })
}

// 查询课程列表
export function getCourseList(params) {
    if (params.tag) params.tag = params.tag.toString();
    return request({
        url: courseApi.list,
        method: 'get',
        params: params
    })
}

// 查看课程详情
export function getCourseDetails(params) {
    return request({
        url: courseApi.get,
        method: 'get',
        params: params
    })
}

//通过课程ID获取课件列表
export function getCoursewareListByCourseId(params) {
    return request({
        url: courseApi.coursewareList,
        method: 'get',
        params: params
    })
}

//通过课程ID获取题目列表
export function getQuestionListByCourseId(params) {
    return request({
        url: courseApi.questionList,
        method: 'get',
        params: params
    })
}