Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-system
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-system
Commits
19ae235d
Commit
19ae235d
authored
May 06, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
记录菜单状态
parent
b7b4ce1e
Hide 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 @
19ae235d
...
@@ -63,6 +63,8 @@ import UserBox from './containers/layout/components/UserBox';
...
@@ -63,6 +63,8 @@ import UserBox from './containers/layout/components/UserBox';
import
IconMenus
from
'./containers/layout/IconMenu/IconMenu'
;
import
IconMenus
from
'./containers/layout/IconMenu/IconMenu'
;
import
CollectMenu
from
'./containers/layout/Collect/Collect'
;
import
CollectMenu
from
'./containers/layout/Collect/Collect'
;
import
{
mapGetters
}
from
'vuex'
;
import
{
mapGetters
}
from
'vuex'
;
import
{
getStorageData
,
setStorageData
}
from
'@/utils/auth'
;
import
{
STSTEM_STATE_KEY
}
from
'@/config'
;
export
default
{
export
default
{
name
:
'App'
,
name
:
'App'
,
...
@@ -78,15 +80,14 @@ export default {
...
@@ -78,15 +80,14 @@ export default {
},
},
},
},
data
()
{
data
()
{
console
.
log
(
this
.
$route
);
const
{
selectedRoute
,
showFastLink
,
showSelected
}
=
this
.
loadRouteState
();
return
{
return
{
title
:
''
,
title
:
''
,
selectedRoute
:
[]
,
selectedRoute
:
selectedRoute
,
routerDone
:
false
,
routerDone
:
false
,
isInnerPage
:
false
,
isInnerPage
:
false
,
showFastLink
:
false
,
showFastLink
:
showFastLink
,
showSelected
:
false
,
showSelected
:
showSelected
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -136,11 +137,37 @@ export default {
...
@@ -136,11 +137,37 @@ export default {
this
.
showFastLink
=
entity
;
this
.
showFastLink
=
entity
;
this
.
showSelected
=
false
;
this
.
showSelected
=
false
;
}
}
this
.
saveRouteState
();
},
},
selectRouteMenu
(
routes
)
{
selectRouteMenu
(
routes
)
{
this
.
selectedRoute
=
routes
;
this
.
selectedRoute
=
routes
;
this
.
showSelected
=
true
;
this
.
showSelected
=
true
;
this
.
showFastLink
=
false
;
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 @
19ae235d
...
@@ -56,6 +56,7 @@ service.interceptors.response.use(response => {
...
@@ -56,6 +56,7 @@ service.interceptors.response.use(response => {
if
(
res
.
code
!==
SUCCESS_CODE
)
{
if
(
res
.
code
!==
SUCCESS_CODE
)
{
if
(
if
(
response
.
headers
&&
response
.
headers
&&
response
.
headers
[
'content-type'
]
&&
/application
\/
octet-stream/
.
test
(
/application
\/
octet-stream/
.
test
(
response
.
headers
[
'content-type'
].
toLowerCase
()
response
.
headers
[
'content-type'
].
toLowerCase
()
)
)
...
...
src/config/index.js
View file @
19ae235d
export
const
TOKEN_KEY
=
'dcrym'
;
export
const
TOKEN_KEY
=
'dcrym'
;
export
const
STSTEM_STATE_KEY
=
'dcrym-state'
;
export
const
SUCCESS_CODE
=
1000
;
export
const
SUCCESS_CODE
=
1000
;
export
const
LOGOUT_CODE
=
-
2
;
export
const
LOGOUT_CODE
=
-
2
;
...
...
src/lib/Api.js
View file @
19ae235d
...
@@ -57,6 +57,7 @@ const createBaseFetch = config => {
...
@@ -57,6 +57,7 @@ const createBaseFetch = config => {
if
(
res
.
code
!==
SUCCESS_CODE
)
{
if
(
res
.
code
!==
SUCCESS_CODE
)
{
if
(
if
(
response
.
headers
&&
response
.
headers
&&
response
.
headers
[
'content-type'
]
&&
/application
\/
octet-stream/
.
test
(
/application
\/
octet-stream/
.
test
(
response
.
headers
[
'content-type'
].
toLowerCase
()
response
.
headers
[
'content-type'
].
toLowerCase
()
)
)
...
...
src/utils/auth.js
View file @
19ae235d
import
{
TOKEN_KEY
}
from
'@/config/index'
;
import
{
TOKEN_KEY
,
STSTEM_STATE_KEY
}
from
'@/config/index'
;
const
TokenKey
=
TOKEN_KEY
;
const
TokenKey
=
TOKEN_KEY
;
export
function
getToken
()
{
export
function
getToken
()
{
return
sessionStorage
.
getItem
(
TokenKey
);
return
getStorageData
(
TokenKey
);
}
}
export
function
setToken
(
token
,
expires
)
{
export
function
setToken
(
token
,
expires
)
{
return
se
ssionStorage
.
setItem
(
TokenKey
,
token
);
return
se
tStorageData
(
TokenKey
,
token
);
}
}
export
function
removeToken
()
{
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