mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-19 00:10:39 +08:00
24 lines
1.2 KiB
HTML
24 lines
1.2 KiB
HTML
<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(platform) {
|
|
getRequest("/third-party/login", { platform: platform })
|
|
.then(function (response) {
|
|
var axiosData = response.data;
|
|
var status = axiosData.status;
|
|
var data = axiosData.data;
|
|
if (status === "success") {
|
|
location.href = data;
|
|
} else {
|
|
alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
alert("无法连接到服务器,请检查网络连接!");
|
|
});
|
|
}
|
|
</script> |