feat:增加登录模块
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user