123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- import BaseStore from '@src/stores/base';
- export default class MainStore extends BaseStore {
- qrCode(url) {
- const qr = new window.QRious({
- value: url,
- size: 200,
- });
- return qr.toDataURL();
- }
- /**
- * 获取首页配置
- */
- getIndex() {
- return this.apiGet('/base/index');
- }
- /**
- * 获取基础配置
- */
- getBase() {
- return this.apiGet('/base/base');
- }
- /**
- * 获取广告列表
- */
- getAd(channel) {
- return this.apiGet('/base/ad', { channel });
- }
- /**
- * 获取优惠信息
- */
- getPromote() {
- return this.apiGet('/base/promote');
- }
- /**
- * 获取对应位置的提示tips
- * @param {*} position
- */
- getTips(position) {
- return this.apiGet('/base/tips', { position });
- }
- /**
- * 获取长难句信息
- */
- getSentence() {
- return this.apiGet('/base/sentence');
- }
- /**
- * 获取心经信息
- */
- getExperience() {
- return this.apiGet('/base/experience');
- }
- getCourseIndex() {
- return this.apiGet('/base/course_index');
- }
- /**
- * 获取考分排行信息
- */
- getScore(total, quant) {
- return this.apiGet('/base/score', { total, quant });
- }
- courseStruct() {
- return this.getExercise().then((result) => {
- return result.filter(row => row.isCourse);
- });
- }
- dataStruct() {
- return this.getExercise().then((result) => {
- return result.filter(row => row.isData);
- });
- }
- /**
- * 单个科目下的范围
- */
- rangeExercise() {
- return this.apiGet('/base/exercise/range');
- }
- /**
- * 所有练习头2层
- */
- getExercise() {
- return this.getApiCache('API:main:getExercise', () => {
- return this.apiGet('/base/exercise/main');
- }, 3600);
- }
- /**
- * 获取对应节点下的子节点
- * @param {*} id
- * @param {*} children
- */
- getExerciseChildren(id, children) {
- return this.apiGet('/base/exercise/children', { id, children });
- }
- /**
- * 获取对应节点的所有父级节点
- * @param {*} id
- */
- getExerciseParent(id) {
- return this.apiGet('/base/exercise/parent', { id });
- }
- getExerciseAll() {
- return this.apiGet('/base/exercise/all');
- }
- /**
- * 所有模考层级
- */
- getExamination() {
- return this.getApiCache('API:main:getExamination', () => {
- return this.apiGet('/base/examination/main');
- }, 3600);
- }
- /**
- * 获取对应节点下的子节点
- * @param {*} id
- * @param {*} children
- */
- getExaminationChildren(id, children) {
- return this.apiGet('/base/examination/children', { id, children });
- }
- /**
- * 获取对应节点的所有父级节点
- * @param {*} id
- */
- getExaminationParent(id) {
- return this.apiGet('/base/examination/parent', { id });
- }
- /**
- * 获取模考题目数
- */
- getExaminationNumber() {
- return this.getApiCache('API:main:getExaminationNumber', () => {
- return this.apiGet('/base/examination/number');
- }, 3600);
- }
- /**
- * 获取服务信息
- * @param {*} service
- */
- getService(service) {
- return this.apiGet('/base/service', { service });
- }
- getContract(key) {
- return this.apiGet('/base/contract', { key });
- }
- listFaq({ page, size, channel, position }) {
- return this.apiGet('/base/faq/list', { page, size, channel, position });
- }
- listComment({ page, size, channel, position }) {
- return this.apiGet('/base/comment/list', { page, size, channel, position });
- }
- readyInfo() {
- return this.apiGet('/base/ready_info');
- }
- listArticle(categoryId) {
- return this.apiGet('/base/article/list', { categoryId });
- }
- listRead({ page, size, plate }) {
- return this.apiGet('/base/read/list', { page, size, plate });
- }
- listRoom({ page, size, keyword, areaId }) {
- return this.apiGet('/base/room/list', { page, size, keyword, areaId });
- }
- allData(isOfficial) {
- return this.apiGet('/base/data/all', { isOfficial });
- }
- }
- export const Main = new MainStore({ key: 'main' });
|