This commit is contained in:
@@ -451,6 +451,14 @@
|
|||||||
.no-login,
|
.no-login,
|
||||||
.login-in {
|
.login-in {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-login .btn-normal {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.jr-tabs .title {
|
.jr-tabs .title {
|
||||||
|
|||||||
@@ -44,8 +44,11 @@ $(function () {
|
|||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const obj = res.data.account;
|
const obj = res.data.account;
|
||||||
|
// 只在桌面端显示登录状态
|
||||||
|
if (window.innerWidth > 767) {
|
||||||
$(".no-login").attr("style", "display:none");
|
$(".no-login").attr("style", "display:none");
|
||||||
$(".login-in").attr("style", "display:flex");
|
$(".login-in").attr("style", "display:flex");
|
||||||
|
}
|
||||||
$("#username").text(res.data.account.username);
|
$("#username").text(res.data.account.username);
|
||||||
const reg = /^[a-zA-Z]+$/;
|
const reg = /^[a-zA-Z]+$/;
|
||||||
if (reg.test(res.data.account.username.substring(0, 1))) {
|
if (reg.test(res.data.account.username.substring(0, 1))) {
|
||||||
@@ -73,9 +76,12 @@ $(function () {
|
|||||||
}
|
}
|
||||||
sessionStorage.accountInfo = JSON.stringify(obj);
|
sessionStorage.accountInfo = JSON.stringify(obj);
|
||||||
} else {
|
} else {
|
||||||
|
// 只在桌面端显示未登录状态
|
||||||
|
if (window.innerWidth > 767) {
|
||||||
$(".login-in").attr("style", "display:none");
|
$(".login-in").attr("style", "display:none");
|
||||||
$(".no-login").attr("style", "display:block");
|
$(".no-login").attr("style", "display:block");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -96,15 +102,21 @@ $(function () {
|
|||||||
sessionStorage.is_certification = false;
|
sessionStorage.is_certification = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 只在桌面端显示未登录状态
|
||||||
|
if (window.innerWidth > 767) {
|
||||||
$(".login-in").attr("style", "display:none");
|
$(".login-in").attr("style", "display:none");
|
||||||
$(".no-login").attr("style", "display:block");
|
$(".no-login").attr("style", "display:block");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 只在桌面端显示未登录状态
|
||||||
|
if (window.innerWidth > 767) {
|
||||||
$(".login-in").attr("style", "display:none");
|
$(".login-in").attr("style", "display:none");
|
||||||
$(".no-login").attr("style", "display:block");
|
$(".no-login").attr("style", "display:block");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// 设置通用信息相关的点击跳转(云服务器/物理机 CTA 等),来源于 SSR 注入的 window.__themeCommon
|
// 设置通用信息相关的点击跳转(云服务器/物理机 CTA 等),来源于 SSR 注入的 window.__themeCommon
|
||||||
const setCommData = () => {
|
const setCommData = () => {
|
||||||
@@ -174,8 +186,11 @@ $(function () {
|
|||||||
if (localStorage.jwt) {
|
if (localStorage.jwt) {
|
||||||
if (sessionStorage.accountInfo) {
|
if (sessionStorage.accountInfo) {
|
||||||
const obj = JSON.parse(sessionStorage.accountInfo);
|
const obj = JSON.parse(sessionStorage.accountInfo);
|
||||||
|
// 只在桌面端显示登录状态
|
||||||
|
if (window.innerWidth > 767) {
|
||||||
$(".no-login").attr("style", "display:none");
|
$(".no-login").attr("style", "display:none");
|
||||||
$(".login-in").attr("style", "display:flex");
|
$(".login-in").attr("style", "display:flex");
|
||||||
|
}
|
||||||
$("#username").text(obj.username);
|
$("#username").text(obj.username);
|
||||||
$("#headImg").text(obj.firstName);
|
$("#headImg").text(obj.firstName);
|
||||||
$("#headImg").attr("style", `background:${sessionStorage.headBgc}`);
|
$("#headImg").attr("style", `background:${sessionStorage.headBgc}`);
|
||||||
@@ -189,9 +204,12 @@ $(function () {
|
|||||||
}
|
}
|
||||||
initData();
|
initData();
|
||||||
} else {
|
} else {
|
||||||
|
// 只在桌面端显示未登录状态
|
||||||
|
if (window.innerWidth > 767) {
|
||||||
$(".login-in").attr("style", "display:none");
|
$(".login-in").attr("style", "display:none");
|
||||||
$(".no-login").attr("style", "display:block");
|
$(".no-login").attr("style", "display:block");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 退出登录
|
// 退出登录
|
||||||
$("#logout").click(function () {
|
$("#logout").click(function () {
|
||||||
localStorage.removeItem("jwt");
|
localStorage.removeItem("jwt");
|
||||||
|
|||||||
Reference in New Issue
Block a user