problemAPI.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import {axios} from "../utils/request";
  2. const api = {
  3. pre: "problem",
  4. };
  5. export function getProblemsAPI() {
  6. return axios({
  7. url: `${api.pre}`,
  8. method: "GET",
  9. });
  10. }
  11. export function getProblemManageListAPI() {
  12. return axios({
  13. url: `${api.pre}/manage`,
  14. method: "GET",
  15. });
  16. }
  17. export function getProblemManageAPI(problemId) {
  18. return axios({
  19. url: `${api.pre}/manage/`+problemId,
  20. method: "GET",
  21. });
  22. }
  23. export function getProblemDetailAPI(problemId) {
  24. return axios({
  25. url: `${api.pre}/`+problemId,
  26. method: "GET",
  27. });
  28. }
  29. export function addProblemAPI(data) {
  30. return axios({
  31. url: `${api.pre}`,
  32. method: "POST",
  33. data
  34. });
  35. }
  36. export function deleteProblemAPI(problemId){
  37. return axios({
  38. url: `${api.pre}`,
  39. method: "DELETE",
  40. params:{
  41. problemId:problemId
  42. }
  43. });
  44. }
  45. export function getTestCasesByProblemIdAPI(problemId){
  46. return axios({
  47. url: `${api.pre}/testcase`,
  48. method: "GET",
  49. params:{
  50. problemId:problemId
  51. }
  52. });
  53. }
  54. export function addTestCaseAPI(data) {
  55. return axios({
  56. url: `${api.pre}/testcase`,
  57. method: "POST",
  58. data
  59. });
  60. }
  61. export function batchAddTestCaseAPI(data) {
  62. return axios({
  63. url: `${api.pre}/batchTestcase`,
  64. method: "POST",
  65. data
  66. });
  67. }
  68. export function delTestCaseAPI(testCaseId) {
  69. return axios({
  70. url: `${api.pre}/testcase`,
  71. method: "DELETE",
  72. params:{
  73. testCaseId:testCaseId
  74. }
  75. });
  76. }