Commit aa80b5e5 authored by hbcui1984's avatar hbcui1984

增加网络判断

parent fd7967f8
......@@ -26,6 +26,9 @@
</body>
<script type="text/javascript">
mui.plusReady(function () {
if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE){
mui.toast("当前网络不给力,无法加载广告");
}else{
//屏幕真实宽度
var width = window.innerWidth;
var height = window.innerHeight;
......@@ -71,6 +74,10 @@
//设置主页面的底部留白,否则会被遮住;
document.querySelector('.mui-content').style.paddingBottom = adHeight + 'px';
}
});
</script>
......
......@@ -71,6 +71,16 @@
$.init({
swipeBack:true //启用右滑关闭功能
});
var network = true;
if(mui.os.plus){
mui.plusReady(function () {
if(plus.networkinfo.getCurrentType()==plus.networkinfo.CONNECTION_NONE){
network = false;
}
});
}
var methodEl = document.getElementById("method");
var dataTypeEl = document.getElementById("dataType");
var respnoseEl = document.getElementById("response");
......@@ -121,7 +131,11 @@
};
//发送请求按钮的点击事件
document.getElementById("confirm").addEventListener('tap', function() {
if(network){
ajax();
}else{
mui.toast("当前网络不给力,请稍后再试");
}
});
//点击描述中链接时,打开对应网页介绍;
$('body').on('tap', 'a', function(e) {
......
......@@ -106,13 +106,18 @@
</div>
<script type="text/javascript">
var ref = new Wilddog("https://muidemo.wilddogio.com/demo");
if(!ref){
mui.toast("当前网络不给力,请稍后再试");
var network = false;
var ref = null;
mui.plusReady(function () {
if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE){
mui.toast("当前网络不给力,无法连接云端数据库~");
}else{
//dom ready之后就可以直接获取数据了
mui.ready(getList);
network = true;
ref = new Wilddog("https://muidemo.wilddogio.com/demo");
getList();
}
});
var list = document.getElementById("list");
var col1 = document.getElementById("col1");
var col2 = document.getElementById("col2");
......@@ -124,7 +129,7 @@
var title = document.getElementById("title");
document.getElementById("open").addEventListener('tap',function () {
if(!ref){
if(!network){
mui.toast("当前网络不给力,请稍后再试");
}else{
//清空数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment