You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
939 B
54 lines
939 B
2 years ago
|
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');
|
||
|
});
|
||
|
}
|