|
@@ -0,0 +1,36 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
|
|
|
+ <title>社交登陆测试页</title>
|
|
|
+ <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<div>点击如下按钮,发起登陆的测试</div>
|
|
|
+<div>
|
|
|
+ <button id="wx_pub">微信公众号</button>
|
|
|
+</div>
|
|
|
+</body>
|
|
|
+<script>
|
|
|
+ let server = 'http://127.0.0.1:28080';
|
|
|
+
|
|
|
+ // 微信公众号
|
|
|
+ $( "#wx_pub").on( "click", function() {
|
|
|
+ // 获得授权链接
|
|
|
+ $.ajax({
|
|
|
+ url: server + "/api/social-auth-redirect?type=31&redirectUri=" +
|
|
|
+ encodeURIComponent(server + '/api/social-login-get'),
|
|
|
+ method: 'GET',
|
|
|
+ success: function( result ) {
|
|
|
+ if (result.code !== 0) {
|
|
|
+ alert('获得授权链接失败,原因:' + result.msg)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 跳转重定向
|
|
|
+ document.location.href = result.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+</script>
|
|
|
+</html>
|