|
楼主 |
发表于 2016-8-3 10:57:07
|
显示全部楼层
做了网络判断的:function checkConnection() {
var networkState = navigator.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.CELL] = 'Cell generic connection';
states[Connection.NONE] = 'No network connection';
if (states[networkState] === 'No network connection' || states[networkState] === 'Unknown connection') {
return false;
} else {
return true;
}
}
var Model = function() {
this.callParent();
if (!checkConnection()) {
justep.Util.hint("网络异常,请检查网络!", {
"type" : "warning",
"delay" : 3000
});
this.comps('image1').css('display','block').load();
this.comps('windowContainer1').css('display','none').load();
} else {
var shellImpl = new ShellImpl(this, {
"contentsXid" : "pages",
"pageMappings" : {
"main" : {
url : require.toUrl('$UI/tianjiao/main.w')
}
}
})
this.comps('image1').css('display','none').load();
}
};
|
|