代码拉取完成,页面将自动刷新
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<!--
这个页面是为了免去用户体验产品时候要打包自己app的麻烦而存在,正常情况不需要这个页面,
直接在main.js中配置上服务器地址就可以了。
-->
<body>
<div id="inputArea" style="display: none;">
<h2>本客户端app是用来做体验使用,默认访问本机服务,如果需要在其他电脑体验本app请输入服务器ip地址</h2>
<input type="text" id="ipAddress" placeholder="服务器ip/域名(127.0.0.1/wex5.com)" style="width:300px;" />
<button type="button" id="submit">确定</button>
</div>
<script>
var defaultServerIp = localStorage.getItem("electronStartURL") || "127.0.0.1";
document.querySelector("#submit").addEventListener("click",function(){
var serverIp = document.querySelector("#ipAddress").value;
checkIp(serverIp);
});
function checkIp(ip){
var url = "https://" + ip + ":8080/x5/UI2/chat/bex5/pc/index.w";
try{
var xhr = new XMLHttpRequest();
xhr.timeout = 2000;
xhr.open('GET', url);
xhr.send(null);
xhr.onload = function () {
localStorage.setItem("electronStartURL",ip);
location.href = url;
};
xhr.onerror = function () {
showInputArea();
};
xhr.ontimeout = function (e) {
showInputArea();
};
}catch(e){
showInputArea();
}
}
function showInputArea(){
document.querySelector("#inputArea").style.display="block";
}
checkIp(defaultServerIp);
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。