123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import BaseStore from '@src/stores/base';
- export default class MainStore extends BaseStore {
- /**
- * 获取首页配置
- */
- getIndex() {
- return this.apiGet('/base/index');
- }
- /**
- * 获取广告列表
- */
- getAd() {
- return this.apiGet('/base/ad');
- }
- /**
- * 获取考分排行信息
- */
- getScore(total, quant) {
- return this.apiGet('/base/score', { total, quant });
- }
- /**
- * 所有练习层级
- */
- getExercise() {
- return this.getApiCache('API:main:getExercise', () => {
- return this.apiGet('/base/exercise/struct');
- });
- }
- getExerciseSingle(id) {
- return this.getExercise().then(result => {
- for (let i = 0; i < result.length; i += 1) {
- if (result[i].id === id) return result[i];
- }
- return {};
- });
- }
- /**
- * 所有模考层级
- */
- getExamination() {
- return this.apiGet('/base/examination/struct');
- }
- }
- export const Main = new MainStore({ key: 'main' });
|