提交 3868df15 编写于 作者: guangjun.yang's avatar guangjun.yang

埋点数据等

上级 0cb3d9f4
<template> <template>
<div class="logo-wrapper"> <div class="logo-wrapper">
<img @click="back" class="back" v-show="!isWeb && imgType == 1" src="~@/images/annual/back-1.png" alt=""> <img @click="back" class="back" v-show="!isWeb && imgType == 1" src="~@/images/annual/back-1.png" alt="">
<img @click="back" class="back" v-show="!isWeb && imgType == 2" src="~@/images/annual/back-2.png" alt=""> <img @click="back" class="back" v-show="!isWeb && imgType == 2" src="~@/images/annual/back-2.png" alt="">
<img class="logo" v-show="imgType == 1" src="~@/images/annual/logo-1.png" alt /> <img class="logo" v-show="imgType == 1" src="~@/images/annual/logo-1.png" alt />
<img class="logo" v-show="imgType == 2" src="~@/images/annual/logo-2.png" alt /> <img class="logo" v-show="imgType == 2" src="~@/images/annual/logo-2.png" alt />
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from "vuex";
export default { export default {
props: { props: {
imgType: { imgType: {
...@@ -18,16 +19,28 @@ export default { ...@@ -18,16 +19,28 @@ export default {
default: 1 // 1: H5返回; 2: 原生返回 default: 1 // 1: H5返回; 2: 原生返回
} }
}, },
data() { data() {
return { return {
isWeb: window.__isWeb, isWeb: window.__isWeb,
} }
}, },
computed: {
...mapGetters(["backBDText"])
},
methods: { methods: {
back() { back() {
if( this.backType == 1) { if( this.backType == 1) {
this.$sendBuriedData({
component_tag: `560#560001${this.backBDText}`
});
this.$router.back(-1); this.$router.back(-1);
} else { } else {
this.$sendBuriedData({
component_tag: '559#559001'
});
rocNative.goBack(); rocNative.goBack();
} }
} }
......
const getters = { const getters = {
userInfo: state => state.common.userInfo, userInfo: state => state.common.userInfo,
backBDText: state => state.common.backBDText,
} }
export default getters export default getters
const common = { const common = {
state: { state: {
userInfo: { appVersion: "344", userToken: "" }, userInfo: { appVersion: "344", userToken: "" },
backBDText: '#firstMeet#第一次注册',
}, },
mutations: { mutations: {
SET_USER_INFO: (state, userInfo) => { SET_USER_INFO: (state, userInfo) => {
state.userInfo = userInfo state.userInfo = userInfo;
},
SET_BACK_BD_TEXT: (state, backBDText) => {
state.backBDText = backBDText;
}, },
}, },
actions: { actions: {
setUserInfo({ commit }, userInfo) { setUserInfo({ commit }, userInfo) {
commit('SET_USER_INFO', userInfo) commit('SET_USER_INFO', userInfo);
},
setBackBDText({ commit }, backBDText) {
commit('SET_BACK_BD_TEXT', backBDText);
}, },
} }
} }
......
...@@ -20,14 +20,14 @@ module.exports = { ...@@ -20,14 +20,14 @@ module.exports = {
this.token = this.getUrlKey('token') || (query && query.token) this.token = this.getUrlKey('token') || (query && query.token)
}, },
computed: { computed: {
...mapGetters(["userInfo", "canRunNext"]) ...mapGetters(["userInfo"])
}, },
mounted() { mounted() {
}, },
methods: { methods: {
...mapActions(["setUserInfo", "goLogin"]), ...mapActions(["setUserInfo"]),
getUrlPara(obj) { getUrlPara(obj) {
let dataStr = '' let dataStr = ''
...@@ -229,29 +229,6 @@ module.exports = { ...@@ -229,29 +229,6 @@ module.exports = {
e.target.src = 'https://file.yunqueyi.com/File/doctor_default.png'; e.target.src = 'https://file.yunqueyi.com/File/doctor_default.png';
}, },
// 校验token,有效则调用回调函数,否则调起原生登陆页面
commonCheckToken(cb) {
console.log('5555 this.token', this.token);
let param = {
token: this.token || this.$store.state.common.userInfo.userToken || localStorage.getItem("couponToken") || getCookie("couponToken"),
// token: this.token || this.$store.state.common.userInfo.userToken,
setEntry: true
};
console.log('this.token || this.$store.state.common.userInfo.userToken', this.token, this.$store.state.common.userInfo.userToken);
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
console.log('commonCheckToken', window.__isWeb);
if(window.__isWeb) {
this.goLogin();
} else {
rocNative.gotoLogin();
}
} else {
cb && cb()
}
});
},
// 校验token,有效则调用回调函数,否则使用调起原生登陆页面 // 校验token,有效则调用回调函数,否则使用调起原生登陆页面
checkTokenForNative(cb) { checkTokenForNative(cb) {
let param = { let param = {
...@@ -266,20 +243,5 @@ module.exports = { ...@@ -266,20 +243,5 @@ module.exports = {
} }
}); });
}, },
// 防止重复点击的最简单实现
canRun(delayTime = 500){
if(this.canRunNext) {
this.$store.commit('SET_CAN_RUN_NEXT', false);
setTimeout( () => {
this.$store.commit('SET_CAN_RUN_NEXT', true)
}, delayTime);
console.log('in canRan ', this.canRunNext);
return true;
} else {
console.log('in canRan', this.canRunNext);
return false;
}
}
} }
} }
<template> <template>
<div class="swiper-container"> <div class="swiper-container">
<div class="right-arrow"> <div v-show="(slideNum - 1) !== activeIndex" v-if="isHide" class="right-arrow">
<img class="r1" src="~@/images/annual/right-1.png" alt /> <img class="r1" src="~@/images/annual/right-1.png" alt />
<img src="~@/images/annual/right-2.png" alt /> <img src="~@/images/annual/right-2.png" alt />
</div> </div>
...@@ -73,11 +73,54 @@ export default { ...@@ -73,11 +73,54 @@ export default {
showLoading: false, showLoading: false,
isHide: true, isHide: true,
activeIndex: 0, activeIndex: 0,
slideNum: 1,
appVersion: '', appVersion: '',
anualData: { anualData: {
orderNum: 0, orderNum: 0,
learnTime4Show: 0 learnTime4Show: 0
} },
backBDList: [
{
desc: '第一次注册',
text: '#firstMeet#第一次注册',
isShow: true,
},
{
desc: '学习总时长',
text: '#studyTime#学习总时长',
isShow: true,
},
{
desc: '找药',
text: '#findMedicine#找药',
isShow: true,
},
{
desc: '早起',
text: '#morning#早起',
isShow: true,
},
{
desc: '夜深了',
text: '#night#夜深了',
isShow: true,
},
{
desc: '中午',
text: '#middle#中午',
isShow: true,
},
{
desc: '云鹊豆',
text: '#manyBean#获得豆子',
isShow: true,
},
{
desc: '最终页面',
text: '#final#最终页面',
isShow: true,
},
],
}; };
}, },
...@@ -134,7 +177,63 @@ export default { ...@@ -134,7 +177,63 @@ export default {
}, },
methods: { methods: {
...mapActions(["setUserInfo"]), ...mapActions(["setUserInfo", "setBackBDText"]),
// 先构造埋点的基础数据
handle4DBText() {
let anualData = this.anualData;
if(!anualData) return;
let slideNum = 8;
// 如果没有数据,则直接设置埋点数据
if(!anualData.haveFlag) {
this.setBackBDText('#newUser#21年用户');
slideNum = 1;
return;
}
// 如果订单为空,则没有找药页面
if(!anualData.orderNum) {
this.backBDList[2].isShow = false;
slideNum --;
}
// 没有早起
if(anualData.learnEarliestTimeFlag == 0) {
this.backBDList[3].isShow = false;
slideNum --;
}
// 没有晚睡
if(anualData.learnLatestTimeFlag == 0) {
this.backBDList[4].isShow = false;
slideNum --;
}
// 早晚都没有时间点
if(anualData.learnTime4Show == 0) {
this.backBDList[5].isShow = false;
slideNum --;
}
// 没有云鹊豆
if(anualData.creditNum == 0) {
this.backBDList[6].text = '#noBean#未得豆子';
}
this.slideNum = slideNum;
console.log('this.slideNum', this.slideNum);
},
// 根据当前页面ID,设置埋点数据
setBackBDTextByAID(activeIndex) {
let backBDList = this.backBDList, index = -1;
for(let i = 0, l = backBDList.length; i < l; i ++) {
if(backBDList[i].isShow) {
index ++;
if(index == activeIndex) {
console.log('in setBackBDTextByAID', backBDList[i].text);
this.setBackBDText(backBDList[i].text);
break;
}
}
}
},
// 获取数据 // 获取数据
initData() { initData() {
...@@ -147,6 +246,7 @@ export default { ...@@ -147,6 +246,7 @@ export default {
this.GET(`stats/year/end/report/app`, param).then(res => { this.GET(`stats/year/end/report/app`, param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
this.handlerDate(res.data || {}); this.handlerDate(res.data || {});
this.handle4DBText();
this.$forceUpdate(); this.$forceUpdate();
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
...@@ -210,7 +310,8 @@ export default { ...@@ -210,7 +310,8 @@ export default {
slideChangeTransitionEnd: function(se) { slideChangeTransitionEnd: function(se) {
_this.activeIndex = se.activeIndex; _this.activeIndex = se.activeIndex;
swiperAnimate(this); swiperAnimate(this);
console.log("---2323", se); _this.setBackBDTextByAID(se.activeIndex);
console.log("@@@@@@_this.activeIndex", _this.activeIndex);
} }
} }
}); });
......
...@@ -178,6 +178,7 @@ export default { ...@@ -178,6 +178,7 @@ export default {
justify-content: center; justify-content: center;
color: #ffffff; color: #ffffff;
img { img {
display: block;
width: 15px; width: 15px;
height: 15px; height: 15px;
padding-top: 4px; padding-top: 4px;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册