|
@@ -25,27 +25,20 @@ var cmSysVitaMixins = function () {
|
|
|
this.cmSysParams.pagePath = window.location.href;
|
|
|
this.clearTimeSet = setInterval(() => {
|
|
|
_self.cmSysParams.accessDuration++;
|
|
|
- console.log(`页面路径:${_self.cmSysParams.pagePath}`,`停留:${_self.cmSysParams.accessDuration}s`,`标签:${_self.cmSysParams.pageLabel}`)
|
|
|
}, 1000);
|
|
|
},
|
|
|
- userRecordStatistics(params) {
|
|
|
- var _this = this;
|
|
|
- PublicApi.userRecordStatistics(params,function (response) {
|
|
|
- if(response.code === 0){
|
|
|
- alert('111111111111111')
|
|
|
- console.log('<-------上送用户行为记录成功------>')
|
|
|
- }else{
|
|
|
- console.log('<-------上送用户行为记录异常------>')
|
|
|
- }
|
|
|
- })
|
|
|
+ userRecordStatistics(url,data) {// navigator.sendBeacon 方式 发送统计数据
|
|
|
+ const blob = new Blob([JSON.stringify(data)], {
|
|
|
+ type: 'application/json; charset=UTF-8',
|
|
|
+ });
|
|
|
+ navigator.sendBeacon(url, blob);
|
|
|
},
|
|
|
beforeunloadHandler(e) {
|
|
|
- debugger
|
|
|
- this.userRecordStatistics(this.cmSysParams); // 上送后台接口,将浏览时长等信息传到后台,离开当前路由后调用
|
|
|
-
|
|
|
- console.log('关闭窗口之后',this.cmSysParams)
|
|
|
+ console.log(`页面路径:${this.cmSysParams.pagePath}`,`停留:${this.cmSysParams.accessDuration}s`,`标签:${this.cmSysParams.pageLabel}`)
|
|
|
+ var NODE_ENV_BASE_URL = $("#coreServer").val();
|
|
|
+ var url = `${NODE_ENV_BASE_URL}/user/record/Statistics`
|
|
|
+ this.userRecordStatistics(url,this.cmSysParams); // 上送后台接口,将浏览时长等信息传到后台,离开当前路由后调用
|
|
|
clearInterval(this.clearTimeSet); // 离开页面后清除定时器
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|