1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-15 21:01:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
bookshelfplus/bookshelfplus-frontend/views/component/third-party-login-button.html

22 lines
930 B
HTML

<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('qq')">QQ</button>
<script>
// 第三方授权登录逻辑
function thirdPartyLogin(type) {
getRequest("/third-party/login", { platform: type })
.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);
});
}
</script>