exam.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import { delete0, get, post } from '@/utils/request'
  2. const examApi = {
  3. // *********************************************************************************************************************
  4. // 科目接口
  5. getSubject: '/api/content/exam/subject',
  6. getSubjectKV: '/api/content/exam/subject/kv',
  7. // *********************************************************************************************************************
  8. // 试题接口
  9. getQuestionType: '/api/content/exam/question/type',
  10. getQuestion: '/api/content/exam/question',
  11. addQuestion: '/api/content/exam/question',
  12. // *********************************************************************************************************************
  13. // 试卷接口
  14. getPaper: '/api/content/exam/paper',
  15. getPaperDetail: '/api/content/exam/paper/detail',
  16. getPaperKeyValue: '/api/content/exam/paper/kv',
  17. addPaper: '/api/content/exam/paper',
  18. // *********************************************************************************************************************
  19. // 考试接口
  20. examList: '/api/content/exam/eval/list',
  21. startExam: '/api/content/exam/eval/start',
  22. cacheUserAnswer: '/api/content/exam/eval/cache',
  23. submitExam: '/api/content/exam/eval/submit',
  24. // *********************************************************************************************************************
  25. // 阅卷接口
  26. getExamMarkList: '/api/content/exam/mark/list',
  27. getMarkView: '/api/content/exam/mark/view',
  28. submitExamMark: '/api/content/exam/mark/submit'
  29. }
  30. // *********************************************************************************************************************
  31. // 科目接口
  32. export function getSubject() {
  33. return get(examApi.getSubject)
  34. }
  35. export function getSubjectKV() {
  36. return get(examApi.getSubjectKV)
  37. }
  38. // *********************************************************************************************************************
  39. // 试题接口
  40. export function getQuestionType() {
  41. return get(examApi.getQuestionType)
  42. }
  43. export function getQuestions(param) {
  44. return get(examApi.getQuestion, param)
  45. }
  46. export function deleteQuestion(questionId) {
  47. return delete0(examApi.getQuestion + '/' + questionId)
  48. }
  49. export function getQuestion(questionId) {
  50. return get(examApi.getQuestion + '/' + questionId)
  51. }
  52. export function addQuestion(data) {
  53. return post(examApi.addQuestion, data)
  54. }
  55. // *********************************************************************************************************************
  56. // 试卷接口
  57. export function getPapers(param) {
  58. return get(examApi.getPaper, param)
  59. }
  60. export function getPaper(paperId, viewType, userId) {
  61. return get(examApi.getPaperDetail + '?paperId=' + paperId + '&viewType=' + viewType + '&userId=' + userId)
  62. }
  63. export function getPaperKeyValues() {
  64. return get(examApi.getPaperKeyValue)
  65. }
  66. export function addPaper(data) {
  67. return post(examApi.addPaper, data)
  68. }
  69. export function deletePaper(paperId) {
  70. return delete0(examApi.addPaper + '/' + paperId)
  71. }
  72. // *********************************************************************************************************************
  73. // 考试接口
  74. export function getExamList() {
  75. return get(examApi.examList)
  76. }
  77. export function getExamInfo(paperId) {
  78. return get(examApi.startExam + '/' + paperId)
  79. }
  80. export function getPaperQuestions(paperId) {
  81. return get('/api/content/exam/paper/' + paperId + '/question')
  82. }
  83. export function submitExam(data) {
  84. return post(examApi.submitExam, data)
  85. }
  86. export function cacheUserAnswer(data) {
  87. return post(examApi.cacheUserAnswer, data)
  88. }
  89. // *********************************************************************************************************************
  90. // 阅卷接口
  91. export function getMarkView(paperId, userId) {
  92. return get(examApi.getMarkView + '?paperId=' + paperId + '&userId=' + userId)
  93. }
  94. export function getExamMarkList(params) {
  95. return get(examApi.getExamMarkList, params)
  96. }
  97. export function submitExamMark(data) {
  98. return post(examApi.submitExamMark, data)
  99. }
  100. // *********************************************************************************************************************
  101. // 考试结果接口
  102. export function getResultView(paperId) {
  103. return get('/api/content/exam/result/view/' + paperId)
  104. }