litian
2024-03-29 4b5f1f7ed3460df9465e5071a59b8105cbc9146e
services/home/home.js
@@ -1,53 +1,76 @@
import { config, cdnBase } from '../../config/index';
/** 获取首页数据 */
function mockFetchHome() {
  const { delay } = require('../_utils/delay');
  const { genSwiperImageList } = require('../../model/swiper');
  const {
    delay
  } = require('../_utils/delay');
  return delay().then(() => {
    return {
      swiper: genSwiperImageList(),
      tabList: [
        {
          text: '精选推荐',
      tabList: [{
          text: '图书服务',
          key: 0,
          icon: '/static/images/home/zhutichuban@2x.png',
          url: '/pages/bookServices/assort/index',
        },
        {
          text: '夏日防晒',
          text: '数字阅读',
          key: 1,
          icon: '/static/images/home/shuziyuedu@2x.png',
          url: '/pages/home/digitalRead/index',
        },
        {
          text: '二胎大作战',
          text: '数字课程',
          key: 2,
          icon: '/static/images/home/shuzikecheng@2x.png',
          url: '',
        },
        {
          text: '人气榜',
          text: '数字教材',
          key: 3,
          icon: '/static/images/home/shuzijiaocai@2x.png',
          url: '',
        },
        {
          text: '好评榜',
          text: '专题讨论',
          key: 4,
          icon: '/static/images/home/zhuantitaolun@2x.png',
          url: '',
        },
        {
          text: 'RTX 30',
          text: '线上书展',
          key: 5,
          icon: '/static/images/home/xianshangshuzhan@2x.png',
          url: '/pages/bookExhibitionList/index',
        },
        {
          text: '手机也疯狂',
          text: '书目下载',
          key: 6,
          icon: '/static/images/home/shumuxiazai@2x.png',
          url: '/pages/bibliographyList/index',
        },
        {
          text: '教师认证',
          key: 7,
          icon: '/static/images/home/jiaoshirenzheng@2x.png',
          url: '/packageDomain/pages/teacherCertification/index',
        },
        {
          text: '样书申请',
          key: 8,
          icon: '/static/images/home/yangshushenqing@2x.png',
          url: '/packageDomain/pages/sampleBookList/index',
        },
        {
          text: '我要出书',
          key: 9,
          icon: '/static/images/home/xueshuzhuzuo@2x.png',
          url: '',
        },
      ],
      activityImg: `${cdnBase}/activity/banner.png`,
    };
  });
}
/** 获取首页数据 */
export function fetchHome() {
  if (config.useMock) {
    return mockFetchHome();
  }
  return new Promise((resolve) => {
    resolve('real api');
  });
}
  return mockFetchHome();
}