//服务端配置 var API = { UNIT_ID : function(){ var state = app.getState(); return state.user.unitId; }, API_IP_PORT : "http://192.168.110.50:8080/oa/", API_ROOT : "http://192.168.110.50:8080/oa/", API_VERSION : '1', API_URL : function(){ return this.API_ROOT + 'clientServices.do?iscrypt=1&date='+new Date().getTime(); } } //客户端配置 var APP ={ //列表页数 PageSize : 10 } function exitApp(){ var wobj = plus.webview.getWebviewById("xboa"); if(!wobj){ wobj = plus.webview.getWebviewById("HBuilder"); } mui.fire(wobj,'loginEvent'); app.setState({}); localStorage.clear(); wobj.show(); } function endPull(totalPage,pageNo){ if(totalPage==0||totalPage==1){ mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); }else{ mui('#pullrefresh').pullRefresh().endPullupToRefresh(totalPage==pageNo); //参数为true代表没有更多数据了。 } if(pageNo==1){ mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); } pageNo = pageNo + 1; return pageNo; } //文件下载的任务 function openFile222(path){ if(path.indexOf("http") == -1){ path = API.API_ROOT + "" + path; } //var url = API.API_ROOT + "" + path;//下载文件的方法,按照各自方法自行变动 var dtask = plus.downloader.createDownload( path, {}, function(d, status){//创建一个下载任务,可以在网上搜索这个方法了解 if ( status == 200 ) { plus.runtime.openFile( d.filename, {}, function ( e ) {//调用第三方应用打开文件 alert('打开失败'); }); }else{ alert( "Download failed: " + status); } }); dtask.start(); }