my.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import BaseStore from '@src/stores/base';
  2. export default class MyStore extends BaseStore {
  3. /**
  4. * 绑定邮箱
  5. * @param {*} email 邮箱
  6. */
  7. bindEmail(email) {
  8. return this.apiPost('/auth/email', { email });
  9. }
  10. /**
  11. * 修改用户信息
  12. * @param {*} info nickname avatar
  13. */
  14. editInfo(info) {
  15. return this.apiPost('/auth/info', { ...info });
  16. }
  17. /**
  18. * 实名认证
  19. * @param {*} file
  20. */
  21. real(file) {
  22. return this.apiForm('/auth/real', { file });
  23. }
  24. /**
  25. * 用户站内信
  26. * @param {*} page
  27. * @param {*} size
  28. * @param {*} type
  29. * @param {*} read
  30. */
  31. message(page, size, type, read) {
  32. return this.apiGet('/auth/message', { page, size, type, read });
  33. }
  34. /**
  35. * 读取用户消息/全部
  36. */
  37. readAllMessage() {
  38. return this.apiPut('/auth/message/read', { all: true });
  39. }
  40. /**
  41. * 读取用户消息
  42. */
  43. readMessage(id) {
  44. return this.apiPut('/auth/message/read', { all: false, id });
  45. }
  46. /**
  47. * 修改备考信息
  48. * @param {*} info prepareStatus: 身份 prepareGoal: 目标分数 prepareExaminationTime: 考试时间 prepareScoreTime: 出分时间
  49. */
  50. editPrepare(info) {
  51. return this.apiPut('/auth/prepare', { ...info });
  52. }
  53. /**
  54. * 获取备考信息
  55. */
  56. getPrepare() {
  57. return this.apiGet('/auth/prepare');
  58. }
  59. /**
  60. * 获取学习记录
  61. * @param {*} date 时间
  62. */
  63. getStudy(date) {
  64. return this.apiGet('/auth/study', { date });
  65. }
  66. /**
  67. * 添加收藏
  68. * @param {*} questionNoId
  69. */
  70. addCollect(module, questionNoId) {
  71. return this.apiPut('/auth/collect', { module, questionNoId });
  72. }
  73. /**
  74. * 删除收藏
  75. * @param {*} questionNoId
  76. */
  77. delCollect(module, questionNoId) {
  78. return this.apiDel('/auth/collect', { module, id: questionNoId });
  79. }
  80. /**
  81. * 收藏卷组
  82. * @param {*} ids
  83. */
  84. bindCollect(ids) {
  85. return this.apiPost('/auth/collect/bind', { questionNoIds: ids });
  86. }
  87. /**
  88. * 获取收藏题目列表
  89. * @param {*} module
  90. * @param {*} type
  91. * @param {*} page
  92. * @param {*} size
  93. * @param {*} startTime
  94. * @param {*} endTime
  95. * @param {*} order
  96. * @param {*} direction
  97. */
  98. listCollect(module, type, page, size, startTime, endTime, order, direction) {
  99. return this.apiGet('/auth/collect/question', { module, type, page, size, startTime, endTime, order, direction });
  100. }
  101. /**
  102. * 获取错题列表
  103. * @param {*} module
  104. * @param {*} type
  105. * @param {*} page
  106. * @param {*} size
  107. */
  108. listError(module, type, page, size) {
  109. return this.apiGet('/auth/error/list', { module, type, page, size });
  110. }
  111. /**
  112. * 错题组卷
  113. * @param {*} ids
  114. * @param {*} times
  115. */
  116. bindError(ids, times) {
  117. return this.apiPost('/auth/error/bind', { questionNoIds: ids, filterTimes: times });
  118. }
  119. /**
  120. * 错题移除
  121. * @param {*} ids
  122. */
  123. clearError(ids) {
  124. return this.apiPost('/auth/error/clear', { questionNoIds: ids });
  125. }
  126. /**
  127. * 更新笔记
  128. * @param {*} questionNoId
  129. * @param {*} content
  130. */
  131. updateNote(questionNoId, content) {
  132. return this.apiPut('/auth/note', { questionNoId, content });
  133. }
  134. /**
  135. * 获取笔记列表
  136. * @param {*} module
  137. * @param {*} type
  138. * @param {*} page
  139. * @param {*} size
  140. * @param {*} startTime
  141. * @param {*} endTime
  142. * @param {*} order
  143. * @param {*} direction
  144. */
  145. noteList(module, type, page, size, startTime, endTime, order, direction) {
  146. return this.apiGet('/auth/note/list', { module, type, page, size, startTime, endTime, order, direction });
  147. }
  148. /**
  149. * 获取报告列表
  150. * @param {*} module
  151. * @param {*} type
  152. * @param {*} page
  153. * @param {*} size
  154. * @param {*} startTime
  155. * @param {*} endTime
  156. * @param {*} order
  157. * @param {*} direction
  158. */
  159. reportList(module, type, page, size, startTime, endTime, order, direction) {
  160. return this.apiGet('/auth/report/list', { module, type, page, size, startTime, endTime, order, direction });
  161. }
  162. }
  163. export const My = new MyStore({ key: 'my' });