question.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. import BaseStore from '@src/stores/base';
  2. export default class QuestionStore extends BaseStore {
  3. startLink(type, item) {
  4. const w = window.open('about:blank');
  5. w.location.href = `/paper/process/${type}/${item.id}`;
  6. }
  7. continueLink(type, item) {
  8. const w = window.open('about:blank');
  9. w.location.href = `/paper/process/${type}/${item.id}?r=${item.report.id}`;
  10. }
  11. reportLink(item) {
  12. const w = window.open('about:blank');
  13. w.location.href = `/paper/report/${item.report.id}`;
  14. }
  15. /**
  16. * 练习进度
  17. * @param {*} structId
  18. */
  19. getExerciseProgress(structId) {
  20. return this.apiGet('/question/exercise/progress', { structId });
  21. }
  22. /**
  23. * 查询第4层考点信息
  24. * @param {*} structId
  25. */
  26. getExercisePlace(structId) {
  27. return this.apiGet('/question/exercise/place', { structId });
  28. }
  29. /**
  30. * 练习组卷
  31. * @param {*} page
  32. * @param {*} size
  33. * @param {*} structId
  34. * @param {*} logic
  35. * @param {*} logicExtend
  36. * @param {*} finish: true完成,false未完成
  37. */
  38. getExerciseList({ page, size, structId, logic, logicExtend, finish }) {
  39. return this.apiGet('/question/exercise/list', { page, size, structId, logic, logicExtend, times: finish ? 1 : null });
  40. }
  41. /**
  42. * 模考进度
  43. * @param {*} page
  44. * @param {*} size
  45. */
  46. getExaminationProgress(page, size) {
  47. return this.apiGet('/question/examination/progress', { page, size });
  48. }
  49. /**
  50. * 模考组卷
  51. * @param {*} page
  52. * @param {*} size
  53. */
  54. getExaminationList(page, size) {
  55. return this.apiGet('/question/examination/list', { page, size });
  56. }
  57. /**
  58. * 通过题目Id获取详情
  59. * @param {*} userQuestionId
  60. */
  61. getDetailById(userQuestionId) {
  62. return this.apiGet('/question/detail', { userQuestionId });
  63. }
  64. /**
  65. * 通过记录及序号获取基础信息
  66. * @param {*} userReportId
  67. * @param {*} no
  68. */
  69. getDetailByNo(userReportId, no) {
  70. return this.apiGet('/question/base', { userReportId, no });
  71. }
  72. /**
  73. * 获取练习卷
  74. * @param {*} paperId
  75. */
  76. getExercisePaper(paperId) {
  77. return this.apiGet('/question/exercise/paper', { paperId });
  78. }
  79. /**
  80. * 获取模考卷
  81. * @param {*} paperId
  82. */
  83. getExaminationPaper(paperId) {
  84. return this.apiGet('/question/examination/paper', { paperId });
  85. }
  86. /**
  87. * 获取错题组卷
  88. * @param {*} paperId
  89. */
  90. getErrorPaper(paperId) {
  91. return this.apiGet('/question/error/paper', { paperId });
  92. }
  93. /**
  94. * 获取收藏组卷
  95. * @param {*} paperId
  96. */
  97. getCollectPaper(paperId) {
  98. return this.apiGet('/quesiton/collect/paper', { paperId });
  99. }
  100. /**
  101. * 获取组卷
  102. * @param {*} type
  103. * @param {*} paperId
  104. */
  105. getPaper(type, paperId) {
  106. return this.apiGet(`/question/${type}/paper`, { paperId });
  107. }
  108. /**
  109. * 获取做题记录
  110. * @param {*} userReportId
  111. */
  112. baseReport(userReportId) {
  113. return this.apiGet('/question/report/base', { userReportId });
  114. }
  115. /**
  116. * 获取做题详细记录
  117. * @param {*} userReportId
  118. */
  119. detailReport(userReportId) {
  120. return this.apiGet('/question/report/detail', { userReportId });
  121. }
  122. /**
  123. * 获取做题题目记录
  124. * @param {*} userReportId
  125. */
  126. questionReport(userReportId) {
  127. return this.apiGet('/question/report/detail', { userReportId });
  128. }
  129. /**
  130. * 开始考试
  131. * @param {*} type
  132. * @param {*} paperId
  133. * @param {*} disorder
  134. * @param {*} order: 模考
  135. */
  136. start(type, paperId, { disorder, order }) {
  137. return this.apiPost(`/question/${type}/start`, { paperId, disorder, order });
  138. }
  139. /**
  140. * 下一题
  141. * @param {*} userReportId
  142. */
  143. next(userReportId) {
  144. return this.apiPost('/question/next', { userReportId });
  145. }
  146. /**
  147. * 提交题目答案
  148. * @param {*} userQuestionId
  149. * @param {*} answer
  150. * @param {*} time
  151. * @param {*} setting
  152. */
  153. submit(userQuestionId, answer, time, setting) {
  154. return this.apiPost('/question/submit', { userQuestionId, answer, time, setting });
  155. }
  156. /**
  157. * 完成考试
  158. * @param {*} userReportId
  159. */
  160. finish(userReportId) {
  161. return this.apiPost('/question/finish', { userReportId });
  162. }
  163. /**
  164. * 继续考试
  165. * @param {*} userReportId
  166. */
  167. continue(userReportId) {
  168. return this.apiPost('/question/continue', { userReportId });
  169. }
  170. /**
  171. * 模考:下一阶段
  172. * @param {*} userPaperId
  173. */
  174. stage(userReportId) {
  175. return this.apiPost('/question/stage', { userReportId });
  176. }
  177. /**
  178. * 重置考试
  179. * @param {*} userPaperId
  180. */
  181. restart(userPaperId) {
  182. return this.apiPost('/question/restart/paper', { userPaperId });
  183. }
  184. /**
  185. * 重置整套模考卷
  186. * @param {*} structId
  187. */
  188. restartExamination(structId) {
  189. return this.apiPost('/question/restart/examination', { structId });
  190. }
  191. }
  192. export const Question = new QuestionStore({ key: 'question' });