Commit 6236df6c authored by spc's avatar spc

md

parent 5640f268
......@@ -189,6 +189,7 @@ import { ref, computed, onMounted, onUnmounted, watch, nextTick, getCurrentInsta
import { onLoad, onShow } from '@dcloudio/uni-app'
import { feedingRecordsStatisticsPeriod, feedingRecordsByDate, feedingRecords as feedingRecordsAPI, feedingRecordsDelete } from '@/api/feeding.js'
import { useUserStore } from '@/stores/user.js'
import md from '../../md';
// API 集成说明:
// 1. 使用 /c/feeding/statistics/period GET 方法查询统计图表数据
......@@ -737,6 +738,11 @@ function calculateBabyAge(birthday) {
// 编辑记录
function editRecord(index) {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "统计页",
buttonName: "修改",
});
console.log('编辑记录:', index)
const record = todayRecords.value[index]
......@@ -811,6 +817,11 @@ function editRecord(index) {
// 删除记录
async function deleteRecord(record) {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "统计页",
buttonName: "删除",
});
console.log('删除记录:', record)
deletingRecord.value = record
showDelPopup.value = true
......@@ -861,6 +872,11 @@ async function confirmDelRecord() {
// 返回上一页
function goBack() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "统计页",
buttonName: "返回",
});
// uni.navigateBack()
uni.redirectTo({
url: '/pages/feedingRecord/feedingRecord'
......@@ -936,12 +952,22 @@ function generateWeekData(weekOffset = 0, targetDate = null) {
// 上一周
async function prevWeek() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "统计页",
buttonName: "日期切换按钮左",
});
currentWeek.value--
await updateChartData(false) // 切换周时使用默认选择
}
// 下一周
async function nextWeek() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "统计页",
buttonName: "日期切换按钮右",
});
currentWeek.value++
await updateChartData(false) // 切换周时使用默认选择
}
......@@ -1011,6 +1037,11 @@ async function updateChartData(keepCurrentSelection = false) {
// 点击柱状图切换日期
async function onBarClick(day) {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "统计页",
buttonName: "日期选择按钮",
});
console.log('柱状图点击事件触发:', day)
console.log('当前 chartData:', chartData.value)
console.log('当前 selectedDate:', selectedDate.value)
......@@ -1278,6 +1309,12 @@ async function initializeApiData() {
// 页面挂载时初始化数据
onMounted(async () => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "统计页",
});
// 加载宝宝信息
await userStore.loadBabyInfo()
console.log('宝宝信息加载完成:', userStore.babyInfo)
......
......@@ -1422,26 +1422,60 @@ function setRecordMethod(method) {
// 手动记录、计时器记录、语音记录
if (method === 'manual') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "手动记录",
});
if (selectedType.value === 'breastfeeding') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "母乳亲喂手动记录",
});
}
if (selectedType.value === 'bottle') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "母乳瓶喂手动记录",
});
}
if (selectedType.value === 'formula') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "奶粉喂养手动记录",
});
}
}
if (method === 'voice') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "语音记录",
});
if (selectedType.value === 'breastfeeding') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "母乳亲喂语音记录",
});
}
if (selectedType.value === 'bottle') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "母乳瓶喂语音记录",
});
}
if (selectedType.value === 'formula') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "奶粉喂养语音记录",
});
}
}
if (method === 'timer') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "计时器记录",
buttonName: "母乳亲喂计时器记录",
});
}
......@@ -1776,11 +1810,35 @@ async function completeRecord() {
}
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "完成记录",
});
if (selectedType.value === 'breastfeeding') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "母乳亲喂完成记录",
});
}
if (selectedType.value === 'bottle') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "母乳瓶喂完成记录",
});
}
if (selectedType.value === 'formula') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "奶粉喂养完成记录",
});
}
if (selectedType.value === 'food') {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "辅食完成记录",
});
}
try {
isSubmitting.value = true
......@@ -2200,6 +2258,11 @@ function enterEditMode() {
// 如果已经在编辑模式,则取消编辑
cancelEditMode()
} else {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "辅食删除",
});
// 保存原始辅食数据,保持顺序
foodSelectionState.value.originalFoodData = {
selectedItems: [...feedingData.value.food.selectedItems],
......@@ -2263,6 +2326,11 @@ function cancelEditMode() {
}
async function exitEditMode() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "辅食删除完成",
});
// 防连点检查
if (foodSelectionState.value.isDeletingFood) {
console.log('防连点:删除完成按钮被阻止')
......@@ -2333,6 +2401,11 @@ async function exitEditMode() {
}
function showAddFoodPopup(categoryName) {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "辅食添加" + categoryName,
});
// 防连点检查
if (foodSelectionState.value.isAddingFood) {
console.log('防连点:添加辅食按钮被阻止')
......@@ -2816,7 +2889,7 @@ async function startRecording() {
pageName: "喂养工具首页",
buttonName: "语音识别录制开始按钮",
});
console.log('开始录音请求...')
console.log('当前录音状态:', {
isRecording: recordingState.value.isRecording,
......
......@@ -23,7 +23,7 @@
<!-- 日期选择器和统计按钮 -->
<view class="date-stats-row">
<view class="date-selector">
<view class="date-selector" @click="showDatePicker">
<uni-datetime-picker ref="datePickerRef" v-model="currentSelectedDate" type="date" :start="earliestDateString"
:end="todayDateString" @change="onDateChange" :clear-icon="false" :border="false">
<view class="date-display">
......@@ -204,6 +204,7 @@ import { onLoad, onShow } from '@dcloudio/uni-app'
import BabySwitchPopup from '@/components/BabySwitchPopup.vue'
import { feedingRecordsByDate, feedingRecordsCalendarStatus, feedingRecords as feedingRecordsAPI, feedingRecordsDelete } from '@/api/feeding.js'
import { useUserStore } from '@/stores/user.js'
import md from '../../md'
// API 集成说明:
// 1. 使用 /c/feeding/records GET 方法查询指定日期的喂养记录列表
......@@ -398,6 +399,16 @@ const calendarDates = computed(() => {
return dates
})
function showDatePicker() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养记录页",
buttonName: "日期下拉按钮",
});
}
function goToFeedingIndex() {
uni.navigateBack()
}
......@@ -515,6 +526,11 @@ function selectDate(dateObj) {
}
function toggleCalendarExpand() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养记录页",
buttonName: "日历展开按钮",
});
isCalendarExpanded.value = !isCalendarExpanded.value
}
......@@ -629,6 +645,11 @@ function getRecordBgColor(type) {
}
async function deleteRecord(recordId) {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养记录页",
buttonName: "删除",
});
console.log('删除记录:', recordId)
// 设置要删除的记录ID并显示确认弹窗
deletingRecordId.value = recordId
......@@ -636,6 +657,11 @@ async function deleteRecord(recordId) {
}
function editRecord(index) {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养记录页",
buttonName: "修改",
});
const record = todayRecords.value[index]
if (!record) return
......@@ -870,6 +896,11 @@ async function saveEditRecord() {
}
function goToFeedingAnalysis() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养记录页",
buttonName: "统计",
});
uni.redirectTo({
url: '/pages/feedingAnalysis/feedingAnalysis'
})
......@@ -877,11 +908,22 @@ function goToFeedingAnalysis() {
// 返回上一页
function goBack() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养记录页",
buttonName: "返回",
});
uni.navigateBack()
}
// 宝宝切换相关方法
function showBabySwitch() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养记录页",
buttonName: "切换宝宝",
});
// 只有当有多个宝宝时才显示切换弹窗
if (babyList.value.length > 1) {
showBabySwitchPopup.value = true
......@@ -1496,6 +1538,12 @@ watch(currentDate, (newDate, oldDate) => {
}, { immediate: false })
onMounted(async () => {
md.sensorLogTake({
xcxPage: "小程序页面浏览事件",
pageName: "喂养记录页",
});
// 组件挂载后的操作
// 加载宝宝信息
await userStore.loadBabyInfo()
......
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