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
13acaf82
Commit
13acaf82
authored
Apr 22, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
白名单在store中维护 See merge request
!20
parents
8b0c2a2d
49f97a05
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
13 deletions
+36
-13
App.vue
src/App.vue
+3
-3
develop.js
src/dev-local/develop.js
+12
-0
main.js
src/lib/main.js
+11
-1
permission.js
src/lib/permission.js
+1
-9
index.js
src/store/modules/app/index.js
+9
-0
No files found.
src/App.vue
View file @
13acaf82
...
...
@@ -50,8 +50,7 @@
import
UserBox
from
'./containers/layout/components/UserBox'
;
import
IconMenus
from
'./containers/layout/IconMenu/IconMenu'
;
import
CollectMenu
from
'./containers/layout/Collect/Collect'
;
const
whiteList
=
process
.
env
.
VUE_APP_WHITE_LIST
.
split
(
','
);
// 不重定向白名单
import
{
mapGetters
}
from
'vuex'
;
export
default
{
name
:
'App'
,
...
...
@@ -76,6 +75,7 @@ export default {
};
},
computed
:
{
...
mapGetters
([
'whiteList'
]),
dashboardVisiable
()
{
return
this
.
$route
.
name
===
'dashboard'
;
},
...
...
@@ -100,7 +100,7 @@ export default {
methods
:
{
showComponents
(
store
)
{
this
.
isInnerPage
=
whiteList
.
indexOf
(
this
.
$route
.
path
)
!==
-
1
?
false
:
true
;
this
.
whiteList
.
indexOf
(
this
.
$route
.
path
)
!==
-
1
?
false
:
true
;
if
(
store
)
{
store
.
install
(
this
.
$store
);
this
.
$nextTick
(
vm
=>
{
...
...
src/dev-local/develop.js
View file @
13acaf82
...
...
@@ -12,6 +12,18 @@ setTimeout(() => {
System
.
createSystem
({
basePath
:
process
.
env
.
VUE_APP_BASE_URL
,
routers
:
allAasyncRouterMap
,
constantRouter
:
[
{
path
:
'/asd'
,
name
:
'asd'
,
component
:
{
render
(
h
)
{
return
<
div
>
asdasdasd
<
/div>
;
},
},
},
],
whiteList
:
'/asd'
,
routeFilter
:
(
routes
,
allRoute
)
=>
{
if
(
allRoute
&&
allRoute
.
length
)
{
let
addRoute
=
System
.
utils
.
route
.
formatRouteLink
(
allRoute
);
...
...
src/lib/main.js
View file @
13acaf82
...
...
@@ -42,7 +42,17 @@ class SystemShell {
});
routeStore
.
install
(
store
);
extendCom
(
Vue
);
configRoutePermission
(
router
,
store
,
routers
,
whiteList
);
const
allWhiteList
=
whiteList
&&
typeof
whiteList
===
'string'
?
[
...
process
.
env
.
VUE_APP_WHITE_LIST
.
split
(
','
),
...
whiteList
.
split
(
','
),
]
:
process
.
env
.
VUE_APP_WHITE_LIST
.
split
(
','
);
// 不重定向白名单
console
.
log
(
allWhiteList
);
store
.
dispatch
(
'getWhiteList'
,
allWhiteList
);
configRoutePermission
(
router
,
store
,
routers
,
allWhiteList
);
Vue
.
config
.
productionTip
=
false
;
let
app
=
new
Vue
({
...
...
src/lib/permission.js
View file @
13acaf82
...
...
@@ -8,18 +8,10 @@ const configRoutePermission = (
router
,
store
,
allAasyncRouterMap
,
add
whiteList
whiteList
)
=>
{
NProgress
.
configure
({
showSpinner
:
false
});
// NProgress Configuration
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
;
let
asyncRouters
=
getAuthRoute
(
allAasyncRouterMap
,
allRoute
);
...
...
src/store/modules/app/index.js
View file @
13acaf82
import
sidebar
from
'./sidebar'
;
import
collect
from
'./collect'
;
import
{
FETCH_START
,
FETCH_DONE
}
from
'./mutation-types'
;
const
GET_WHITE_LIST
=
'GET_WHITE_LIST'
;
let
fetchCount
=
0
;
const
state
=
()
=>
({
loading
:
false
,
whiteList
:
[],
});
const
getters
=
{
loading
:
state
=>
state
.
loading
,
whiteList
:
state
=>
state
.
whiteList
,
};
const
actions
=
{
...
...
@@ -18,6 +21,9 @@ const actions = {
fetchDone
({
commit
},
notLoading
)
{
commit
(
FETCH_DONE
,
notLoading
);
},
getWhiteList
({
commit
},
list
)
{
commit
(
GET_WHITE_LIST
,
list
);
},
};
const
mutations
=
{
[
FETCH_START
](
state
,
notLoading
)
{
...
...
@@ -34,6 +40,9 @@ const mutations = {
state
.
loading
=
false
;
}
},
[
GET_WHITE_LIST
](
state
,
list
)
{
state
.
whiteList
=
[...
state
.
whiteList
,
...
list
];
},
};
export
default
{
modules
:
{
...
...
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