question.js 6.0 KB

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