feat:增加登录模块

This commit is contained in:
2025-06-25 23:48:43 +08:00
parent 37b2e588db
commit 99f828381d
21 changed files with 822 additions and 82 deletions

View File

@@ -30,24 +30,10 @@ onMounted(async () => {
})
const getAverageCount = () => {
if (foodStore.queryDateType === 'month') {
return foodStore.recordList.length
} else {
const result = {}
// 遍历数据,按月统计出现次数
foodStore.recordList.forEach((item) => {
const date = new Date(item.date)
const month = String(date.getMonth() + 1)
if (result[month]) {
result[month].count += 1
} else {
result[month] = { count: 1 }
}
})
return foodStore.recordList.length / Object.keys(result).length
if (foodStore.recordStats.length === 0) {
return 0
}
const sum = foodStore.recordStats.map((item) => item.value).reduce((acc, curr) => acc + curr, 0)
return (sum / foodStore.recordStats.length).toFixed(2)
}
</script>