mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-04-05 17:37:53 +08:00
40 lines
1.2 KiB
HTML
40 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>Sa-Token-SSO-Client端-测试页(前后端分离版-原生h5)</title>
|
||
</head>
|
||
<body>
|
||
<h2>Sa-Token SSO-Client 应用端(前后端分离版-原生h5)</h2>
|
||
<p>当前是否登录:<b class="is-login"></b></p>
|
||
<p>
|
||
<a href="javascript:location.href='sso-login.html?back=' + encodeURIComponent(location.href);">登录</a>
|
||
<a href="javascript:location.href=baseUrl + '/sso/logout?satoken=' + localStorage.satoken + '&back=' + encodeURIComponent(location.href);">注销</a>
|
||
</p>
|
||
<script src="https://unpkg.zhimg.com/jquery@3.4.1/dist/jquery.min.js"></script>
|
||
<script type="text/javascript">
|
||
|
||
// 后端接口地址
|
||
var baseUrl = "http://sa-sso-client1.com:9002";
|
||
|
||
// 查询当前会话是否登录
|
||
$.ajax({
|
||
url: baseUrl + '/sso/isLogin',
|
||
type: "post",
|
||
dataType: 'json',
|
||
headers: {
|
||
"X-Requested-With": "XMLHttpRequest",
|
||
"satoken": localStorage.getItem("satoken")
|
||
},
|
||
success: function(res){
|
||
$('.is-login').html(res.data + '');
|
||
},
|
||
error: function(xhr, type, errorThrown){
|
||
return alert("异常:" + JSON.stringify(xhr));
|
||
}
|
||
});
|
||
|
||
</script>
|
||
</body>
|
||
</html>
|