exam.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import axios from 'axios';
  2. //获取测试卷列表
  3. export function getPaperList(status,subjectId) {
  4. return axios.get('/paper/listPapers',{
  5. params: {
  6. status: status,
  7. subjectId: subjectId
  8. }
  9. })
  10. .then(res => res.data);
  11. }
  12. //新增试卷
  13. export function addPaper(paper) {
  14. return axios({
  15. method: 'post',
  16. url: '/paper/uploadPaper',
  17. data: paper
  18. }).then(res => res.data)
  19. }
  20. //修改试卷
  21. export function updateQuestion(question) {
  22. return axios({
  23. method: 'post',
  24. url: '/question/updateQuestionForPaper',
  25. data: question
  26. }).then(res => res.data)
  27. }
  28. //删除试卷
  29. export function deletePaper(id) {
  30. return axios({
  31. method: 'post',
  32. url: '/paper/delete',
  33. params: {id: id}
  34. }).then(res => res)
  35. }
  36. //获取单张试卷
  37. export function getPaperById(id) {
  38. return axios.get('/paper/getOnePaper/'+id)
  39. .then(res => res.data);
  40. }
  41. //检测是否已经测试
  42. export function checkFirstTest(pid,uid) {
  43. return axios.get('/paper/hasCommit',{
  44. params: {
  45. pid: pid,
  46. uid: uid,
  47. }
  48. })
  49. .then(res => res.data);
  50. }
  51. //提交答题试卷
  52. export function commitPaper(paper) {
  53. return axios({
  54. method: 'post',
  55. url: '/paper/commit',
  56. data: paper
  57. })
  58. .then(res => res.data)
  59. }