import { config, cdnBase } from '../../config/index'; /** 获取首页数据 */ function mockFetchHome() { const { delay } = require('../_utils/delay'); const { genSwiperImageList } = require('../../model/swiper'); return delay().then(() => { return { swiper: genSwiperImageList(), tabList: [{ text: '精选推荐', key: 0, }, { text: '家常炒菜', key: 1, }, { text: '火锅烧烤', key: 2, }, { text: '汉堡西餐', key: 3, }, { text: '甜品饮品', key: 4, }, ], activityImg: `${cdnBase}/activity/banner.png`, }; }); } /** 获取首页数据 */ export function fetchHome() { if (config.useMock) { return mockFetchHome(); } return new Promise((resolve) => { resolve('real api'); }); }