Commit d4ed4bca by wangzhihui

Merge branch 'SAAS+V5.0.0' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into SAAS+V5.0.0
2 parents 305b942c 2511ff15
......@@ -69,13 +69,11 @@ export default {
recordList.push(item)
}
localStorage.setItem("recordList", JSON.stringify(recordList))
if (recordList.length > 9) {
reportTrack({
recordList
}).then((res) => {
if (res) localStorage.removeItem("recordList")
})
if (!window.TRACK_TIMER) {
console.log('---------------- 重新打开定时埋点 ----------------')
this.sendTrack() //开启定时埋点
}
if (recordList.length > 9) this.sendTrackData()
},
getRandomString (length = 30) {
const characters =
......@@ -113,7 +111,7 @@ export default {
setBrowseTrackData () {
try {
// || (this.$route.path != "/qualityControlList" && this.$route.path != "/shopConfig")
if (!this.track_timerFlag) {
if (!this.track_timerFlag && !this.track_event_code) { //无eventcode时不上报
return
} else {
this.track_timer_out = setTimeout(() => {
......@@ -150,6 +148,27 @@ export default {
}
return ""
},
sendTrackData () {
let recordList = localStorage.getItem('recordList')
if (recordList && recordList.length) {
reportTrack({
recordList: JSON.parse(recordList)
}).then(res => {
if (res) localStorage.removeItem('recordList')
})
} else {
clearInterval(window.TRACK_TIMER)
window.TRACK_TIMER = null
console.log('---------------- 暂停定时埋点 ----------------')
}
},
/**定时发送埋点数据 */
sendTrack () {
window.TRACK_TIMER = setInterval(() => {
this.sendTrackData()
}, 30e3)
}
}
}
import { reportTrack } from "@api/resident"
import reportTrackFunMixin from './reportTrackFunMixin'
function getRandomString (length = 10) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
......@@ -13,20 +12,16 @@ export default {
data () {
return {
timerFlag: false,
track_set_timer: null
}
},
beforeDestroy () {
this.onPageHide()
window.removeEventListener('click', this.getTrackData)
this.timerFlag = false
clearTimeout(this.track_set_timer)
this.track_set_timer = null
},
mounted () {
window.addEventListener('click', this.getTrackData)
this.timerFlag = true
this.intervalRepoet()
},
methods: {
getTrackData (e) {
......@@ -39,23 +34,7 @@ export default {
else this.getTrackData(target.parentElement)
}, 10)
},
intervalRepoet () {
if (!this.timerFlag) return
this.track_set_timer = setTimeout(() => {
this.sendData()
if (this.timerFlag) this.intervalRepoet()
}, 30 * 1e3)
},
getRandomString: getRandomString,
sendData () {
let recordList = localStorage.getItem('recordList')
if (recordList) {
reportTrack({
recordList: JSON.parse(recordList)
}).then(res => {
if (res) localStorage.removeItem('recordList')
})
}
}
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!