mui.plusReady(function() {
plus.screen.lockOrientation("portrait-primary"); //禁止横屏
document.addEventListener("netchange", wainshow, false);
function wainshow() {
if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE) {
mui.toast("网络异常,请检查网络设置!");
$('.main-container').remove();
// $("<div class='no_network'><div class='nod'><div class='reload'>刷新</div></div></div>").appendTo('body');
$('.no_network').show();
$('.reload').click(function(){
location.reload()
})
}
}
wainshow();
//监听安卓返回键
mui.oldback = mui.back;
var clickNum = 0;
mui.back = function(event) {
clickNum++;
if(clickNum > 1) {
plus.runtime.quit();
} else {
mui.toast("再按一次退出应用");
}
setTimeout(function() {
clickNum = 0
}, 1000);
return false;
}