main.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import BaseStore from '@src/stores/base';
  2. export default class MainStore extends BaseStore {
  3. /**
  4. * 获取首页配置
  5. */
  6. getIndex() {
  7. return this.apiGet('/base/index');
  8. }
  9. /**
  10. * 获取广告列表
  11. */
  12. getAd() {
  13. return this.apiGet('/base/ad');
  14. }
  15. /**
  16. * 获取对应位置的提示tips
  17. * @param {*} position
  18. */
  19. getTips(position) {
  20. return this.apiGet('/base/tips', { position });
  21. }
  22. /**
  23. * 获取长难句信息
  24. */
  25. getSentence() {
  26. return this.apiGet('/base/sentence');
  27. }
  28. /**
  29. * 获取心经信息
  30. */
  31. getExperience() {
  32. return this.apiGet('/base/experience');
  33. }
  34. /**
  35. * 获取考分排行信息
  36. */
  37. getScore(total, quant) {
  38. return this.apiGet('/base/score', { total, quant });
  39. }
  40. /**
  41. * 所有练习头2层
  42. */
  43. getExercise() {
  44. return this.getApiCache('API:main:getExercise', () => {
  45. return this.apiGet('/base/exercise/main');
  46. }, 3600);
  47. }
  48. /**
  49. * 获取对应节点下的子节点
  50. * @param {*} id
  51. * @param {*} children
  52. */
  53. getExerciseChildren(id, children) {
  54. return this.apiGet('/base/exercise/children', { id, children });
  55. }
  56. /**
  57. * 获取对应节点的所有父级节点
  58. * @param {*} id
  59. */
  60. getExerciseParent(id) {
  61. return this.apiGet('/base/exercise/parent', { id });
  62. }
  63. /**
  64. * 所有模考层级
  65. */
  66. getExamination() {
  67. return this.getApiCache('API:main:getExamination', () => {
  68. return this.apiGet('/base/examination/main');
  69. }, 3600);
  70. }
  71. /**
  72. * 获取对应节点下的子节点
  73. * @param {*} id
  74. * @param {*} children
  75. */
  76. getExaminationChildren(id, children) {
  77. return this.apiGet('/base/examination/children', { id, children });
  78. }
  79. /**
  80. * 获取对应节点的所有父级节点
  81. * @param {*} id
  82. */
  83. getExaminationParent(id) {
  84. return this.apiGet('/base/examination/parent', { id });
  85. }
  86. /**
  87. * 获取模考题目数
  88. */
  89. getExaminationNumber() {
  90. return this.getApiCache('API:main:getExaminationNumber', () => {
  91. return this.apiGet('/base/examination/number');
  92. }, 3600);
  93. }
  94. listFaq(page, size, channel, position) {
  95. return this.apiGet('/base/faq/list', { page, size, channel, position });
  96. }
  97. listComment(page, size, channel, position) {
  98. return this.apiGet('/base/comment/list', { page, size, channel, position });
  99. }
  100. }
  101. export const Main = new MainStore({ key: 'main' });