页面回退刷新

This commit is contained in:
尹吉欢
2018-03-30 13:11:15 +08:00
parent 23347d4dd2
commit f06397e90c
4 changed files with 89 additions and 12 deletions
+6 -2
View File
@@ -61,7 +61,7 @@ var openw=null,waiting=null;
* @param {boolean} ns : 是否不自动显示
* @param {JSON} ws : Webview窗口属性
*/
w.clicked=function(id,wa,ns,ws){
w.clicked=function(id,wa,ns,ws, params,callback,callbackParams){
if(openw){//避免多次打开同一个页面
return null;
}
@@ -71,7 +71,7 @@ w.clicked=function(id,wa,ns,ws){
ws.scrollIndicator||(ws.scrollIndicator='none');
ws.scalable||(ws.scalable=false);
var pre='';//'http://192.168.1.178:8080/h5/';
openw=plus.webview.create(pre+id,id,ws);
openw=plus.webview.create(pre+id,id,ws,params);
ns||openw.addEventListener('loaded',function(){//页面加载完成后才显示
// setTimeout(function(){//延后显示可避免低端机上动画时白屏
openw.show(as);
@@ -79,6 +79,10 @@ w.clicked=function(id,wa,ns,ws){
// },200);
},false);
openw.addEventListener('close',function(){//页面关闭后可再次打开
//可以设置页面关闭时回调的方法,可以对数据进行重新加载操作
if(callback){
callback(callbackParams);
}
openw=null;
},false);
return openw;
+41
View File
@@ -0,0 +1,41 @@
/**
* 获取手机上的信息,比如位置,手机ID
* @author yinjihuan
*/
//扩展API加载完毕后调用onPlusReady回调函数
document.addEventListener('plusready', onPlusReady, false);
//扩展API加载完毕,现在可以正常调用扩展API
function onPlusReady(){
getPosition();
}
// 获取当前用户位置
function getPosition(){
plus.geolocation.getCurrentPosition(function(p){
province = p.address.province;
city = p.address.city;
region = p.address.district;
}, function(e){
},
{
provider:'baidu',
enableHighAccuracy:true,
coordsType:'bd09ll'
}
);
}
function getPushInfo(){
try {
var info = plus.push.getClientInfo();
return info.clientid;
}catch(error) {
console.log( error);
}
// console.log( "获取客户端推送标识信息:" );
// console.log( "token: "+info.token );
// alert( "clientid: "+info.clientid );
// console.log( "appid: "+info.appid );
// console.log( "appkey: "+info.appkey );
return "";
}