1 Star 0 Fork 8

wex5 / dangchat-desktop

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
wex5 提交于 2016-07-22 22:57 . 初始化提交
<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>
JavaScript
1
https://gitee.com/wex5/dangchat-desktop.git
git@gitee.com:wex5/dangchat-desktop.git
wex5
dangchat-desktop
dangchat-desktop
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891