my.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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('/my/email', { email });
  9. }
  10. /**
  11. * 绑定手机
  12. * @param {*} area
  13. * @param {*}
  14. */
  15. bindMobile(area, mobile, mobileVerifyCode) {
  16. return this.apiPost('/my/mobile', { area, mobile, mobileVerifyCode });
  17. }
  18. /**
  19. * 修改用户信息
  20. * @param {*} info nickname avatar
  21. */
  22. editInfo(info) {
  23. return this.apiPost('/my/info', { ...info });
  24. }
  25. /**
  26. * 发送邀请码到邮箱
  27. * @param {*} emails
  28. */
  29. inviteEmail(emails) {
  30. return this.apiPost('/my/invite/email', { emails });
  31. }
  32. getVipInfo() {
  33. return this.apiGet('/my/vip/info');
  34. }
  35. /**
  36. * 用户站内信
  37. * @param {*} page
  38. * @param {*} size
  39. * @param {*} messageType
  40. * @param {*} read
  41. */
  42. message({ page, size, messageType, read }) {
  43. return this.apiGet('/my/message', { page, size, messageType, read });
  44. }
  45. /**
  46. * 读取用户消息/全部
  47. */
  48. readAllMessage() {
  49. return this.apiPut('/my/message/read', { all: true });
  50. }
  51. /**
  52. * 读取用户消息
  53. */
  54. readMessage(id) {
  55. return this.apiPut('/my/message/read', { all: false, id });
  56. }
  57. /**
  58. * 清除最后一次练习记录
  59. */
  60. clearLatestExercise() {
  61. return this.apiPut('/my/clear/exercise/latest').then(() => {
  62. this.setState({ info: { latestExercise: 0 } });
  63. });
  64. }
  65. /**
  66. * 清除最后一次错误组卷记录
  67. */
  68. clearLatestError() {
  69. return this.apiPut('/my/clear/error/latest').then(() => {
  70. this.setState({ info: { latestError: 0 } });
  71. });
  72. }
  73. /**
  74. * 修改备考信息
  75. * @param {*} info prepareStatus: 身份 prepareGoal: 目标分数 prepareExaminationTime: 考试时间 prepareScoreTime: 出分时间
  76. */
  77. editPrepare(info) {
  78. return this.apiPut('/my/prepare', { ...info });
  79. }
  80. /**
  81. * 获取备考信息
  82. */
  83. getPrepare() {
  84. return this.apiGet('/my/prepare');
  85. }
  86. /**
  87. * 获取学习记录
  88. * @param {*} date 时间
  89. */
  90. getStudy(date) {
  91. return this.apiGet('/my/study', { date });
  92. }
  93. /**
  94. * 获取每周学习记录
  95. * @param {*} week 0本周,1上周
  96. */
  97. getStudyWeek(week) {
  98. return this.apiGet('/my/study/week', { week });
  99. }
  100. /**
  101. * 获取总学习记录
  102. */
  103. getStudyTotal() {
  104. return this.apiGet('/my/study/total');
  105. }
  106. /**
  107. * 添加心经收藏
  108. * @param {*} experienceId
  109. */
  110. addExperienceCollect(experienceId) {
  111. return this.apiPut('/my/collect/experience/add', { experienceId });
  112. }
  113. /**
  114. * 删除收藏
  115. * @param {*} experienceId
  116. */
  117. delExperienceCollect(experienceId) {
  118. return this.apiDel('/my/collect/experience/delete', { experienceId });
  119. }
  120. /**
  121. * 获取收藏心经列表
  122. * @param {*} page
  123. * @param {*} size
  124. * @param {*} startTime
  125. * @param {*} endTime
  126. * @param {*} order
  127. * @param {*} direction
  128. */
  129. listExperienceCollect({ page, size, startTime, endTime, order, direction }) {
  130. return this.apiGet('/my/collect/experience/list', { page, size, startTime, endTime, order, direction });
  131. }
  132. /**
  133. * 添加题目收藏
  134. * @param {*} questionNoId
  135. */
  136. addQuestionCollect(questionNoId) {
  137. return this.apiPut('/my/collect/question/add', { questionNoId });
  138. }
  139. /**
  140. * 删除题目收藏
  141. * @param {*} questionNoId
  142. */
  143. delQuestionCollect(questionNoId) {
  144. return this.apiDel('/my/collect/question/delete', { questionNoId });
  145. }
  146. /**
  147. * 收藏题目移除
  148. * @param {*} ids: questionId
  149. */
  150. clearQuestionCollect(questionNoIds) {
  151. return this.apiPost('/my/collect/question/clear', { questionNoIds });
  152. }
  153. /**
  154. * 收藏卷组
  155. * @param {*} questionNoIds: 'questionNoId'
  156. * @param {*} filterTimes
  157. */
  158. groupQuestionCollect({ questionNoIds, filterTimes }) {
  159. return this.apiPost('/my/collect/question/group', { questionNoIds, filterTimes });
  160. }
  161. /**
  162. * 获取收藏题目列表
  163. * @param {*} page
  164. * @param {*} size
  165. * @param {*} startTime
  166. * @param {*} endTime
  167. * @param {*} order
  168. */
  169. listQuestionCollect({ keyword, module, questionTypes, structIds, latest, year, page, size, startTime, endTime, order }) {
  170. return this.apiGet('/my/collect/question/list', { keyword, module, questionTypes, structIds, latest, year, page, size, startTime, endTime, order });
  171. }
  172. /**
  173. * 获取错题列表
  174. * @param {*} page
  175. * @param {*} size
  176. */
  177. listError({ keyword, module, questionTypes, structIds, latest, year, page, size, startTime, endTime, order }) {
  178. return this.apiGet('/my/error/list', { keyword, module, questionTypes, structIds, latest, year, page, size, startTime, endTime, order });
  179. }
  180. /**
  181. * 错题组卷
  182. * @param {*} questionNoIds: 'questionNoId'
  183. * @param {*} filterTimes
  184. */
  185. groupError({ questionNoIds, filterTimes }) {
  186. return this.apiPost('/my/error/group', { questionNoIds, filterTimes });
  187. }
  188. /**
  189. * 错题移除
  190. * @param {*} ids: userQuestionId
  191. */
  192. clearError(questionNoIds) {
  193. return this.apiPost('/my/error/clear', { questionNoIds });
  194. }
  195. /**
  196. * 移除正确题
  197. * @param {*} userReportId
  198. */
  199. removeError(userReportId) {
  200. return this.apiPost('/my/error/remove', { userReportId });
  201. }
  202. /**
  203. * 获取学习数据
  204. * @param {*} module
  205. * @param {*} subject
  206. * @param {*} structIds
  207. * @param {*} startTime
  208. * @param {*} endTime
  209. */
  210. getData(module, subject, structIds, startTime, endTime) {
  211. return this.apiGet('/my/data', { module, subject, structIds, startTime, endTime });
  212. }
  213. /**
  214. * 获取题目笔记
  215. * @param {*} questionNoId
  216. */
  217. getQuestionNote(questionNoId) {
  218. return this.apiGet('/my/note/question', { questionNoId });
  219. }
  220. /**
  221. * 更新题目笔记
  222. * @param {*} questionNoId
  223. * @param {*} content
  224. * @param {*} qxContent
  225. * @param {*} officialContent
  226. * @param {*} associationContent
  227. * @param {*} qaContent
  228. */
  229. updateQuestionNote(questionNoId, { content, qxContent, officialContent, associationContent, qaContent }) {
  230. return this.apiPut('/my/note/question', { questionNoId, content, qxContent, officialContent, associationContent, qaContent });
  231. }
  232. clearQuestionNote(questionNoIds) {
  233. return this.apiPost('/my/note/question/clear', { questionNoIds });
  234. }
  235. /**
  236. * 获取笔记列表
  237. * @param {*} page
  238. * @param {*} size
  239. * @param {*} startTime
  240. * @param {*} endTime
  241. * @param {*} order
  242. */
  243. listQuestionNote({ keyword, module, questionTypes, structIds, latest, year, page, size, startTime, endTime, order }) {
  244. return this.apiGet('/my/note/question/list', { keyword, module, questionTypes, structIds, latest, year, page, size, startTime, endTime, order });
  245. }
  246. /**
  247. * 更新课程笔记
  248. * @param {*} courseId
  249. * @param {*} courseNoId
  250. * @param {*} content
  251. */
  252. updateCourseNote(courseId, courseNoId, content) {
  253. return this.apiPut('/my/note/course', { courseId, courseNoId, content });
  254. }
  255. clearCourseNote(courseNoIds) {
  256. return this.apiPost('/my/note/course/clear', { courseNoIds });
  257. }
  258. /**
  259. * 获取笔记列表
  260. * @param {*} page
  261. * @param {*} size
  262. * @param {*} startTime
  263. * @param {*} endTime
  264. * @param {*} order
  265. */
  266. listCourseNote({ keyword, courseId, page, size, order, direction }) {
  267. return this.apiGet('/my/note/course/list', { keyword, courseId, page, size, order, direction });
  268. }
  269. /**
  270. * 获取报告列表
  271. * @param {*} origin
  272. * @param {*} structId
  273. * @param {*} page
  274. * @param {*} size
  275. * @param {*} startTime
  276. * @param {*} endTime
  277. * @param {*} order
  278. */
  279. listReport({ keyword, module, origin, questionTypes, structIds, latest, year, courseModules, page, size, startTime, endTime, order }) {
  280. return this.apiGet('/my/report/list', { keyword, module, origin, questionTypes, structIds, latest, year, courseModules, page, size, startTime, endTime, order });
  281. }
  282. /**
  283. * 添加题目提问
  284. * @param {*} userQuestionId : 用于获取预习作业,判断权限
  285. * @param {*} target
  286. * @param {*} questionNoId
  287. * @param {*} content
  288. */
  289. addQuestionAsk(userQuestionId, target, questionNoId, originContent, content) {
  290. return this.apiPost('/my/ask/question', { userQuestionId, target, questionNoId, originContent, content });
  291. }
  292. /**
  293. * 删除题目提问
  294. * @param {*} id
  295. */
  296. delQuestionAsk(id) {
  297. return this.apiDel('/my/ask/question/delete', { id });
  298. }
  299. listQuestionAsk({ keyword, module, questionTypes, structIds, latest, year, answerStatus, page, size, startTime, endTime, order }) {
  300. return this.apiGet('/my/ask/question/list', { keyword, module, questionTypes, structIds, latest, year, answerStatus, page, size, startTime, endTime, order });
  301. }
  302. /**
  303. * 添加课程提问
  304. * @param {*} courseId
  305. * @param {*} courseNoId
  306. * @param {*} position
  307. * @param {*} originContent
  308. * @param {*} content
  309. */
  310. addCourseAsk(courseId, courseNoId, position, originContent, content) {
  311. return this.apiPost('/my/ask/course', { courseId, courseNoId, position, originContent, content });
  312. }
  313. /**
  314. * 删除课程提问
  315. * @param {*} id
  316. */
  317. delCourseAsk(id) {
  318. return this.apiDel('/my/ask/course/delete', { id });
  319. }
  320. listCourseAsk({ keyword, courseId, courseNoId, answerStatus, order, direction }) {
  321. return this.apiGet('/my/ask/course/list', { keyword, courseId, courseNoId, answerStatus, order, direction });
  322. }
  323. /**
  324. * 添加题目勘误
  325. * @param {*} questionNoId
  326. * @param {*} title
  327. * @param {*} position
  328. * @param {*} originContent
  329. * @param {*} content
  330. */
  331. addFeedbackErrorQuestion(questionNoId, title, position, originContent, content) {
  332. return this.apiPost('/my/feedback/error/question', { questionNoId, title, position, originContent, content });
  333. }
  334. /**
  335. * 添加数据勘误
  336. * @param {*} dataId
  337. * @param {*} title
  338. * @param {*} position
  339. * @param {*} originContent
  340. * @param {*} content
  341. */
  342. addFeedbackErrorData(dataId, title, position, originContent, content) {
  343. return this.apiPost('/my/feedback/error/data', { dataId, title, position, originContent, content });
  344. }
  345. /**
  346. * 添加机经反馈
  347. * @param {*} textbookSubject
  348. * @param {*} target
  349. * @param {*} no
  350. * @param {*} content
  351. */
  352. addTextbookFeedback(textbookSubject, target, no, content) {
  353. return this.apiPost('/my/feedback/textbook', { textbookSubject, target, no, content });
  354. }
  355. /**
  356. * 添加考场反馈
  357. * @param {*} roomId
  358. * @param {*} content
  359. */
  360. addRoomFeedback(roomId, content) {
  361. return this.apiPost('/my/feedback/ready/room', { roomId, content });
  362. }
  363. /**
  364. * 添加Faq
  365. * @param {*} channel
  366. * @param {*} position
  367. * @param {*} content
  368. */
  369. addFaq(channel, position, content) {
  370. return this.apiPost('/my/faq', { channel, position, content });
  371. }
  372. /**
  373. * 添加评论
  374. * @param {*} channel
  375. * @param {*} position
  376. * @param {*} content
  377. */
  378. addComment(channel, position, content) {
  379. return this.apiPost('/my/comment', { channel, position, content });
  380. }
  381. /**
  382. * 资料全局订阅开关
  383. * @param {*} subscribe
  384. */
  385. subscribeDataEmail(subscribe) {
  386. return this.apiPost('/my/data/email/subscribe', { subscribe });
  387. }
  388. /**
  389. * 资料订阅开关
  390. * @param {*} dataId
  391. * @param {*} subscribe
  392. */
  393. subscribeData(dataId, subscribe) {
  394. return this.apiPost('/my/data/subscribe', { dataId, subscribe });
  395. }
  396. /**
  397. * 获取资料更新列表
  398. * @param {*}} param0
  399. */
  400. listDataHistory({ page, size, dataId }) {
  401. return this.apiGet('/my/data/history', { page, size, dataId });
  402. }
  403. /**
  404. * 获取购买资料列表
  405. * @param {*} param0
  406. */
  407. listData({ page, size, structId, dataType, order, direction }) {
  408. return this.apiGet('/my/data/list', { page, size, structId, dataType, order, direction });
  409. }
  410. /**
  411. * 购买的课程列表
  412. * @param {*} param0
  413. */
  414. listCourse({ page, size, courseModule, isUsed, isEnd, order, direction }) {
  415. return this.apiGet('/my/course/list', { page, size, courseModule, isUsed, isEnd, order, direction });
  416. }
  417. detailCourse(recordId) {
  418. return this.apiGet('/my/course/detail', { recordId });
  419. }
  420. setCCTalkName(id, cctalkName) {
  421. return this.apiPost('/my/course/cctalk_name', { id, cctalkName });
  422. }
  423. uploadAppointmentQuestion({ id, questionFile, questionFileName }) {
  424. return this.apiPost('/my/course/appointment/question', { id, questionFile, questionFileName });
  425. }
  426. addAppointmentComment({ appointmentId, type, parentId, content, file, name }) {
  427. return this.apiPost('/my/course/appointment/comment/add', { appointmentId, type, parentId, content, file, name });
  428. }
  429. editAppointmentComment({ id, content, file, name }) {
  430. return this.apiPost('/my/course/appointment/comment/edit', { id, content, file, name });
  431. }
  432. delAppointmentComment(id) {
  433. return this.apiDel('/my/course/appointment/comment/delete', { id });
  434. }
  435. /**
  436. * 申请停课
  437. * @param {*} recordId
  438. */
  439. suspendCourse(recordId) {
  440. return this.apiPost('/my/course/suspend', { recordId });
  441. }
  442. /**
  443. * 申请恢复课程
  444. * @param {*} recordId
  445. */
  446. restoreCourse(recordId) {
  447. return this.apiPost('/my/course/restore', { recordId });
  448. }
  449. /**
  450. * 课程时间表
  451. * @param {*} recordId
  452. */
  453. timeCourse(recordId) {
  454. return this.apiGet('/my/course/time', { recordId });
  455. }
  456. /**
  457. * 导出题目
  458. * @param {*} setting
  459. */
  460. exportQuestionCollect(setting) {
  461. return this.apiPost('/my/export/question/collect', { setting });
  462. }
  463. /**
  464. * 导出题目
  465. * @param {*} setting
  466. */
  467. exportQuestionError(setting) {
  468. return this.apiPost('/my/export/question/error', { setting });
  469. }
  470. /**
  471. * 导出题目笔记
  472. * @param {*}} setting
  473. */
  474. exportNoteQuestion(setting) {
  475. return this.apiPost('/my/export/note/question', { setting });
  476. }
  477. /**
  478. * 导出课程笔记
  479. * @param {*} setting
  480. */
  481. exportNoteCourse(setting) {
  482. return this.apiPost('/my/export/note/course', { setting });
  483. }
  484. exportDetail(id) {
  485. return this.apiGet('/my/export/detail', { id });
  486. }
  487. /**
  488. * 关闭导出提示
  489. */
  490. exportTips() {
  491. return this.apiPost('/my/export/tips', {});
  492. }
  493. textbookTips() {
  494. return this.apiPost('/my/textbook/tips', {});
  495. }
  496. /**
  497. * 关闭评论提示
  498. * @param {*}} recordId
  499. */
  500. courseCommentTips(recordId) {
  501. return this.apiPost('/my/course/comment/tips', { recordId });
  502. }
  503. addSearchHistory(questionNoId) {
  504. return this.apiPost('/my/search/history', { questionNoId });
  505. }
  506. clearSearchHistory(date) {
  507. return this.apiPost('/my/search/history/clear', { date });
  508. }
  509. listSearchHistory() {
  510. return this.apiGet('/my/search/history/list', {});
  511. }
  512. }
  513. export const My = new MyStore({ key: 'my' });