Feat(页面):监听页面打开次数和页面停留时长接口对接
This commit is contained in:
@@ -15,12 +15,12 @@ export const pageListenMixins = {
|
||||
this.pageToWatchShowCount(this.pageKeyId)
|
||||
},
|
||||
onHide() {
|
||||
this.clearPageTimerFn()
|
||||
this.pageToHideHandle()
|
||||
},
|
||||
methods: {
|
||||
pageToWatchShowCount,
|
||||
pageToWatchShowTimer,
|
||||
clearPageTimerFn() {
|
||||
pageToHideHandle() {
|
||||
const visitTime = TimeDifference(this.pageViewDateTime, getCurrDateTime())
|
||||
if (visitTime > 0) {
|
||||
this.pageToWatchShowTimer(this.pageKeyId, {
|
||||
|
||||
+15
-7
@@ -111,31 +111,39 @@ export function clearAllInterval() {
|
||||
for (let i = 1; i <= endTimerId; i++) {
|
||||
clearInterval(i)
|
||||
}
|
||||
pushSysByOneMinutesHandle()
|
||||
pushSysBySecondsHandle()
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时推送埋点
|
||||
* @returns {null}
|
||||
*/
|
||||
function pushSysByOneMinutesHandle() {
|
||||
function pushSysBySecondsHandle() {
|
||||
setInterval(() => {
|
||||
const userInfo = uni.getStorageSync('userInfo')
|
||||
if (!userInfo) {
|
||||
return
|
||||
}
|
||||
let statsData = []
|
||||
for (const key in Vue.prototype.$pageToWatchData) {
|
||||
if (Vue.prototype.$pageToWatchData[key]) {
|
||||
console.log(Vue.prototype.$pageToWatchData[key])
|
||||
statsData = statsData.concat(Vue.prototype.$pageToWatchData[key])
|
||||
}
|
||||
}
|
||||
console.log(statsData)
|
||||
// 设备类型phone、pad、pc、unknow
|
||||
const deviceType = uni.getSystemInfoSync().deviceType
|
||||
// 系统名称ios、android
|
||||
const osName = uni.getSystemInfoSync().osName
|
||||
console.log(deviceType)
|
||||
console.log(osName)
|
||||
const postData = {
|
||||
uid: '',
|
||||
deviceType: 'android',
|
||||
uid: userInfo.uid,
|
||||
deviceType: deviceType === 'phone' ? osName : 'unknown',
|
||||
statsData
|
||||
}
|
||||
console.log('开始上报数据-------------------')
|
||||
pushSystemStatic(postData).catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
}, 60 * 1000)
|
||||
}, 30 * 1000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user