Commit 4364e7d9 authored by zhangyanni's avatar zhangyanni

提交埋点

parent b79f46ff
......@@ -9,12 +9,15 @@
<script>
import api from './api'
import commonApi from '../../../common/commonApi'
export default {
name: "stagerouter",
data(){
return{
stage:this.$route.query.stage?this.$route.query.stage:null,
id:this.$route.query.id
id:this.$route.query.id,
documentFront:"",
pathfrom:"",
}
},
methods:{
......@@ -33,18 +36,82 @@
this.$toast(err);
})
}
}
},
//获取浏览器前缀
getDocumentFunc(){
commonApi.getDocumentAxios().then(response => {
if(response.code == 0) {
this.documentFront = response.result.websitePrefix +"#";
this.maiDianFunc();
} else {
this.$toast(response.msgCode)
}
}).catch(error => {
this.$toast(error);
});
},
//埋点
maiDianFunc(type,data){
//type=1 视频下一句话介绍
//type=2 列表初始化
//type=3 点评
//type=4 视频播放后的分享
//type=5 视频下的分享
//type=6 视频播放后的详情
let params = {
type:"activity-index",
parameters:{
activityId:this.$route.query.id,
projectId:this.$route.query.proId?this.$route.query.proId:undefined,
rDeviceId:this.publicFun.getCookie("rDeviceId")&&this.publicFun.getCookie("rDeviceId")!=undefined ? this.publicFun.getCookie("rDeviceId") : null,
rEmpId:this.publicFun.getCookie("rEmpId")&&this.publicFun.getCookie("rEmpId")!=undefined ? this.publicFun.getCookie("rEmpId") : null,
rTargetType:this.publicFun.getCookie("rTargetType")&&this.publicFun.getCookie("rTargetType")!=undefined ? this.publicFun.getCookie("rTargetType") : null,
targetType:data?data:undefined
},
purl:this.pathfrom=='/'?undefined:this.documentFront+this.pathfrom,
curl:document.location.href
};
api.maiDianAxios(params).then((res)=>{
if(res.code==0){
if(type==3){
let query = {
subId:this.currentData.id,
proId:this.currentData.projectId,
activityId:this.$route.query.id,
isList:true,
stage:this.$route.query.stage
};
this.$router.push({path:"/secondStageDetail",query:query});
}
}else{
this.$toast(res.msg);
}
}).catch((err)=>{
this.$toast(err);
})
},
},
mounted(){
this.publicFun.setUserInfoCookie("sendCurrentStage",true);
this.getInitStage();
this.getDocumentFunc()
},
beforeRouteLeave(to, form, next) {
this.publicFun.removeCookie("sendCurrentStage");
next()
}
},
beforeRouteEnter(to, from, next) {
next(vm=>{ // 这里的vm指的就是vue实例,可以用来当做this使用
vm.pathfrom =from.fullPath;
})
},
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment