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
e6fe4979
Unverified
Commit
e6fe4979
authored
Mar 26, 2019
by
陈帅
Committed by
GitHub
Mar 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "close page permission control (#3842)" (#3844)
This reverts commit
e8c8f8b9
.
parent
e8c8f8b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
config/router.config.js
config/router.config.js
+4
-1
src/app.js
src/app.js
+34
-1
No files found.
config/router.config.js
View file @
e6fe4979
...
@@ -21,9 +21,10 @@ export default [
...
@@ -21,9 +21,10 @@ export default [
{
{
path
:
'
/
'
,
path
:
'
/
'
,
component
:
'
../layouts/BasicLayout
'
,
component
:
'
../layouts/BasicLayout
'
,
Routes
:
[
'
src/pages/Authorized
'
],
routes
:
[
routes
:
[
// dashboard
// dashboard
{
path
:
'
/
'
,
redirect
:
'
/dashboard/analysis
'
},
{
path
:
'
/
'
,
redirect
:
'
/dashboard/analysis
'
,
authority
:
[
'
admin
'
,
'
user
'
]
},
{
{
path
:
'
/dashboard
'
,
path
:
'
/dashboard
'
,
name
:
'
dashboard
'
,
name
:
'
dashboard
'
,
...
@@ -87,6 +88,7 @@ export default [
...
@@ -87,6 +88,7 @@ export default [
{
{
path
:
'
/form/advanced-form
'
,
path
:
'
/form/advanced-form
'
,
name
:
'
advancedform
'
,
name
:
'
advancedform
'
,
authority
:
[
'
admin
'
],
component
:
'
./Forms/AdvancedForm
'
,
component
:
'
./Forms/AdvancedForm
'
,
},
},
],
],
...
@@ -160,6 +162,7 @@ export default [
...
@@ -160,6 +162,7 @@ export default [
{
{
path
:
'
/profile/advanced
'
,
path
:
'
/profile/advanced
'
,
name
:
'
advanced
'
,
name
:
'
advanced
'
,
authority
:
[
'
admin
'
],
component
:
'
./Profile/AdvancedProfile
'
,
component
:
'
./Profile/AdvancedProfile
'
,
},
},
],
],
...
...
src/app.js
View file @
e6fe4979
import
fetch
from
'
dva/fetch
'
;
export
const
dva
=
{
export
const
dva
=
{
config
:
{
config
:
{
onError
(
err
)
{
onError
(
err
)
{
...
@@ -6,6 +8,37 @@ export const dva = {
...
@@ -6,6 +8,37 @@ export const dva = {
},
},
};
};
let
authRoutes
=
{};
function
ergodicRoutes
(
routes
,
authKey
,
authority
)
{
routes
.
forEach
(
element
=>
{
if
(
element
.
path
===
authKey
)
{
if
(
!
element
.
authority
)
element
.
authority
=
[];
// eslint-disable-line
Object
.
assign
(
element
.
authority
,
authority
||
[]);
}
else
if
(
element
.
routes
)
{
ergodicRoutes
(
element
.
routes
,
authKey
,
authority
);
}
return
element
;
});
}
export
function
patchRoutes
(
routes
)
{
Object
.
keys
(
authRoutes
).
map
(
authKey
=>
ergodicRoutes
(
routes
,
authKey
,
authRoutes
[
authKey
].
authority
)
);
window
.
g_routes
=
routes
;
}
export
function
render
(
oldRender
)
{
export
function
render
(
oldRender
)
{
oldRender
();
fetch
(
'
/api/auth_routes
'
)
.
then
(
res
=>
res
.
json
())
.
then
(
ret
=>
{
authRoutes
=
ret
;
oldRender
();
},
()
=>
{
oldRender
();
}
);
}
}
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