index.js 659 字节
Newer Older
P
add  
Pan 已提交
1
import axios from 'axios';
P
add  
Pan 已提交
2
import Mock from 'mockjs';
P
add  
Pan 已提交
3
import MockAdapter from 'axios-mock-adapter';
P
Pan 已提交
4
import article_tableAPI from './article_table'
P
add  
Pan 已提交
5 6 7
const mock = new MockAdapter(axios);

const articleList = {
P
add  
Pan 已提交
8 9
  'data|20': [{
    id: '@id',
P
Pan 已提交
10
    title: '@ctitle(10, 20)',
P
Pan 已提交
11
    'status|1': ['published', 'draft'],
P
Pan 已提交
12 13 14
    author: '@cname',
    display_time: '@datetime',
    pageviews: '@integer(300, 5000)'
P
add  
Pan 已提交
15
  }]
P
add  
Pan 已提交
16 17 18
}
const data = JSON.stringify(Mock.mock(articleList))
mock.onGet('/article/list').reply(200, data);
P
Pan 已提交
19 20 21


mock.onGet('/article_table/list').reply(article_tableAPI.getList);
P
Pan 已提交
22
mock.onGet('/article_table/pv').reply(article_tableAPI.getPv);
P
Pan 已提交
23 24 25



P
add  
Pan 已提交
26
export default mock;