1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-22 01:30:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

后台管理前端结构调整;管理员后台添加第三方账号绑定

This commit is contained in:
2022-04-05 14:54:36 +08:00
parent 936a18404c
commit 364566d6c1
27 changed files with 515 additions and 527 deletions

View File

@@ -1,43 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%- include("../component/header.html"); %>
<%- include("../component/header-user.html"); %>
<style>
#container {
display: grid;
grid-template-columns: 1fr;
gap: 30px;
place-items: center;
margin-top: 40px;
}
.mainNav {
vertical-align: middle;
margin: 0 8px;
transition: 0.26s;
}
.mainNav:hover {
color: #fff;
background-color: black;
padding: 5px 8px;
border-radius: 4px;
transform: scale(1.2);
}
</style>
</head>
<body>
<%- include("../component/navbar.html"); %>
<main class="main">
<h1><%= headText %></h1>
<div id="container">
<% links.forEach(item=> { %>
<nobr>
<a class="mainNav" href="<%= item.url %>"><%= item.name %></a>
</nobr>
<% }); %>
</div>
</main>
<%- include("../component/footer-user.html"); %>
</body>
</html>

View File

@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%- include("../component/header.html"); %>
<%- include("../component/header-user.html"); %>
</head>
<body>
<%- include("../component/navbar.html"); %>
<main class="main">
<h1><%= headSubTextArr[page] || page %></h1>
<div id="container">
<div>
</div>
</div>
</main>
<%- include("../component/footer-user.html"); %>
</body>
</html>

View File

@@ -1,81 +1,4 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%- include("../component/header.html"); %>
<%- include("../component/header-user.html"); %>
</head>
<body>
<%- include("../component/navbar.html"); %>
<main class="main">
<h1><%= headSubTextArr[page] || page %></h1>
<div id="container">
<div>
<h3>绑定第三方账号</h3>
<%- include("../../component/third-party-login-button.html"); %>
<div id="withdraw-container" style="display: none;">
<h3>取消第三方账号绑定</h3>
<div id="withdraw-buttons"></div>
</div>
</div>
</div>
</main>
<%- include("../component/footer-user.html"); %>
<script>
function thirdPartyWithdraw(platform) {
postRequest("/third-party/withdrawThirdPartyBings", { token: localStorage.token, platform: platform })
.then(function (response) {
var axiosData = response.data;
var status = axiosData.status;
var data = axiosData.data;
if (status === "success") {
console.log(data);
if(data == "success") {
alert("取消绑定成功!");
location.reload();
} else {
alert("出错啦,刷新页面重新试试吧");
}
} else {
alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);
location.reload();
}
}).catch(function (error) {
console.log(error);
alert("无法连接到服务器,请检查网络连接!");
});
}
if(localStorage.token != null) {
getRequest("/third-party/getBindingStatus", { token: localStorage.token })
.then(function (response) {
var axiosData = response.data;
var status = axiosData.status;
var data = axiosData.data;
if (status === "success") {
console.log(data);
if(data) {
$("#withdraw-container").show();
data.forEach(platformName => {
// 隐藏绑定按钮
var btn = $(`#btn_${platformName.toLowerCase()}`);
var platformChineseName = btn.html();
btn.attr("disabled", true);
btn.html(platformChineseName+"(已绑定)");
// 添加取消绑定按钮
var withdrawBtn = $(`<button class="btn-third-party" id="btn_${platformName.toLowerCase()}_withdraw" onclick="thirdPartyWithdraw('${platformName}')">取消绑定${platformChineseName}</button>`);
$("#withdraw-buttons").append(withdrawBtn);
$("#withdraw-buttons").append(" ");
});
}
} else {
$(".btn-third-party").hide();
alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);
}
}).catch(function (error) {
console.log(error);
alert("无法连接到服务器,请检查网络连接!");
});
}
</script>
</body>
</html>
<div>
<h2>第三方账号管理</h2>
<%- include("../component/third-party-manage.html"); %>
</div>