Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
任超
/
js.portalStaticPage
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
b79c5e97
authored
2020-12-24 15:40:40 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:登录
1 parent
32cf54b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
24 deletions
staticJs/head.js
staticJs/login.js
staticJs/head.js
View file @
b79c5e9
...
...
@@ -38,7 +38,7 @@ document.writeln(" <li class='personalCenter'>");
document
.
writeln
(
" <a href=\'"
+
localhostPaht
+
"/staticViews/grzx.html\'>个人中心</a>"
);
document
.
writeln
(
" </li>"
);
document
.
writeln
(
" <li>"
);
document
.
writeln
(
" <p class='PersonLogin'>登录</p>"
);
document
.
writeln
(
" <p class='
loginButton
PersonLogin'>登录</p>"
);
document
.
writeln
(
" </li>"
);
document
.
writeln
(
" <li>"
);
document
.
writeln
(
" <p id='cancellation'>注销</p>"
);
...
...
staticJs/login.js
View file @
b79c5e9
...
...
@@ -42,12 +42,21 @@ $(document).on('click', '#cancellation', function () {
btn
:
[
'是'
,
'否'
]
//按钮
},
function
()
{
delCookie
();
$
(
'.loginButton'
).
addClass
(
'PersonLogin'
)
window
.
open
(
''
+
localhostPaht
+
'/index.html'
,
'_self'
)
},
function
()
{
layer
.
msg
(
'已取消'
);
});
})
});
$
(
function
()
{
if
(
getCookie
(
'myCookie'
).
username
)
{
$
(
'.loginButton'
).
html
(
getCookie
(
'myCookie'
).
username
);
$
(
'.loginButton'
).
removeClass
(
'PersonLogin'
)
$
(
'.personalCenter'
).
addClass
(
'show'
);
}
})
function
delCookie
()
{
var
keys
=
document
.
cookie
.
match
(
/
[^
=;
]
+
(?=
=
)
/g
)
if
(
keys
)
{
...
...
@@ -59,28 +68,6 @@ function delCookie() {
}
}
$
(
function
()
{
$
(
'.PersonLogin'
).
html
(
getCookie
(
'myCookie'
).
username
)
if
(
getCookie
(
'myCookie'
).
username
)
{
$
(
'.personalCenter'
).
addClass
(
'show'
);
}
var
_beforeUnload_time
=
0
,
_gap_time
=
0
;
var
is_fireFox
=
navigator
.
userAgent
.
indexOf
(
"Firefox"
)
>
-
1
;
//是否是火狐浏览器
window
.
onunload
=
function
()
{
_gap_time
=
new
Date
().
getTime
()
-
_beforeUnload_time
;
if
(
_gap_time
<=
5
)
{
delCookie
();
}
else
{
//浏览器刷新
}
}
window
.
onbeforeunload
=
function
()
{
_beforeUnload_time
=
new
Date
().
getTime
();
if
(
is_fireFox
)
{
//火狐关闭执行
delCookie
();
}
};
})
// 点击注册的时候
$
(
document
).
on
(
'click'
,
'#registerButton'
,
function
()
{
window
.
open
(
''
+
localhostPaht
+
'/staticViews/register.html'
,
'_self'
)
...
...
@@ -97,8 +84,9 @@ function clicklogin(data) {
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
if
(
result
.
code
==
200
&&
result
.
data
!==
null
)
{
setCookie
(
'myCookie'
,
result
.
data
,
60
);
$
(
'.loginButton'
).
removeClass
(
'PersonLogin'
)
$
(
'.personalCenter'
).
addClass
(
'show'
);
$
(
'.
PersonLogi
n'
).
html
(
getCookie
(
'myCookie'
).
username
);
$
(
'.
loginButto
n'
).
html
(
getCookie
(
'myCookie'
).
username
);
layer
.
closeAll
();
}
else
if
(
result
.
code
==
210
)
{
layer
.
msg
(
result
.
message
);
...
...
Please
register
or
sign in
to post a comment