diff --git a/fangija-zsyf/js/axiosPlugin.js b/fangija-zsyf/js/axiosPlugin.js index bfa7c47..8bfca8b 100644 --- a/fangija-zsyf/js/axiosPlugin.js +++ b/fangija-zsyf/js/axiosPlugin.js @@ -3,7 +3,8 @@ axios.defaults.headers.post['Content-Type'] = 'application/json'; // 添加请求拦截器 axios.interceptors.request.use(function (config) { - config.headers.Authorization = '111111111' + var token = localStorage.getItem("user_token"); + config.headers.Authorization = token return config; }, function (error) { return Promise.reject(error); diff --git a/fangija-zsyf/js/common.js b/fangija-zsyf/js/common.js index 6f08bb6..1bf58bb 100644 --- a/fangija-zsyf/js/common.js +++ b/fangija-zsyf/js/common.js @@ -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; diff --git a/fangija-zsyf/js/plus.info.js b/fangija-zsyf/js/plus.info.js new file mode 100644 index 0000000..27dcd88 --- /dev/null +++ b/fangija-zsyf/js/plus.info.js @@ -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 ""; +} \ No newline at end of file diff --git a/fangija-zsyf/views/user/bindingMobile.html b/fangija-zsyf/views/user/bindingMobile.html index cd2cc36..4976692 100644 --- a/fangija-zsyf/views/user/bindingMobile.html +++ b/fangija-zsyf/views/user/bindingMobile.html @@ -84,6 +84,7 @@ $.config = {router: false} + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fangija-zsyf/yfindex.html b/fangija-zsyf/yfindex.html index f2c4bd5..6c6500d 100644 --- a/fangija-zsyf/yfindex.html +++ b/fangija-zsyf/yfindex.html @@ -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+'人'); } window.addEventListener('refresh', function(e){//执行刷新