页面回退刷新

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 "";
}
+30 -1
View File
@@ -84,6 +84,7 @@ $.config = {router: false}
<script type="text/javascript" src="../../config.js"></script>
<script type="text/javascript" src="../../js/axios.min.js"></script>
<script type="text/javascript" src="../../js/axiosPlugin.js"></script>
<script type="text/javascript" src="../../js/plus.info.js" ></script>
<script>
timer = {
@@ -147,12 +148,40 @@ new Vue({
$(".waiting").show();
$(".sendCode").hide();
timer.start();
axios.post("/rest/user/sendMobileCode", {
mobile:this.mobile, type:'binding'
})
.then(function (response) {
var resData = response.data;
if (resData.status) {
$.toast(resData.message);
} else {
$.toast(resData.message);
timer.cancel()
}
})
.catch(function (error) {
$.toast(error);
});
}
},
// 绑定手机
binding: function() {
if (this.checkMobile() && this.checkSmsCode()) {
axios.post("/rest/user/bindMobile", {
mobile:this.mobile, smsCode:this.smsCode, province:province, city:city, region:region, pushClientId:getPushInfo()
})
.then(function (response) {
var resData = response.data;
if (resData.status) {
$.toast(resData.message);
} else {
$.toast(resData.message);
}
})
.catch(function (error) {
$.toast(error);
});
}
}
+12 -9
View File
@@ -2523,15 +2523,18 @@ function getDistrictList(cityParam,latParam,lngParam,regionParam,order,minPrice,
mui.init();
function openNewsView(newId) {
mui.openWindow({
url: 'views/news/newsDetail.html',
id:'newsDetail.html',
extras:{
newsId:newId //扩展参数
}
});
var count = parseInt($("#visitCount_"+newId).text().replace("人",""))+1;
$("#visitCount_"+newId).text(count+'人');
//mui.openWindow({
// url: 'views/news/newsDetail.html',
// id:'newsDetail.html',
// extras:{
// newsId:newId //扩展参数
// }
// });
clicked('views/news/newsDetail.html',true,false,{},{newsId:newId},function(newId){
alert(newId);
},newId);
var count = parseInt($("#visitCount_"+newId).text().replace("人",""))+1;
$("#visitCount_"+newId).text(count+'人');
}
</script>