|
|
@@ -87,6 +87,11 @@ export default {
|
|
|
isShowUpdate: false, //是否显示更新信息弹窗
|
|
|
isUpdateInfo: false,//更新用户信息
|
|
|
isUpdateMobile: false,//绑定手机号
|
|
|
+
|
|
|
+
|
|
|
+ enterTime : '',//进入页面时间
|
|
|
+ outTime : '',//页面卸载时间
|
|
|
+ stayTime : 0//页面停留时间
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -114,17 +119,34 @@ export default {
|
|
|
// await this.monitor();
|
|
|
},
|
|
|
async onShow(){
|
|
|
-
|
|
|
+ // 用户进入时间
|
|
|
+ this.enterTime = new Date();
|
|
|
+ console.log('---用户进入时间---',this.enterTime);
|
|
|
this.getConfig()
|
|
|
this.getBrowse();
|
|
|
},
|
|
|
-
|
|
|
+ onHide(){
|
|
|
+ // 用户退出时间
|
|
|
+ this.outTime = new Date();
|
|
|
+ //停留时间(毫秒)
|
|
|
+ this.stayTime = (this.outTime.getTime() - this.enterTime.getTime());
|
|
|
+ console.log('---用户浏览---',Math.ceil(this.stayTime/1000))
|
|
|
+ req.saveBehaviorNew(this.id,3,4,'','',this.query.userId,Math.ceil(this.stayTime/1000))
|
|
|
+ },
|
|
|
+ onUnload(){
|
|
|
+ // 用户退出时间
|
|
|
+ this.outTime = new Date();
|
|
|
+ //停留时间(毫秒)
|
|
|
+ this.stayTime = (this.outTime.getTime() - this.enterTime.getTime());
|
|
|
+ console.log('---用户浏览总时长---',Math.ceil(this.stayTime/1000))
|
|
|
+ req.saveBehaviorNew(this.id,3,4,'','',this.query.userId,Math.ceil(this.stayTime/1000))
|
|
|
+ },
|
|
|
onShareAppMessage() {
|
|
|
req.saveBehaviorNew(this.id,3,6)
|
|
|
return {
|
|
|
title: this.detaile.title,
|
|
|
imageUrl: this.detaile.pic,
|
|
|
- path: '/topic/content/content?id=' + this.id +'&isShare=' + true+(this.userInfo.userType==1?('&shareId='+this.userInfo.saleNo):'')
|
|
|
+ path: '/topic/content/content?id=' + this.id +'&isShare=' + true+(this.userInfo.userType==1?('&shareId='+this.userInfo.saleNo):'') + (req.getStorage('userInfo')?'&userId=' + req.getStorage('userInfo').id:'')
|
|
|
};
|
|
|
},
|
|
|
onShareTimeline() {
|
|
|
@@ -133,7 +155,7 @@ export default {
|
|
|
title: this.detaile.title,
|
|
|
imageUrl: this.tempFilePath?this.tempFilePath:this.detaile.pic,
|
|
|
path: '/topic/content/content',
|
|
|
- query:'id=' + this.id+'&isSharePYQ=' + true +'&isShare=' + true+(this.userInfo.userType==1?('&shareId='+this.userInfo.saleNo):'')
|
|
|
+ query:'id=' + this.id+'&isSharePYQ=' + true +'&isShare=' + true+(this.userInfo.userType==1?('&shareId='+this.userInfo.saleNo):'') + (req.getStorage('userInfo')?'&userId=' + req.getStorage('userInfo').id:'')
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -243,7 +265,7 @@ export default {
|
|
|
dataP.behavior = 4; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
|
|
|
dataP.bindId = this.id;
|
|
|
req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
|
|
|
- req.saveBehaviorNew(this.id,3,4)
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
// 用户行为
|