Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-manage-shell
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
dcxy-manage-shell
Commits
8b0c2a2d
Commit
8b0c2a2d
authored
Apr 22, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
添加静态路由方法以及扩展白名单参数 See merge request
!19
parents
e0632436
d55ca3aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
main.js
src/lib/main.js
+12
-3
permission.js
src/lib/permission.js
+13
-2
No files found.
src/lib/main.js
View file @
8b0c2a2d
...
...
@@ -24,16 +24,25 @@ class SystemShell {
this
.
mixinModule
=
mixinModule
;
this
.
utils
=
utilsModule
;
}
createSystem
=
({
basePath
=
'/'
,
routers
,
routeFilter
})
=>
{
createSystem
=
({
basePath
=
'/'
,
routers
,
routeFilter
,
constantRouter
,
whiteList
,
})
=>
{
const
router
=
new
VueRouter
({
mode
:
'history'
,
base
:
basePath
,
scrollBehavior
:
()
=>
({
y
:
0
}),
routes
:
constantRouterMap
,
routes
:
constantRouter
&&
constantRouter
instanceof
Array
?
[...
constantRouterMap
,
...
constantRouter
]
:
constantRouterMap
,
});
routeStore
.
install
(
store
);
extendCom
(
Vue
);
configRoutePermission
(
router
,
store
,
routers
);
configRoutePermission
(
router
,
store
,
routers
,
whiteList
);
Vue
.
config
.
productionTip
=
false
;
let
app
=
new
Vue
({
...
...
src/lib/permission.js
View file @
8b0c2a2d
...
...
@@ -4,10 +4,21 @@ import 'nprogress/nprogress.css'; // Progress 进度条样式
import
{
getToken
}
from
'@/utils/auth'
;
// 验权
import
{
getAuthRoute
}
from
'../utils/route'
;
const
configRoutePermission
=
(
router
,
store
,
allAasyncRouterMap
)
=>
{
const
configRoutePermission
=
(
router
,
store
,
allAasyncRouterMap
,
addwhiteList
)
=>
{
NProgress
.
configure
({
showSpinner
:
false
});
// NProgress Configuration
const
whiteList
=
process
.
env
.
VUE_APP_WHITE_LIST
.
split
(
','
);
// 不重定向白名单
const
whiteList
=
addwhiteList
&&
typeof
addwhiteList
===
'string'
?
[
...
process
.
env
.
VUE_APP_WHITE_LIST
.
split
(
','
),
...
addwhiteList
.
split
(
','
),
]
:
process
.
env
.
VUE_APP_WHITE_LIST
.
split
(
','
);
// 不重定向白名单
const
getRouteAdd
=
()
=>
{
let
allRoute
=
store
.
getters
.
asyncRoutes
;
...
...
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