Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
277bada3
authored
2022-08-08 16:31:41 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
session
1 parent
6fa7dc2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
34 deletions
src/layout/components/Navbar.vue
src/utils/session.js
src/layout/components/Navbar.vue
View file @
277bada
...
...
@@ -21,25 +21,25 @@
import
{
mapGetters
}
from
'vuex'
import
Breadcrumb
from
'@/components/Breadcrumb'
import
Hamburger
from
'@/components/Hamburger'
import
{
getSession
}
from
'@/utils/session'
//
import { getSession } from '@/utils/session'
export
default
{
components
:
{
Breadcrumb
,
Hamburger
},
created
()
{
this
.
init
();
//
this.init();
},
computed
:
{
...
mapGetters
([
'sidebar'
,
'avatar'
,
'name'
])
},
methods
:
{
init
()
{
let
userInfo
=
getSession
(
'userInfo'
);
if
(
userInfo
&&
userInfo
.
userValid
===
0
)
{
this
.
userValid
=
0
;
}
},
//
init () {
//
let userInfo = getSession('userInfo');
//
if (userInfo && userInfo.userValid === 0) {
//
this.userValid = 0;
//
}
//
},
toggleSideBar
()
{
this
.
$store
.
dispatch
(
'app/toggleSideBar'
)
},
...
...
src/utils/session.js
deleted
100644 → 0
View file @
6fa7dc2
// setSession
export
function
setSession
(
key
,
value
,
time
)
{
time
=
time
?
Date
.
parse
(
new
Date
())
+
time
*
1000
*
60
:
null
let
params
=
{
value
:
value
,
time
:
time
?
time
:
null
}
window
.
sessionStorage
.
setItem
(
key
,
JSON
.
stringify
(
params
))
}
// getSession
export
function
getSession
(
key
)
{
let
params
=
window
.
sessionStorage
.
getItem
(
key
)
if
(
!
params
)
return
null
params
=
JSON
.
parse
(
params
)
if
(
params
.
time
)
{
if
(
params
.
time
>
Date
.
parse
(
new
Date
))
{
return
params
.
value
}
window
.
sessionStorage
.
removeItem
(
key
)
return
null
}
return
params
.
value
}
export
function
removeSession
(
key
)
{
return
sessionStorage
.
removeItem
(
key
)
}
\ No newline at end of file
Please
register
or
sign in
to post a comment