exam.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 updatePaper(paper) {
  22. return axios({
  23. method: 'post',
  24. url: '/paper/updateParams',
  25. data: paper
  26. }).then(res => res.data)
  27. }
  28. //修改试题
  29. export function updateQuestion(question) {
  30. return axios({
  31. method: 'post',
  32. url: '/question/updateQuestionForPaper',
  33. data: question
  34. }).then(res => res.data)
  35. }
  36. //删除试卷
  37. export function deletePaper(id) {
  38. return axios({
  39. method: 'post',
  40. url: '/paper/delete',
  41. params: {id: id}
  42. }).then(res => res)
  43. }
  44. //获取单张试卷
  45. export function getPaperById(id) {
  46. return axios.get('/paper/getOnePaper/'+id)
  47. .then(res => res.data);
  48. }
  49. //检测是否已经测试
  50. export function checkFirstTest(pid,uid) {
  51. return axios.get('/paper/hasCommit',{
  52. params: {
  53. pid: pid,
  54. uid: uid,
  55. }
  56. })
  57. .then(res => res.data);
  58. }
  59. //提交答题试卷
  60. export function commitPaper(paper) {
  61. return axios({
  62. method: 'post',
  63. url: '/paper/commit',
  64. data: paper
  65. })
  66. .then(res => res.data)
  67. }