import BaseStore from '@src/stores/base'; export default class ExerciseStore extends BaseStore { courseStruct() { return this.allStruct().then((result) => { return result.filter(row => row.isCourse); }); } dataStruct() { return this.allStruct().then((result) => { return result.filter(row => row.isData); }); } allStruct() { return this.apiGet('/exercise/struct/all'); } addStruct(params) { return this.apiPost('/exercise/struct/add', params); } editStruct(params) { return this.apiPut('/exercise/struct/edit', params); } delStruct(params) { return this.apiDel('/exercise/struct/delete', params); } listPaper(params) { return this.apiGet('/exercise/paper/list', params); } listQuestion(params) { return this.apiGet('/exercise/question/list', params); } auto() { return this.apiPost('/exercise/paper/auto'); } } export const Exercise = new ExerciseStore({ key: 'exercise' });