|
@@ -1,17 +1,5 @@
|
|
|
-import mockjs from 'mockjs';
|
|
|
|
|
-import { getRule, postRule } from './mock/rule';
|
|
|
|
|
-import { getActivities, getNotice, getFakeList, postFakeList, getFakeCaptcha } from './mock/api';
|
|
|
|
|
-import { getFakeChartData } from './mock/chart';
|
|
|
|
|
-import { getProfileBasicData } from './mock/profile';
|
|
|
|
|
-import { getProfileAdvancedData } from './mock/profile';
|
|
|
|
|
-import { getNotices } from './mock/notices';
|
|
|
|
|
-import { getProvince, getCity } from './mock/geographic';
|
|
|
|
|
-
|
|
|
|
|
-// 是否禁用代理
|
|
|
|
|
-const noProxy = process.env.NO_PROXY === 'true';
|
|
|
|
|
-
|
|
|
|
|
// 代码中会兼容本地 service mock 以及部署站点的静态数据
|
|
// 代码中会兼容本地 service mock 以及部署站点的静态数据
|
|
|
-const proxy = {
|
|
|
|
|
|
|
+export default {
|
|
|
// 支持值为 Object 和 Array
|
|
// 支持值为 Object 和 Array
|
|
|
'GET /api/currentUser': {
|
|
'GET /api/currentUser': {
|
|
|
name: 'Serati Ma',
|
|
name: 'Serati Ma',
|
|
@@ -83,21 +71,6 @@ const proxy = {
|
|
|
address: 'Sidney No. 1 Lake Park',
|
|
address: 'Sidney No. 1 Lake Park',
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- 'GET /api/project/notice': getNotice,
|
|
|
|
|
- 'GET /api/activities': getActivities,
|
|
|
|
|
- 'GET /api/rule': getRule,
|
|
|
|
|
- 'POST /api/rule': postRule,
|
|
|
|
|
- 'POST /api/forms': (req, res) => {
|
|
|
|
|
- res.send({ message: 'Ok' });
|
|
|
|
|
- },
|
|
|
|
|
- 'GET /api/tags': mockjs.mock({
|
|
|
|
|
- 'list|100': [{ name: '@city', 'value|1-100': 150, 'type|0-2': 1 }],
|
|
|
|
|
- }),
|
|
|
|
|
- 'GET /api/fake_list': getFakeList,
|
|
|
|
|
- 'POST /api/fake_list': postFakeList,
|
|
|
|
|
- 'GET /api/fake_chart_data': getFakeChartData,
|
|
|
|
|
- 'GET /api/profile/basic': getProfileBasicData,
|
|
|
|
|
- 'GET /api/profile/advanced': getProfileAdvancedData,
|
|
|
|
|
'POST /api/login/account': (req, res) => {
|
|
'POST /api/login/account': (req, res) => {
|
|
|
const { password, userName, type } = req.body;
|
|
const { password, userName, type } = req.body;
|
|
|
if (password === '888888' && userName === 'admin') {
|
|
if (password === '888888' && userName === 'admin') {
|
|
@@ -125,7 +98,6 @@ const proxy = {
|
|
|
'POST /api/register': (req, res) => {
|
|
'POST /api/register': (req, res) => {
|
|
|
res.send({ status: 'ok', currentAuthority: 'user' });
|
|
res.send({ status: 'ok', currentAuthority: 'user' });
|
|
|
},
|
|
},
|
|
|
- 'GET /api/notices': getNotices,
|
|
|
|
|
'GET /api/500': (req, res) => {
|
|
'GET /api/500': (req, res) => {
|
|
|
res.status(500).send({
|
|
res.status(500).send({
|
|
|
timestamp: 1513932555104,
|
|
timestamp: 1513932555104,
|
|
@@ -162,9 +134,4 @@ const proxy = {
|
|
|
path: '/base/category/list',
|
|
path: '/base/category/list',
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- 'GET /api/geographic/province': getProvince,
|
|
|
|
|
- 'GET /api/geographic/city/:province': getCity,
|
|
|
|
|
- 'GET /api/captcha': getFakeCaptcha,
|
|
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
-export default (noProxy ? {} : proxy);
|
|
|