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
ab67dc8c
Commit
ab67dc8c
authored
May 06, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
记录菜单状态 See merge request
!80
parents
93b5e3fd
19ae235d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
9 deletions
+51
-9
App.vue
src/App.vue
+32
-5
fetch.js
src/api/fetch.js
+1
-0
index.js
src/config/index.js
+1
-0
Api.js
src/lib/Api.js
+1
-0
auth.js
src/utils/auth.js
+16
-4
No files found.
src/App.vue
View file @
ab67dc8c
...
...
@@ -63,6 +63,8 @@ import UserBox from './containers/layout/components/UserBox';
import
IconMenus
from
'./containers/layout/IconMenu/IconMenu'
;
import
CollectMenu
from
'./containers/layout/Collect/Collect'
;
import
{
mapGetters
}
from
'vuex'
;
import
{
getStorageData
,
setStorageData
}
from
'@/utils/auth'
;
import
{
STSTEM_STATE_KEY
}
from
'@/config'
;
export
default
{
name
:
'App'
,
...
...
@@ -78,15 +80,14 @@ export default {
},
},
data
()
{
console
.
log
(
this
.
$route
);
const
{
selectedRoute
,
showFastLink
,
showSelected
}
=
this
.
loadRouteState
();
return
{
title
:
''
,
selectedRoute
:
[]
,
selectedRoute
:
selectedRoute
,
routerDone
:
false
,
isInnerPage
:
false
,
showFastLink
:
false
,
showSelected
:
false
,
showFastLink
:
showFastLink
,
showSelected
:
showSelected
,
};
},
computed
:
{
...
...
@@ -136,11 +137,37 @@ export default {
this
.
showFastLink
=
entity
;
this
.
showSelected
=
false
;
}
this
.
saveRouteState
();
},
selectRouteMenu
(
routes
)
{
this
.
selectedRoute
=
routes
;
this
.
showSelected
=
true
;
this
.
showFastLink
=
false
;
this
.
saveRouteState
();
},
saveRouteState
()
{
const
{
selectedRoute
,
showFastLink
,
showSelected
}
=
this
;
setStorageData
(
STSTEM_STATE_KEY
,
JSON
.
stringify
({
selectedRoute
,
showFastLink
,
showSelected
,
})
);
},
loadRouteState
()
{
let
dataStr
=
getStorageData
(
STSTEM_STATE_KEY
);
if
(
dataStr
)
{
let
data
=
JSON
.
parse
(
dataStr
);
return
data
;
}
else
{
return
{
selectedRoute
:
[],
showFastLink
:
false
,
showSelected
:
false
,
};
}
},
},
};
...
...
src/api/fetch.js
View file @
ab67dc8c
...
...
@@ -56,6 +56,7 @@ service.interceptors.response.use(response => {
if
(
res
.
code
!==
SUCCESS_CODE
)
{
if
(
response
.
headers
&&
response
.
headers
[
'content-type'
]
&&
/application
\/
octet-stream/
.
test
(
response
.
headers
[
'content-type'
].
toLowerCase
()
)
...
...
src/config/index.js
View file @
ab67dc8c
export
const
TOKEN_KEY
=
'dcrym'
;
export
const
STSTEM_STATE_KEY
=
'dcrym-state'
;
export
const
SUCCESS_CODE
=
1000
;
export
const
LOGOUT_CODE
=
-
2
;
...
...
src/lib/Api.js
View file @
ab67dc8c
...
...
@@ -57,6 +57,7 @@ const createBaseFetch = config => {
if
(
res
.
code
!==
SUCCESS_CODE
)
{
if
(
response
.
headers
&&
response
.
headers
[
'content-type'
]
&&
/application
\/
octet-stream/
.
test
(
response
.
headers
[
'content-type'
].
toLowerCase
()
)
...
...
src/utils/auth.js
View file @
ab67dc8c
import
{
TOKEN_KEY
}
from
'@/config/index'
;
import
{
TOKEN_KEY
,
STSTEM_STATE_KEY
}
from
'@/config/index'
;
const
TokenKey
=
TOKEN_KEY
;
export
function
getToken
()
{
return
sessionStorage
.
getItem
(
TokenKey
);
return
getStorageData
(
TokenKey
);
}
export
function
setToken
(
token
,
expires
)
{
return
se
ssionStorage
.
setItem
(
TokenKey
,
token
);
return
se
tStorageData
(
TokenKey
,
token
);
}
export
function
removeToken
()
{
return
sessionStorage
.
removeItem
(
TOKEN_KEY
);
removeStorageData
(
TOKEN_KEY
);
removeStorageData
(
STSTEM_STATE_KEY
);
return
;
}
export
function
getStorageData
(
key
)
{
return
sessionStorage
.
getItem
(
key
);
}
export
function
setStorageData
(
key
,
data
)
{
return
sessionStorage
.
setItem
(
key
,
data
);
}
export
function
removeStorageData
(
key
)
{
return
sessionStorage
.
removeItem
(
key
);
}
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