<!documentTYPE html>
|
<html class="ui-page-login">
|
|
<head>
|
<meta charset="utf-8">
|
<meta name="viewport"
|
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
<title></title>
|
<script src="js/mui.js"></script>
|
<script src="js/api.js"></script>
|
<link href="css/mui.min.css" rel="stylesheet" />
|
|
<script src="js/jquery-1.11.1.js"></script>
|
<script src="js/jquery.xml2json.js.js"></script>
|
|
<link href="css/mui.min.css" rel="stylesheet" />
|
<link href="css/style.css" rel="stylesheet" />
|
<style>
|
.mui-input-group {
|
margin-top: 10px;
|
}
|
|
.mui-input-group:first-child {
|
margin-top: 20px;
|
}
|
|
.mui-input-group label {
|
width: 30%;
|
}
|
|
.mui-input-row label~input,
|
.mui-input-row label~textarea {
|
width: 70%;
|
}
|
|
.mui-content-padded {
|
margin-top: 20px;
|
}
|
|
.mui-btn {
|
padding: 10px;
|
}
|
</style>
|
|
</head>
|
|
<body>
|
<header class="mui-bar mui-bar-nav">
|
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
|
<h1 class="mui-title">设置服务器信息</h1>
|
</header>
|
<div class="mui-content">
|
|
<form id='login-form' class="mui-input-group">
|
<div class="mui-input-row account">
|
<label>IP</label>
|
<input id='ip' type="text" class="mui-input-clear mui-input" placeholder="请输入IP">
|
</div>
|
<div class="mui-input-row">
|
<label>端口</label>
|
<input id='post' type="text" class="mui-input-clear mui-input" placeholder="请输入端口">
|
</div>
|
<div class="mui-input-row">
|
<label>war包名</label>
|
<input id='index' type="text" class="mui-input-clear mui-input" placeholder="请输入war包名">
|
</div>
|
</form>
|
|
<div class="mui-content-padded">
|
<button type="button" onclick="savebtn()" class="mui-btn mui-btn-block mui-btn-primary">保存</button>
|
</div>
|
|
</div>
|
<script src="js/mui.min.js"></script>
|
<script src="js/mui.enterfocus.js"></script>
|
<script src="js/app.js"></script>
|
<script src="js/utils.js"></script>
|
<script>
|
mui.plusReady(function() {
|
plus.screen.lockOrientation("portrait-primary");
|
});
|
mui.ready(function() {
|
//判断缓存里面有无ip,port已经war,无则去API.webPath中取
|
var storage = window.localStorage;
|
if(storage["ip"]==null||storage["post"]==null||storage["index"]==null){
|
storage["ip"] = API.webPath.split("//")[1].split('/')[0].split(':')[0]
|
storage["post"] = API.webPath.split("//")[1].split('/')[0].split(':')[1]
|
storage["index"] = API.webPath.split("//")[1].split('/')[1]
|
var _basePath = "http://" + storage["ip"] + ":" + storage["post"] + "/" + storage["index"];
|
storage["_basePath"] = _basePath;
|
}
|
//存储到loaclStage
|
document.getElementById('ip').value = storage["ip"];
|
document.getElementById('post').value = storage["post"];
|
document.getElementById('index').value = storage["index"];
|
|
|
})
|
// 保存信息
|
function savebtn() {
|
var ip = document.getElementById('ip').value;
|
var post = document.getElementById('post').value;
|
var index = document.getElementById('index').value;
|
if (!inputValueNotNull("ip", ip)) {
|
mui.toast("IP:不允许为空!!!");
|
return;
|
}
|
if (!inputValueNotNull("post", post)) {
|
mui.toast("端口:不允许为空!!!");
|
return;
|
}
|
if (!inputValueNotNull("index", index)) {
|
index = '';
|
}
|
var btnArray = ['否', '是'];
|
mui.confirm('是否确认保存服务器信息?', '确认保存', btnArray, function(e) {
|
if (e.index == 1) {
|
//存储到loaclStage
|
var storage = window.localStorage;
|
storage["ip"] = ip;
|
storage["post"] = post;
|
storage["index"] = index;
|
var _basePath = "http://" + ip + ":" + post + "/" + index;
|
storage["_basePath"] = _basePath;
|
closeme();
|
} else {
|
|
}
|
})
|
}
|
// 关闭自身窗口
|
function closeme() {
|
var ws = plus.webview.currentWebview();
|
plus.webview.close(ws);
|
var list = plus.webview.currentWebview().opener();
|
//触发列表界面的自定义事件(refresh),从而进行数据刷新
|
mui.fire(list, 'refresh');
|
}
|
</script>
|
</body>
|
|
</html>
|