Commit 2eaee313 authored by Damon's avatar Damon

feat: 答题、搜索事件埋点

parent 7072e3ea
...@@ -300,6 +300,8 @@ export default { ...@@ -300,6 +300,8 @@ export default {
source: this.source, source: this.source,
} }
getApp().track("answer", params)
this.$u.api.getQuestionTotal(params).then((res) => { this.$u.api.getQuestionTotal(params).then((res) => {
// 列表总长度,一定要在第一次请求列表数据前明确该值 // 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据 // 否则无法知道下一页是否还有数据
...@@ -354,6 +356,7 @@ export default { ...@@ -354,6 +356,7 @@ export default {
}, },
// 返回 // 返回
customBack() { customBack() {
getApp().track("back")
if (this.source === 3) { if (this.source === 3) {
// 如果已答题,点击返回提示交卷 // 如果已答题,点击返回提示交卷
const count = this.list.reduce((accumulator, currentValue) => { const count = this.list.reduce((accumulator, currentValue) => {
...@@ -544,6 +547,7 @@ export default { ...@@ -544,6 +547,7 @@ export default {
recordId: this.recordId, recordId: this.recordId,
source: this.source, source: this.source,
} }
getApp().track("submitAnswers", params)
this.$u.api.answer([params]).then((res) => { this.$u.api.answer([params]).then((res) => {
if (this.source === 2) { if (this.source === 2) {
// 每日一练 // 每日一练
...@@ -576,6 +580,7 @@ export default { ...@@ -576,6 +580,7 @@ export default {
uni.showLoading({ uni.showLoading({
title: '正在计算考试成绩', title: '正在计算考试成绩',
}) })
getApp().track("handPaper", data)
this.$u.api.submitExamRecord(data).then((res) => { this.$u.api.submitExamRecord(data).then((res) => {
uni.hideLoading() uni.hideLoading()
if (res) { if (res) {
...@@ -624,6 +629,10 @@ export default { ...@@ -624,6 +629,10 @@ export default {
const info = this.list.find((v) => v.index === this.currentIndex) const info = this.list.find((v) => v.index === this.currentIndex)
const status = info ? info.collectionFlag : false const status = info ? info.collectionFlag : false
const action = status ? 'removeCollection' : 'joinCollection' const action = status ? 'removeCollection' : 'joinCollection'
getApp().track("collect", {
action: action,
questionId: info.id
})
this.$u.api[action]({ questionId: info.id }).then((res) => { this.$u.api[action]({ questionId: info.id }).then((res) => {
if (res) { if (res) {
const msg = status ? '取消收藏成功' : '收藏成功' const msg = status ? '取消收藏成功' : '收藏成功'
...@@ -651,6 +660,9 @@ export default { ...@@ -651,6 +660,9 @@ export default {
// 移除 // 移除
remove() { remove() {
const info = this.list.find((v) => v.index === this.currentIndex) const info = this.list.find((v) => v.index === this.currentIndex)
getApp().track("removeError", {
questionId: info.id
})
this.$u.api.removeError({ questionId: info.id }).then((res) => { this.$u.api.removeError({ questionId: info.id }).then((res) => {
if (res) this.init(this.currentIndex) if (res) this.init(this.currentIndex)
}) })
......
...@@ -97,6 +97,11 @@ export default { ...@@ -97,6 +97,11 @@ export default {
size: this.pageSize, size: this.pageSize,
} }
getApp().track("search", {
questionWarehouseId: this.questionWarehouseId,
keyword: this.keyword,
})
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.$u.api.searchQuestion(data).then((res) => { this.$u.api.searchQuestion(data).then((res) => {
this.total = res.total this.total = res.total
......
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