kefu/static/templates/default/sso.html

46 lines
1.1 KiB
HTML
Raw Normal View History

2024-12-10 02:50:12 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>智能在线客服系统</title>
</head>
<body>
<h2>正在登录...</h2>
<script>
//获取当前域名
function getBaseUrl() {
var ishttps = 'https:' == document.location.protocol ? true : false;
var url = window.location.host;
if (ishttps) {
url = 'https://' + url;
} else {
url = 'http://' + url;
}
return url;
}
var TOKEN='{{.TOKEN}}';
var REDIRECT='{{.REDIRECT}}';
if(REDIRECT==""){
alert("请传递跳转参数");
window.history.back();
}
if(navigator.cookieEnabled&&typeof window.localStorage !== 'undefined'){
localStorage.setItem("token", TOKEN);
var h5Token=JSON.stringify({type: "object",data:{
token:TOKEN,
domain:getBaseUrl()
}})
localStorage.setItem("app", h5Token);
var domainObj=JSON.stringify({type: "object",data:{
domain:getBaseUrl()
}})
localStorage.setItem("domain", domainObj);
window.location.href=REDIRECT;
}else{
alert("不支持cookie和localStorge");
}
</script>
</body>
</html>