Commit 9457fb8c authored by weishengfei's avatar weishengfei

feat(analytics): 添加小程序页面埋点统计

- 在各个页面添加了浏览事件和点击事件的埋点统计
- 包括新增产检、修改产检、我的报告单、产检提醒首页等页面
- 埋点数据包括页面名称、按钮名称等信息
- 优化了用户体验,为后续数据分析提供支持
parent 64c9a29c
......@@ -146,6 +146,7 @@ import {
// 导入日期选择器组件
import DatePicker from '@/components/DatePicker.vue'
import { useUserStore } from "@/stores/user";
import md from '../../md';
// 获取用户信息
const userStore = useUserStore();
......@@ -190,6 +191,11 @@ const onPopupClose2 = () => {
}
// 修改时间
const onChangeTime = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "新增产检页",
buttonName: "产检时间选择",
});
visible.value = true;
}
// 选择日期回调确认
......@@ -200,6 +206,11 @@ const handleDateConfirm = (date) => {
}
// 添加项目
const onAdd = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "新增产检页",
buttonName: "产检项目添加",
});
wx.setPageStyle({
style: {
overflow: 'hidden'
......@@ -259,6 +270,12 @@ const saveSelection = () => {
// };
// 删除所选产品项目
const onDelete = (id) => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "新增产检页",
buttonName: "删除产检项目",
});
listData.value.filter((item, index) => {
if (item.id == id) {
listData.value.splice(index, 1)
......@@ -283,6 +300,12 @@ const onImageDel = (e) => {
}
// 上传图片
const onUpload = throttleTap(() => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "新增产检页",
buttonName: "上传报告单",
});
if (bgdImgList.value.length == 15) {
uni.showToast({
title: "最多上传15张图片",
......@@ -322,6 +345,11 @@ const onUpload = throttleTap(() => {
// 保存
const onSave = throttleTap( async () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "新增产检页",
buttonName: "保存",
});
if (listData.value.length == 0) {
uni.showToast({
title: '还没有添加产检项哦',
......@@ -363,6 +391,12 @@ const onSave = throttleTap( async () => {
// 查看更多
const onSeeBtn = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "新增产检页",
buttonName: "查看全部",
});
// 跳转
uni.navigateTo({
url: '/pages/myReportCard/myReportCard'
......@@ -378,6 +412,10 @@ const getList = async () => {
}
}
onLoad((options) => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "新增产检页"
});
if (Object.keys(options).length > 0 && options.time) {
time.value = options.time
} else {
......
......@@ -93,6 +93,7 @@ import {
hideLoading
} from '@/utils/index.js';
import { onLoad } from '@dcloudio/uni-app'
import md from '../../md';
import {
getUpdate,
......@@ -133,6 +134,12 @@ const onPopupClose2 = () => {
// 添加项目
const onAdd = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "修改产检项目页",
buttonName: "添加产检项目",
});
wx.setPageStyle({
style: {
overflow: 'hidden'
......@@ -192,6 +199,12 @@ const saveSelection = () => {
// };
// 删除所选产品项目
const onDelete = (id) => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "修改产检项目页",
buttonName: "删除产检项目",
});
listData.value.filter((item, index) => {
if (item.id == id) {
listData.value.splice(index, 1)
......@@ -202,6 +215,12 @@ const onDelete = (id) => {
// 保存
const onSave = throttleTap(async () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "修改产检项目页",
buttonName: "保存",
});
if (listData.value.length == 0) {
uni.showToast({
title: '还没有添加产检项哦',
......@@ -249,6 +268,10 @@ const getList = async () => {
}
}
onLoad((options) => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "修改产检项目页"
});
const { id, examinationItems } = JSON.parse(options.item)
console.log(id, examinationItems)
editId.value = id
......
......@@ -118,6 +118,11 @@ const listData = ref([])
// 跳转小程序
const onJump = async () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "我的报告单页",
buttonName: '专家在线咨询'
});
const res = await getHealthField();
if (!res.success) {
......@@ -172,6 +177,11 @@ const getProject = (projects) => {
// 删除事件
const onDelete = throttleTap((id) => {
console.log(id)
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "我的报告单页",
buttonName: '删除'
});
uni.showModal({
// title: '提示',
content: '确认删除吗?',
......@@ -187,6 +197,11 @@ const onDelete = throttleTap((id) => {
})
// 返回上一页面
const backHandler = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "我的报告单页",
buttonName: '返回'
});
uni.navigateBack();
}
// 删除报告单
......@@ -221,6 +236,10 @@ const getReportListFn = async () => {
}
onLoad(() => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "我的报告单页"
});
// 我的报告单
getReportListFn()
})
......
......@@ -257,6 +257,26 @@ const backHandler = () => {
// 点击轮播图事件
const handleBannerClick = (item, index) => {
console.log(item)
let buttonName = '';
switch(index){
case 0:
buttonName = '第一张焦点图';
break;
case 1:
buttonName = '第二张焦点图';
break;
case 2:
buttonName = '第三张焦点图';
break;
case 3:
buttonName = '第四张焦点图';
break;
}
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检提醒首页",
buttonName: buttonName,
});
// 跳转
if (item?.url != "") {
jump({
......@@ -265,26 +285,15 @@ const handleBannerClick = (item, index) => {
})
}
// let buttonName = '';
// switch(index){
// case 0:
// buttonName = '第一张焦点图';
// break;
// case 1:
// buttonName = '第二张焦点图';
// break;
// case 2:
// buttonName = '第三张焦点图';
// break;
// }
// md.sensorLogTake({
// xcxClick: "产品提醒页-首屏页面点击",
// pageName: "产品提醒页-首屏",
// buttonName: buttonName,
// });
}
// 新增体检
const onAdd = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检提醒首页",
buttonName: '添加'
});
uni.navigateTo({
url: '/pages/addPostnatal/addPostnatal'
})
......@@ -293,24 +302,36 @@ const onAdd = () => {
const onBtn = (type) => {
// const items = JSON.stringify(homeInfo.value)
// type 0 提醒 1 报告单 2 日历
let buttonName = ''
switch (type) {
case 0:
// 如果授权就不弹出提醒
showPicker.value = isWxNotification.value ? true : false
showPicker.value = isWxNotification.value ? true : false
buttonName = '提醒'
break;
case 1:
uni.navigateTo({
url: '/pages/myReportCard/myReportCard'
})
buttonName = '报告单'
break;
case 2:
uni.navigateTo({
url: `/pages/productionCalendar/productionCalendar`
})
buttonName = '日历'
break;
default:
break;
}
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检提醒首页",
buttonName: buttonName,
});
}
// 提醒关闭
const close = () => {
......@@ -341,6 +362,12 @@ const handleConfirm = () => {
// 编辑时间
const onEdit = (id, newTime) => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检提醒首页",
buttonName: '选择时间',
});
console.log(id, newTime)
time.value = newTime
visible.value = true
......@@ -503,6 +530,13 @@ onShow(async () => {
console.log('宝宝信息加载完成:', userStore.babyInfo)
publicFn()
})
onMounted(() => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "产检提醒首页"
});
})
</script>
<style lang="less" scoped>
......
......@@ -131,7 +131,8 @@ import {
import {
getInfo
} from '../../api/obstetric.js';
import { console } from 'inspector';
import md from '../../md';
// 获取用户信息
const userStore = useUserStore();
const babyInfo =ref(userStore?.babyInfo || {})
......@@ -379,10 +380,20 @@ const calendarDates = computed(() => {
})
// 返回
const backHandler = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检日历页",
buttonName: '返回'
});
uni.navigateBack()
}
// 跳转新增产检页面
const onAdd = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检日历页",
buttonName: '新增产检'
});
uni.navigateTo({
url: `/pages/addPostnatal/addPostnatal?time=${currentSelectedDate.value}`
})
......@@ -423,17 +434,12 @@ const getInfoFn = async () => {
});
}
}
// onLoad((option) => {
// console.log('option:', option)
// info.value = JSON.parse(option.item)
// // 使用真实的今天日期
// const today = new Date()
// const todayString = formatDateString(today)
// currentSelectedDate.value = todayString
// currentDate.value = new Date(today.getFullYear(), today.getMonth(), 1) // 当前月份的第一天
// currentMonthKey.value = `${today.getFullYear()}-${today.getMonth()}` // 设置月份键
// console.log('初始化今日日期:', todayString, '当前月份:', currentDate.value, '月份键:', currentMonthKey.value)
// })
onLoad((option) => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "产检日历页"
});
})
onShow(() => {
// 使用真实的今天日期
const today = new Date()
......
......@@ -170,6 +170,7 @@ import {
getDeleteReportImg
} from '../../api/obstetric.js';
import { useUserStore } from "@/stores/user";
import md from '../../md';
// 用户信息
const userStore = useUserStore();
const babyId = ref(userStore.babyInfo?.content?.id)
......@@ -288,6 +289,27 @@ const updateActiveTab = (scrollTop) => {
// 点击tab滚动到对应区域
const scrollToSection = (index) => {
let buttonName = ''
switch (index) {
case 0:
buttonName = '产检须知';
break;
case 1:
buttonName = '产检项目';
break;
case 2:
buttonName = '本次报告单';
break;
default:
break;
}
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检详情页",
buttonName: buttonName,
});
activeIndex.value = index;
scrolling.value = true;
......@@ -354,6 +376,12 @@ const onImageDel = (id) => {
}
// 上传图片
const onUpload = throttleTap(() => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检详情页",
buttonName: "上传报告单",
});
if (bgdImgList.value.length == 15) {
uni.showToast({
title: "最多上传15张图片",
......@@ -401,6 +429,12 @@ const onUpload = throttleTap(() => {
// 查看更多
const onSeeBtn = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检详情页",
buttonName: "查看全部",
})
uni.navigateTo({
url: '/pages/myReportCard/myReportCard'
})
......@@ -408,6 +442,12 @@ const onSeeBtn = () => {
// 打开提醒弹窗
const onRemind = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检详情页",
buttonName: "提醒",
})
// 产检时间
const checkupDate = new Date(infoData.value.checkupDate)
......@@ -475,6 +515,12 @@ const getWxNotificationFn = async (notificationDate, wxTemplateId, babyId) => {
}
// 完成检查
const onComplete = () => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检详情页",
buttonName: "完成检查",
})
if (infoData.value.checkupDate == '') {
uni.showToast({
title: '请选择产检日期',
......@@ -495,6 +541,12 @@ const onComplete = () => {
// 修改时间
const onChangeTime = throttleTap((date) => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检详情页",
buttonName: "选择时间",
})
visible.value = true
time.value = date
})
......@@ -512,6 +564,11 @@ const handleDateConfirm = (date) => {
// 修改项目
const onModify = (item) => {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "产检详情页",
buttonName: "修改项目",
})
console.log(item)
const items = JSON.stringify(item)
uni.navigateTo({
......@@ -582,6 +639,10 @@ const getSettingFn = () => {
}
// 获取传过来的参数
onLoad((options) => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "产检详情页"
});
console.log(options)
// 获取传过来的参数:id
editId.value = options.id
......
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