/*
 * @Author: 纪泽龙 jizelong@qq.com
 * @Date: 2022-09-23 11:02:24
 * @LastEditors: 纪泽龙 jizelong@qq.com
 * @LastEditTime: 2023-01-29 14:53:07
 * @FilePath: /danger-manage-web/src/api/train/trainingProgram.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'
//培训计划管理


// 获取所有课程
export function getLessons(query) {
  return request({
    url: '/train/course/list',
    method: 'get',
    params: query
  })
}

// 当前用户的课程列表
export function getUserLessons(query) {
  return request({
    url: 'train/course/userCourseList',
    method: 'get',
    params: query
  })
}
// 用id查询课程
export function getLessonById(id) {
  return request({
    url: 'train/course/'+id,
    method: 'get',
  })
}
//用户课程状态
export function getUserLessonById(query) {
  return request({
    url: 'train/course/userCourse',
    method: 'get',
    params: query
  })
}
// 添加课程
export function addLessons(data) {
  return request({
    url: '/train/course',
    method: 'post',
    data: data
  })
}
// // 修改课程
export function changeLesson(data) {
  return request({
    url: '/train/course',
    method: 'put',
    data:data
  })
}
// // 修改用户课程
export function changeUserLesson(data) {
  return request({
    url: '/train/course/editUserCourse',
    method: 'put',
    data:data
  })
}
// 发布课程
export function issue(query) {
  return request({
    url: '/train/course/release',
    method: 'get',
    params: query
  })
}
// 删除课程
export function deleteLesson(query) {
  return request({
    url: '/train/course/'+query,
    method: 'delete',
  })
}

//考试发布
export function testPublish(data) {
  return request({
    url: '/train/course/testPublish',
    method: 'post',
    data:data
  })
}





// 获取课程的题目详情列表列表
export function getQuestion(query) {
  return request({
    url: '/train/topic/list',
    method: 'get',
    params: query
  })
}




// 添加课程考试题目
export function addQuestion(data) {
  return request({
    url: '/train/topic',
    method: 'post',
    data: data
  })
}
// 修改课程考试题目
export function changeQuestion(data) {
  return request({
    url: '/train/topic',
    method: 'put',
    data: data
  })
}
// 删除
export function deleteQuestion(query) {
  return request({
    url: 'train/topic/'+query,
    method: 'delete',
    // params: query
  })
}
// 查看单独题目
export function checkQuestion(query) {
  return request({
    url: '/train/topic/'+query,
    method: 'get',
  })
}
// 考试的题目
export function userQuestionList(query) {
  return request({
    url: '/train/topic/topiclist',
    method: 'get',
    params: query
  })
}

// 交卷
export function setAnswer(query) {
  return request({
    url: '/train/course/examination',
    method: 'get',
    params: query
  })
}

//统计
export function statisticsTrainCourse(query) {
  return request({
    url: '/train/course/statisticsTrainCourse',
    method: 'get',
    params: query
  })
}

//成绩详情
export function testPersonDetailByCourseId(query) {
  return request({
    url: '/train/course/testPersonDetailByCourseId',
    method: 'get',
    params: query
  })
}

/**
 * 从题库导入试题
 * @param data
 */
export function bachAddTopic(data) {
  return request({
    url: 'train/topic/bachAddTopic',
    method: 'post',
    data: data
  })
}

/*export function bachAddTopicGuest(data) {
  return request({
    url: '/contractTrainTopic/bachAddTopic',
    method: 'post',
    data: data
  })
}*/
export function exportDeviceInfo(query) {
  return request({
    url: '/train/course/examDetails',
    method: 'get',
    params: query
  })
}


