main.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. getScore(total, quant) {
  26. return this.apiGet('/base/score', { total, quant });
  27. }
  28. /**
  29. * 所有练习头2层
  30. */
  31. getExercise() {
  32. return this.getApiCache('API:main:getExercise', () => {
  33. return this.apiGet('/base/exercise/main');
  34. });
  35. }
  36. /**
  37. * 获取对应节点下的子节点
  38. * @param {*} id
  39. * @param {*} children
  40. */
  41. getExerciseChildren(id, children) {
  42. return this.apiGet('/base/exercise/children', { id, children });
  43. }
  44. /**
  45. * 获取对应节点的所有父级节点
  46. * @param {*} id
  47. */
  48. getExerciseParent(id) {
  49. return this.apiGet('/base/exercise/parent', { id });
  50. }
  51. /**
  52. * 所有模考层级
  53. */
  54. getExamination() {
  55. return this.getApiCache('API:main:getExamination', () => {
  56. return this.apiGet('/base/examination/main');
  57. });
  58. }
  59. /**
  60. * 获取对应节点下的子节点
  61. * @param {*} id
  62. * @param {*} children
  63. */
  64. getExaminationChildren(id, children) {
  65. return this.apiGet('/base/examination/children', { id, children });
  66. }
  67. /**
  68. * 获取对应节点的所有父级节点
  69. * @param {*} id
  70. */
  71. getExaminationParent(id) {
  72. return this.apiGet('/base/examination/parent', { id });
  73. }
  74. /**
  75. * 获取模考题目数
  76. */
  77. getExaminationNumber() {
  78. return this.getApiCache('API:main:getExaminationNumber', () => {
  79. return this.apiGet('/base/examination/number');
  80. });
  81. }
  82. }
  83. export const Main = new MainStore({ key: 'main' });