import request from '@/utils/request'

// 查询考试列表
export function listExam(query) {
  return request({
    url: '/exam/exam/list',
    method: 'get',
    params: query
  })
}
// 查询个人考试列表
export function onlineExamList(query) {
  return request({
    url: '/exam/exam/onlineExamList',
    method: 'get',
    params: query
  })
}

// 查询我的证书
export function myCertList(data) {
  return request({
    url: '/exam/exam/queryMyCert',
    method: 'post',
    data: data
  })
}

// 查询考试详细
export function getExam(id) {
  return request({
    url: '/exam/exam/' + id,
    method: 'get'
  })
}

// 新增考试
export function addExam(data) {
  return request({
    url: '/exam/exam',
    method: 'post',
    data: data
  })
}

// 修改考试
export function updateExam(data) {
  return request({
    url: '/exam/exam',
    method: 'put',
    data: data
  })
}

// 修改考试关联的培训
export function updateSafeTrain(data) {
  return request({
    url: '/exam/exam/saveSafeTrainById',
    method: 'post',
    data: data
  })
}

// 修改考试关联的证书
export function updateCert(data) {
  return request({
    url: '/exam/exam/saveCertById',
    method: 'post',
    data: data
  })
}

// 删除考试
export function delExam(id) {
  return request({
    url: '/exam/exam/' + id,
    method: 'delete'
  })
}
