TMRAppBle/html/setting.html

240 lines
8.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>系统设置</title>
<link rel="stylesheet" type="text/css" href="../css/mui_min.css">
<style>
body {
line-height: 2;
}
.mui-table-view {
margin-top: 20px;
}
.mui-table-view span.mui-pull-right {
color: #999;
}
.mui-table-view-divider {
background-color: #efeff4;
font-size: 14px;
}
.mui-table-view-divider:before, .mui-table-view-divider:after {
height: 0;
}
.update {
font-style: normal;
color: #999999;
margin-right: -25px;
font-size: 15px
}
.mui-plus.mui-plus-stream .mui-stream-hidden {
display: none !important;
}
</style>
</head>
<body>
<ul class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell">
<a class="mui-navigate-right"><i class="fa fa-sun-o" style="color: #CCCCCC" aria-hidden="true"> </i> &ensp;关于app <i class="mui-pull-right update"><p id="version"></p></i> </a>
</li>
<!-- <li class="mui-table-view-cell mui-table-view-chevron">
<a class="mui-navigate-right" href="#" onclick="opw('../template/template.html','develop');"><i class="fa fa-css3" style="color: #a4b0be" aria-hidden="true"></i> &ensp;开发者选项 </a>
<a class="mui-navigate-right" onclick="undev();"><i class="fa fa-css3" style="color: #a4b0be" aria-hidden="true"></i> &ensp;开发者选项 </a>
</li> -->
<!-- <li class="mui-table-view-cell mui-table-view-chevron">
<a class="mui-navigate-right" id="checkUpdate" onclick="checkUpdate()"><i class="fa fa-cloud-upload" style="color: #778899" aria-hidden="true"></i> &ensp;检查更新 <i class="mui-pull-right update"> <p id="updateApp" style="color: red; font-style: italic; font-weight: bold"></p></i></a>
<div id="progressbox" class="progress" style="position: fixed; background-color:#FFF; margin-top: -45px; height: 56px; opacity:0.6; width: 100%; padding-right:15px; display: none">
<div id="progress" class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
10%
</div>
</div>
</li> -->
<li class="mui-table-view-cell mui-table-view-chevron">
<a class="mui-navigate-right" onclick="undev();"><i class="fa fa-sliders" style="color: #747d8c" aria-hidden="true"></i> &ensp;其他 </a>
</li>
</ul>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/mui.min.js"></script>
<script type="text/javascript">
apiready = function() {
var topL = $api.dom('.mui-pull-left');
$api.addEvt(topL, 'click', function() {
api.closeWin();
});
var info = document.getElementById("version");
info.innerText = api.appVersion;
//updateTip();
// checkUpdate();
};
var i = 0;
function opss() {
if (i >= 90) {
console.log(i);
i++;
} else {
i = i + 10;
}
var progress = $api.dom('#progress');
$api.attr(progress, 'aria-valuenow', i);
$api.html(progress, i + '%');
$api.css(progress, 'width:' + i + '%');
}
//退出登录
mui('ul').on('click', 'li[class="mui-table-view-cell exit"]', function() {
//获取本地token同步返回结果
var token = api.getPrefs({
sync : true,
key : 'token'
});
$app.getAjax('/m/mLogout?token=' + token, function(ret, err) {
if (ret) {
api.toast({
msg : ret.message
});
if (ret.code == 'MLOGOUT') {
$app.openWin('../../index.html');
}
api.removePrefs({
key : 'token'
});
} else {
api.alert({
msg : "服务器异常"
});
}
});
});
//切换账号
mui('ul').on('click', 'li[class="mui-table-view-cell exchange"]', function() {
// api.removePrefs({
// key : 'token'
// });
// $app.openWin('../../index.html');
$app.openWin('switchaccount.html');
});
//打开win
function opw(url, name) {
$app.openWin(url, name);
}
// 检查更新
function checkUpdate() {
api.download({
url : 'http://zhmc.nxcyx.com/apk/tmr.apk',
report : true
}, function(retdownload, err) {
if (retdownload && 0 == retdownload.state) {/* 下载进度 */
var progress = $api.dom('#progress');
document.getElementById('progressbox').style.display = '';
$api.attr(progress, 'aria-valuenow', retdownload.percent);
$api.html(progress, retdownload.percent + '%');
$api.css(progress, 'width:' + retdownload.percent + '%');
console.log(retdownload.percent);
}
if (retdownload && 1 == retdownload.state) {/* 下载完成 */
var savePath = retdownload.savePath;
api.installApp({
appUri : savePath
});
}
});
var mam = api.require('mam');
// mam.checkUpdate(function(ret, err) {
// if (ret) {
// if (undefined!=ret.result && ret.result.update) {
// var info = document.getElementById("updateApp");
// info.innerText = '`new`';
// }
// //alert(JSON.stringify(ret));
// $api.addEvt($api.dom('#checkUpdate'), 'tap', function() {
// if (!ret.status) {
// mui.toast('服务器繁忙,请稍后再试');
// return;
// } else if (ret.result.update) {
// var updateTip;
// updateTip = ret.result.updateTip.replace(/\r\n/g, "<BR>");
// updateTip = updateTip.replace(/\n/g, "<BR>");
// var btnArray = ['取消', '立即更新'];
// mui.confirm('<br/>最新版本:' + ret.result.version + '<br/>更新描述:<br/>' + updateTip + '<br/>发布时间:' + ret.result.time, '有新版本啦!', btnArray, function(e) {
// if (e.index == 1) {
// if (api.systemType == "android") {
// api.download({
// url : ret.result.source,
// report : true
// }, function(retdownload, err) {
// if (retdownload && 0 == retdownload.state) {/* 下载进度 */
// var progress = $api.dom('#progress');
// document.getElementById('progressbox').style.display = '';
// $api.attr(progress, 'aria-valuenow', retdownload.percent);
// $api.html(progress, retdownload.percent + '%');
// $api.css(progress, 'width:' + retdownload.percent + '%');
// }
// if (retdownload && 1 == retdownload.state) {/* 下载完成 */
// var savePath = retdownload.savePath;
// api.installApp({
// appUri : savePath
// });
// }
// });
// }
// if (api.systemType == "ios") {
// api.installApp({
// appUri : ret.result.source
// });
// }
// } else {
// }
// })// confirm end
// return;
// } else {
// mui.alert("版本号:" + api.appVersion, "当前已是最新版本", function() {
// //mui.back();
// });
// return;
// }
// });
// } else {
// //alert(JSON.stringify(err));
// api.toast({
// msg : '服务器繁忙,请稍后再试',
// location : 'middle'
// });
// return;
// }
// });
}
function version() {
console.log('正在查看app版本');
var isDebug = $app._debug;
//是否连接测试服务器
console.log("当前是否是否是测试环境:" + isDebug);
var text = "";
if (isDebug) {
text = "\n当前是内部测试版";
}
mui.alert("当前APP版本是" + api.appVersion + text, "", "确定", function() {
//mui.back();
});
}
function undo() {
mui.toast('测试期间,功能暂不开放');
}
function undev() {
// $app.openWin('../template/mui-master/examples/hello-mui/index.html','develop');
//mui.toast('请用开发者账号登录');
}
</script>
</html>