mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-10-21 22:56:41 +08:00
第三方快捷登录前端按钮;后端跳转逻辑;数据库映射完成
This commit is contained in:
@@ -71,6 +71,11 @@
|
||||
<input type="password" id="password" placeholder="密码">
|
||||
</div>
|
||||
<button class="btn-submit">登录</button>
|
||||
<p>
|
||||
快捷登录:
|
||||
<button type="button" onclick="thirdPartyLogin('gitee')">Gitee</button>
|
||||
<button type="button" onclick="thirdPartyLogin('qq')">QQ</button>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/register">注册</a>
|
||||
</p>
|
||||
@@ -83,6 +88,7 @@
|
||||
<!-- <script src="/assets/lib/cryptography/2.2/md5-min.js"></script> -->
|
||||
<!-- <script src="/assets/lib/cryptography/2.2/sha1-min.js"></script> -->
|
||||
<script>
|
||||
// 用户正常登录逻辑
|
||||
$("#username").val("xiaomo");
|
||||
$("#password").val("123456");
|
||||
$(".btn-submit").click(function() {
|
||||
@@ -124,5 +130,23 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user