mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-16 23:22:20 +08:00
Gitee授权登录成功
This commit is contained in:
@@ -13,4 +13,8 @@
|
||||
// API地址
|
||||
const APIHOST = '<%= global.site.api.prefix %>';
|
||||
axios.defaults.baseURL = APIHOST;
|
||||
</script>
|
||||
</script>
|
||||
<style>
|
||||
/* 字体加载前先隐藏,不然文字会闪一下 */
|
||||
html, body { opacity: 0; }
|
||||
</style>
|
@@ -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>
|
Reference in New Issue
Block a user