add
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 日志记录,依赖于axios.min.js,axiosPlugin.js
|
||||
* @author yinjihuan
|
||||
*/
|
||||
document.addEventListener('plusready', function() {
|
||||
savePageLog()
|
||||
}, false);
|
||||
|
||||
/**
|
||||
* 记录页面访问日志
|
||||
*/
|
||||
function savePageLog() {
|
||||
var page = document.getElementsByTagName("title")[0].innerHTML;
|
||||
var device = plus.device.uuid;
|
||||
var model = plus.device.model;
|
||||
plus.geolocation.getCurrentPosition(function(p){
|
||||
province = p.address.province;
|
||||
city = p.address.city;
|
||||
region = p.address.district;
|
||||
lng = p.coords.longitude;
|
||||
lat = p.coords.latitude;
|
||||
address = p.address.street;
|
||||
doSavePageLog({page:page, lng:lng, lat:lat, province:province, city:city, region:region, address:address, device:device, model:model});
|
||||
}, function(e){
|
||||
doSavePageLog({page:page, device:device, model:model});
|
||||
},
|
||||
{
|
||||
provider:'baidu',
|
||||
enableHighAccuracy:true,
|
||||
coordsType:'bd09ll'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function doSavePageLog(data) {
|
||||
axios.post("/rest/log/save", data).then(function (response) {
|
||||
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user