Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
3b202a8a
Commit
3b202a8a
authored
Jul 11, 2018
by
愚道
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove .umirc.mock.js
parent
e89dadee
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
61 deletions
+37
-61
mock/.gitkeep
mock/.gitkeep
+0
-0
mock/api.js
mock/api.js
+19
-11
mock/chart.js
mock/chart.js
+2
-2
mock/geographic.js
mock/geographic.js
+4
-4
mock/notices.js
mock/notices.js
+3
-2
mock/profile.js
mock/profile.js
+4
-4
mock/rule.js
mock/rule.js
+4
-4
mock/user.js
mock/user.js
+1
-34
No files found.
mock/.gitkeep
deleted
100644 → 0
View file @
e89dadee
mock/api.js
View file @
3b202a8a
import
mockjs
from
'
mockjs
'
;
const
titles
=
[
'
Alipay
'
,
'
Angular
'
,
...
...
@@ -59,7 +61,7 @@ const user = [
'
仲尼
'
,
];
export
function
fakeList
(
count
)
{
function
fakeList
(
count
)
{
const
list
=
[];
for
(
let
i
=
0
;
i
<
count
;
i
+=
1
)
{
list
.
push
({
...
...
@@ -109,7 +111,7 @@ export function fakeList(count) {
let
sourceData
;
export
function
getFakeList
(
req
,
res
)
{
function
getFakeList
(
req
,
res
)
{
const
params
=
req
.
query
;
const
count
=
params
.
count
*
1
||
20
;
...
...
@@ -124,7 +126,7 @@ export function getFakeList(req, res) {
}
}
export
function
postFakeList
(
req
,
res
)
{
function
postFakeList
(
req
,
res
)
{
const
{
/* url = '', */
body
}
=
req
;
// const params = getUrlParams(url);
const
{
method
,
id
}
=
body
;
...
...
@@ -160,7 +162,7 @@ export function postFakeList(req, res) {
}
}
export
const
getNotice
=
[
const
getNotice
=
[
{
id
:
'
xxx1
'
,
title
:
titles
[
0
],
...
...
@@ -223,7 +225,7 @@ export const getNotice = [
},
];
export
const
getActivities
=
[
const
getActivities
=
[
{
id
:
'
trend-1
'
,
updatedAt
:
new
Date
(),
...
...
@@ -324,7 +326,7 @@ export const getActivities = [
},
];
export
function
getFakeCaptcha
(
req
,
res
)
{
function
getFakeCaptcha
(
req
,
res
)
{
if
(
res
&&
res
.
json
)
{
res
.
json
(
'
captcha-xxx
'
);
}
else
{
...
...
@@ -333,9 +335,15 @@ export function getFakeCaptcha(req, res) {
}
export
default
{
getNotice
,
getActivities
,
getFakeList
,
postFakeList
,
getFakeCaptcha
,
'
GET /api/project/notice
'
:
getNotice
,
'
GET /api/activities
'
:
getActivities
,
'
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/captcha
'
:
getFakeCaptcha
,
};
mock/chart.js
View file @
3b202a8a
...
...
@@ -179,7 +179,7 @@ radarOriginData.forEach(item => {
});
});
export
const
getFakeChartData
=
{
const
getFakeChartData
=
{
visitData
,
visitData2
,
salesData
,
...
...
@@ -193,5 +193,5 @@ export const getFakeChartData = {
};
export
default
{
getFakeChartData
,
'
GET /api/fake_chart_data
'
:
getFakeChartData
,
};
mock/geographic.js
View file @
3b202a8a
import
city
from
'
./geographic/city.json
'
;
import
province
from
'
./geographic/province.json
'
;
export
function
getProvince
(
req
,
res
)
{
function
getProvince
(
req
,
res
)
{
res
.
json
(
province
);
}
export
function
getCity
(
req
,
res
)
{
function
getCity
(
req
,
res
)
{
res
.
json
(
city
[
req
.
params
.
province
]);
}
export
default
{
getProvince
,
getCity
,
'
GET /api/geographic/province
'
:
getProvince
,
'
GET /api/geographic/city/:province
'
:
getCity
,
};
mock/notices.js
View file @
3b202a8a
export
const
getNotices
=
(
req
,
res
)
=>
{
const
getNotices
=
(
req
,
res
)
=>
{
res
.
json
([
{
id
:
'
000000001
'
,
...
...
@@ -94,6 +94,7 @@ export const getNotices = (req, res) => {
},
]);
};
export
default
{
getNotices
,
'
GET /api/notices
'
:
getNotices
,
};
mock/profile.js
View file @
3b202a8a
...
...
@@ -141,18 +141,18 @@ const advancedOperation3 = [
},
];
export
const
getProfileBasicData
=
{
const
getProfileBasicData
=
{
basicGoods
,
basicProgress
,
};
export
const
getProfileAdvancedData
=
{
const
getProfileAdvancedData
=
{
advancedOperation1
,
advancedOperation2
,
advancedOperation3
,
};
export
default
{
getProfileBasic
Data
,
getProfileAdvanced
Data
,
'
GET /api/profile/advanced
'
:
getProfileAdvanced
Data
,
'
GET /api/profile/basic
'
:
getProfileBasic
Data
,
};
mock/rule.js
View file @
3b202a8a
...
...
@@ -23,7 +23,7 @@ for (let i = 0; i < 46; i += 1) {
});
}
export
function
getRule
(
req
,
res
,
u
)
{
function
getRule
(
req
,
res
,
u
)
{
let
url
=
u
;
if
(
!
url
||
Object
.
prototype
.
toString
.
call
(
url
)
!==
'
[object String]
'
)
{
url
=
req
.
url
;
// eslint-disable-line
...
...
@@ -79,7 +79,7 @@ export function getRule(req, res, u) {
}
}
export
function
postRule
(
req
,
res
,
u
,
b
)
{
function
postRule
(
req
,
res
,
u
,
b
)
{
let
url
=
u
;
if
(
!
url
||
Object
.
prototype
.
toString
.
call
(
url
)
!==
'
[object String]
'
)
{
url
=
req
.
url
;
// eslint-disable-line
...
...
@@ -141,6 +141,6 @@ export function postRule(req, res, u, b) {
}
export
default
{
getRule
,
postRule
,
'
GET /api/rule
'
:
getRule
,
'
POST /api/rule
'
:
postRule
,
};
.umirc.mock
.js
→
mock/user
.js
View file @
3b202a8a
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 以及部署站点的静态数据
const
proxy
=
{
export
default
{
// 支持值为 Object 和 Array
'
GET /api/currentUser
'
:
{
name
:
'
Serati Ma
'
,
...
...
@@ -83,21 +71,6 @@ const proxy = {
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
)
=>
{
const
{
password
,
userName
,
type
}
=
req
.
body
;
if
(
password
===
'
888888
'
&&
userName
===
'
admin
'
)
{
...
...
@@ -125,7 +98,6 @@ const proxy = {
'
POST /api/register
'
:
(
req
,
res
)
=>
{
res
.
send
({
status
:
'
ok
'
,
currentAuthority
:
'
user
'
});
},
'
GET /api/notices
'
:
getNotices
,
'
GET /api/500
'
:
(
req
,
res
)
=>
{
res
.
status
(
500
).
send
({
timestamp
:
1513932555104
,
...
...
@@ -162,9 +134,4 @@ const proxy = {
path
:
'
/base/category/list
'
,
});
},
'
GET /api/geographic/province
'
:
getProvince
,
'
GET /api/geographic/city/:province
'
:
getCity
,
'
GET /api/captcha
'
:
getFakeCaptcha
,
};
export
default
(
noProxy
?
{}
:
proxy
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment