main.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. listFaq(page, size, channel, position) {
  83. return this.apiGet('/base/faq/list', { page, size, channel, position });
  84. }
  85. listComment(page, size, channel, position) {
  86. return this.apiGet('/base/comment/list', { page, size, channel, position });
  87. }
  88. }
  89. export const Main = new MainStore({ key: 'main' });