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

取消第三方账号绑定前台样式初步完成

This commit is contained in:
2022-04-04 22:36:42 +08:00
parent 9fa00a2788
commit 7cca39d2de
2 changed files with 45 additions and 8 deletions

View File

@@ -1,12 +1,12 @@
<button type="button" onclick="thirdPartyLogin('gitee')">Gitee</button>
<button type="button" onclick="thirdPartyLogin('OSCHINA')">OSCHINA</button>
<button type="button" onclick="thirdPartyLogin('feishu')">飞书</button>
<button type="button" onclick="thirdPartyLogin('GitHub')">GitHub(不稳定)</button>
<button type="button" onclick="thirdPartyLogin('qq')">QQ</button>
<button class="btn-third-party" id="btn_gitee" onclick="thirdPartyLogin('gitee')">Gitee</button>
<button class="btn-third-party" id="btn_oschina" onclick="thirdPartyLogin('OSCHINA')">OSCHINA</button>
<button class="btn-third-party" id="btn_feishu" onclick="thirdPartyLogin('feishu')">飞书</button>
<button class="btn-third-party" id="btn_github" onclick="thirdPartyLogin('GitHub')">GitHub(不稳定)</button>
<button class="btn-third-party" id="btn_qq" onclick="thirdPartyLogin('qq')">QQ</button>
<script>
// 第三方授权登录逻辑
function thirdPartyLogin(type) {
getRequest("/third-party/login", { platform: type })
function thirdPartyLogin(platform) {
getRequest("/third-party/login", { platform: platform })
.then(function (response) {
var axiosData = response.data;
var status = axiosData.status;

View File

@@ -10,11 +10,48 @@
<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>
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);
});
}
</script>
</body>
</html>