exercise.js 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import BaseStore from '@src/stores/base';
  2. export default class ExerciseStore extends BaseStore {
  3. courseStruct() {
  4. return this.allStruct().then((result) => {
  5. return result.filter(row => row.isCourse);
  6. });
  7. }
  8. dataStruct() {
  9. return this.allStruct().then((result) => {
  10. return result.filter(row => row.isData);
  11. });
  12. }
  13. allStruct() {
  14. return this.apiGet('/exercise/struct/all');
  15. }
  16. addStruct(params) {
  17. return this.apiPost('/exercise/struct/add', params);
  18. }
  19. editStruct(params) {
  20. return this.apiPut('/exercise/struct/edit', params);
  21. }
  22. delStruct(params) {
  23. return this.apiDel('/exercise/struct/delete', params);
  24. }
  25. listPaper(params) {
  26. return this.apiGet('/exercise/paper/list', params);
  27. }
  28. listQuestion(params) {
  29. return this.apiGet('/exercise/question/list', params);
  30. }
  31. auto() {
  32. return this.apiPost('/exercise/paper/auto');
  33. }
  34. }
  35. export const Exercise = new ExerciseStore({ key: 'exercise' });