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

Gitee授权登录成功

This commit is contained in:
2022-04-04 20:49:20 +08:00
parent 54911675a1
commit 5acd55c687
16 changed files with 229 additions and 63 deletions

View File

@@ -13,4 +13,8 @@
// API地址
const APIHOST = '<%= global.site.api.prefix %>';
axios.defaults.baseURL = APIHOST;
</script>
</script>
<style>
/* 字体加载前先隐藏,不然文字会闪一下 */
html, body { opacity: 0; }
</style>

View File

@@ -0,0 +1,20 @@
<button type="button" onclick="thirdPartyLogin('gitee')">Gitee</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>