43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/**
|
|
* 日志记录,依赖于axios.min.js,axiosPlugin.js
|
|
* @author yinjihuan
|
|
*/
|
|
document.addEventListener('plusready', function() {
|
|
}, false);
|
|
|
|
|
|
|
|
/**
|
|
* 记录用户行为日志
|
|
*/
|
|
function saveBehaviorLog(event,dataMap) {
|
|
var page = document.getElementsByTagName("title")[0].innerHTML;
|
|
var device = plus.device.uuid;
|
|
var model = plus.device.model;
|
|
plus.geolocation.getCurrentPosition(function(p){
|
|
baidu_province = p.address.province;
|
|
baidu_city = p.address.city;
|
|
baidu_region = p.address.district;
|
|
baidu_lng = p.coords.longitude;
|
|
baidu_lat = p.coords.latitude;
|
|
baidu_address = p.address.street;
|
|
doSaveBehaviorLog({page:page, lng:baidu_lng, lat:baidu_lat, province:baidu_province, city:baidu_city, region:baidu_region, address:baidu_address, device:device, model:model,event:event,businessData:dataMap,channel:YOUFANG_CHANNEL});
|
|
}, function(e){
|
|
doSaveBehaviorLog({page:page, device:device, model:model,event:event,businessData:dataMap,channel:YOUFANG_CHANNEL});
|
|
},
|
|
{
|
|
provider:'baidu',
|
|
enableHighAccuracy:true,
|
|
coordsType:'bd09ll'
|
|
}
|
|
);
|
|
}
|
|
|
|
function doSaveBehaviorLog(data) {
|
|
axios.post("/rest/log/saveBehaviorLog", data).then(function (response) {
|
|
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|