Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
techbook
Project
Project
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
front-end-dev
techbook
Commits
cd8c4005
Commit
cd8c4005
authored
Nov 20, 2019
by
zhangyanni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PC登录之后半小时内不用重新登录
parent
f174104d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
0 deletions
+29
-0
public.js
src/assets/js/public.js
+14
-0
public.js
src/common/public.js
+8
-0
emByCodeCmpt.vue
src/components/login/emByCodeCmpt.vue
+2
-0
emByPwdCmpt.vue
src/components/login/emByPwdCmpt.vue
+1
-0
mbByCodeCmpt.vue
src/components/login/mbByCodeCmpt.vue
+2
-0
mbByPwdCmpt.vue
src/components/login/mbByPwdCmpt.vue
+1
-0
main.js
src/main.js
+1
-0
No files found.
src/assets/js/public.js
View file @
cd8c4005
...
...
@@ -42,4 +42,18 @@ export default {
return
true
;
}
},
//读取cookie
getUserInfoCookie
:
function
()
{
if
(
document
.
cookie
.
length
>
0
)
{
var
arr
=
document
.
cookie
.
split
(
'; '
);
//这里显示的格式需要切割一下自己可输出看下
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
var
arr2
=
arr
[
i
].
split
(
'='
);
//再次切割
//判断查找相对应的值
if
(
arr2
[
0
]
==
'userInfo'
)
{
window
.
sessionStorage
.
setItem
(
"userInfo"
,
arr2
[
1
])
//保存到保存数据的地方
}
}
}
},
}
src/common/public.js
View file @
cd8c4005
...
...
@@ -132,6 +132,14 @@ export default {
window
.
document
.
cookie
=
"userPwd"
+
"="
+
c_pwd
+
";path=/;expires="
+
exdate
.
toGMTString
();
},
//设置cookie
setUserInfoCookie
(
user_info
)
{
var
exdate
=
new
Date
();
//获取时间
exdate
.
setTime
(
exdate
.
getTime
()
+
30
*
60
*
1000
);
//保存的天数
//字符串拼接cookie
window
.
document
.
cookie
=
"userInfo"
+
"="
+
user_info
+
";path=/;expires="
+
exdate
.
toGMTString
();
},
//清除cookie
clearCookie
:
function
()
{
this
.
setCookie
(
""
,
""
,
-
1
);
//修改2值都为空,天数为负1天就好了
...
...
src/components/login/emByCodeCmpt.vue
View file @
cd8c4005
...
...
@@ -49,6 +49,7 @@
import
validate
from
'../../common/validate'
;
import
sliderCmpt
from
'../common/puzzleSlider'
;
import
api
from
'../../views/loginregister/api/api'
;
import
publicFunc
from
'../../common/public'
;
export
default
{
name
:
"emByCodeCmpt"
,
components
:{
...
...
@@ -153,6 +154,7 @@
window
.
sessionStorage
.
removeItem
(
"userInfo"
);
}
window
.
sessionStorage
.
setItem
(
"userInfo"
,
this
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
publicFunc
.
setUserInfoCookie
(
this
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
this
.
hasSetPassword
(
data
);
},
...
...
src/components/login/emByPwdCmpt.vue
View file @
cd8c4005
...
...
@@ -130,6 +130,7 @@
window
.
sessionStorage
.
removeItem
(
"userInfo"
);
}
window
.
sessionStorage
.
setItem
(
"userInfo"
,
this
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
publicFunc
.
setUserInfoCookie
(
that
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
if
(
data
.
locked
==
1
&&
data
.
empType
!=
2
)
this
.
$router
.
replace
(
"/completeInfoCmpt"
);
data
.
empType
==
0
?
this
.
$router
.
push
({
path
:
"/bigBusiness/list"
,
query
:{
remind
:
true
}}):
data
.
empType
==
1
?
this
.
$router
.
push
({
path
:
"/seeprojectlist"
,
query
:{
remind
:
true
}}):
data
.
roleList
[
0
].
roleType
==
1
?
this
.
$router
.
push
(
"/sys.user"
):
this
.
$router
.
push
(
"/seeprojectlist"
);
this
.
timeOutReturn
();
...
...
src/components/login/mbByCodeCmpt.vue
View file @
cd8c4005
...
...
@@ -42,6 +42,7 @@
import
api
from
'../../views/loginregister/api/api'
;
import
validate
from
'../../common/validate'
;
import
sliderCmpt
from
'../common/puzzleSlider'
;
import
publicFunc
from
'../../common/public'
;
export
default
{
name
:
"mbByCodeCmpt"
,
components
:{
...
...
@@ -127,6 +128,7 @@
window
.
sessionStorage
.
removeItem
(
"userInfo"
);
}
window
.
sessionStorage
.
setItem
(
"userInfo"
,
that
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
publicFunc
.
setUserInfoCookie
(
that
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
this
.
hasSetPassword
(
data
);
},
...
...
src/components/login/mbByPwdCmpt.vue
View file @
cd8c4005
...
...
@@ -161,6 +161,7 @@
window
.
sessionStorage
.
removeItem
(
"userInfo"
);
}
window
.
sessionStorage
.
setItem
(
"userInfo"
,
that
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
publicFunc
.
setUserInfoCookie
(
that
.
Base64
.
encode
(
JSON
.
stringify
(
data
)));
if
(
data
.
locked
==
1
&&
data
.
empType
!=
2
)
this
.
$router
.
replace
(
"/completeInfoCmpt"
);
data
.
empType
==
0
?
this
.
$router
.
push
({
path
:
"/bigBusiness/list"
,
query
:{
remind
:
true
}}):
data
.
empType
==
1
?
this
.
$router
.
push
({
path
:
"/seeprojectlist"
,
query
:{
remind
:
true
}}):
data
.
roleList
[
0
].
roleType
==
1
?
this
.
$router
.
push
(
"/sys.user"
):
this
.
$router
.
push
(
"/seeprojectlist"
);
that
.
timeOutReturn
()
...
...
src/main.js
View file @
cd8c4005
...
...
@@ -103,6 +103,7 @@ const i18n = new VueI18n({
}
})();
publicFun
.
getUserInfoCookie
();
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// console.log(window.__asxiosPromiseArr)
if
(
window
.
__asxiosPromiseArr
)
{
...
...
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