|
|
// 考试相关的接口,包括考试、问题、选项和评分等接口
|
|
|
|
|
|
import api from './index'
|
|
|
import { axios } from '../utils/request'
|
|
|
|
|
|
// 导出一个函数,用于获取问题列表
|
|
|
export function getQuestionList (parameter) {
|
|
|
// 使用axios发送get请求,获取问题列表
|
|
|
return axios({
|
|
|
url: api.ExamQuestionList, // 请求的URL
|
|
|
method: 'get', // 请求的方法
|
|
|
params: parameter // 请求的参数
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取所有题目
|
|
|
export function getQuestionAll () {
|
|
|
// 使用axios发送get请求,获取所有题目
|
|
|
return axios({
|
|
|
url: api.ExamQuestionAll,
|
|
|
method: 'get'
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个名为questionUpdate的函数,参数为parameter
|
|
|
export function questionUpdate (parameter) {
|
|
|
// 打印参数
|
|
|
console.log(parameter)
|
|
|
// 返回一个axios请求,请求的url为api.ExamQuestionUpdate,请求方法为post,请求的数据为parameter
|
|
|
return axios({
|
|
|
url: api.ExamQuestionUpdate,
|
|
|
method: 'post',
|
|
|
data: parameter
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取题目选择
|
|
|
export function getQuestionSelection () {
|
|
|
// 使用axios发送get请求,获取题目选择
|
|
|
return axios({
|
|
|
// 请求的URL
|
|
|
url: api.ExamQuestionSelection,
|
|
|
// 请求的方法
|
|
|
method: 'get',
|
|
|
// 请求的头部信息
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个名为questionCreate的函数,参数为parameter
|
|
|
export function questionCreate (parameter) {
|
|
|
// 打印参数
|
|
|
console.log(parameter)
|
|
|
// 使用axios发送post请求,url为api.ExamQuestionCreate,参数为parameter
|
|
|
return axios({
|
|
|
url: api.ExamQuestionCreate,
|
|
|
method: 'post',
|
|
|
data: parameter
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取考试列表
|
|
|
export function getExamList (parameter) {
|
|
|
// 使用axios发送get请求,获取考试列表
|
|
|
return axios({
|
|
|
url: api.ExamList,
|
|
|
method: 'get',
|
|
|
params: parameter
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取所有考试
|
|
|
export function getExamAll () {
|
|
|
// 使用axios发送get请求,获取所有考试
|
|
|
return axios({
|
|
|
url: api.ExamAll,
|
|
|
method: 'get'
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取所有问题,按照单选、多选和判断进行分类
|
|
|
export function getExamQuestionTypeList () {
|
|
|
// 使用axios发送get请求,获取所有问题,按照单选、多选和判断进行分类
|
|
|
return axios({
|
|
|
url: api.ExamQuestionTypeList,
|
|
|
method: 'get',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取考试卡片列表
|
|
|
export function getExamCardList () {
|
|
|
// 使用axios发送get请求,获取考试卡片列表
|
|
|
return axios({
|
|
|
url: api.ExamCardList,
|
|
|
method: 'get',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数examCreate,用于创建考试
|
|
|
export function examCreate (parameter) {
|
|
|
// 打印传入的参数
|
|
|
console.log(parameter)
|
|
|
// 返回一个axios请求,请求的url为api.ExamCreate,请求方法为post,请求的数据为parameter
|
|
|
return axios({
|
|
|
url: api.ExamCreate,
|
|
|
method: 'post',
|
|
|
data: parameter
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数examUpdate,用于更新考试
|
|
|
export function examUpdate (parameter) {
|
|
|
// 打印传入的参数
|
|
|
console.log(parameter)
|
|
|
// 返回一个axios请求,请求的url为api.ExamUpdate,请求方法为post,请求的数据为parameter
|
|
|
return axios({
|
|
|
url: api.ExamUpdate,
|
|
|
method: 'post',
|
|
|
data: parameter
|
|
|
})
|
|
|
}
|
|
|
// 导出一个函数,用于获取考试详情
|
|
|
export function getExamDetail (examId) {
|
|
|
// 使用axios发送get请求,获取考试详情
|
|
|
return axios({
|
|
|
url: api.ExamDetail + examId, // 请求的URL,拼接了examId
|
|
|
method: 'get', // 请求方法为get
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8' // 设置请求头,指定请求体的类型为json
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取考试记录详情
|
|
|
export function getExamRecordDetail (recordId) {
|
|
|
// 使用axios发送get请求,获取考试记录详情
|
|
|
return axios({
|
|
|
url: api.recordDetail + recordId, // 请求的URL,拼接了recordId
|
|
|
method: 'get', // 请求方法为get
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8' // 设置请求头,指定请求体的类型为json
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取问题详情
|
|
|
export function getQuestionDetail (questionId) {
|
|
|
// 使用axios发送get请求,获取问题详情
|
|
|
return axios({
|
|
|
url: api.QuestionDetail + questionId,
|
|
|
method: 'get',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于完成考试
|
|
|
export function finishExam (examId, answersMap) {
|
|
|
// 打印答案
|
|
|
console.log(answersMap)
|
|
|
// 使用axios发送post请求,完成考试
|
|
|
return axios({
|
|
|
url: api.FinishExam + examId,
|
|
|
method: 'post',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
|
},
|
|
|
data: answersMap
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于获取考试记录列表
|
|
|
export function getExamRecordList () {
|
|
|
// 使用axios发送get请求,获取考试记录列表
|
|
|
return axios({
|
|
|
url: api.ExamRecordList,
|
|
|
method: 'get',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
|
}
|
|
|
})
|
|
|
}
|