feat: 增加版本号功能

This commit is contained in:
2026-08-28 15:33:29 +08:00
parent 7021d9d525
commit 338ba726a0
3 changed files with 105 additions and 64 deletions

View File

@@ -82,22 +82,28 @@ import { getRecentRecords } from '@/utils/record'
import { onShow } from "@dcloudio/uni-app";
const weightChartData = ref({
categories: []
categories: [] as string[],
series: [] as any[]
})
const sleepChartData = ref({
categories: []
categories: [] as string[],
series: [] as any[]
})
const sportChartData = ref({
categories: []
categories: [] as string[],
series: [] as any[]
})
const bloodPressureChartData = ref({
categories: []
categories: [] as string[],
series: [] as any[]
})
const bloodSugarChartData = ref({
categories: []
categories: [] as string[],
series: [] as any[]
})
const temperatureChartData = ref({
categories: []
categories: [] as string[],
series: [] as any[]
})
// 图表配置
@@ -115,101 +121,131 @@ const chartOpts = {
function getWeightChartData() {
const list = getRecentRecords('weight', 7)
if (!list.length) return { categories: [], series: [] }
const categories = list.map((_, index) => String(index + 1))
if (list.length) {
const categories = list.map((_, index) => String(index + 1))
weightChartData.value = {
categories,
series: [
{
name: '体重Kg',
data: list.map((r) => r.value),
},
],
weightChartData.value = {
categories,
series: [
{
name: '体重Kg',
data: list.map((r) => r.value),
},
],
}
} else {
weightChartData.value = {
categories: [], series: []
}
}
}
function getSleepChartData() {
const list = getRecentRecords('sleep', 7)
if (!list.length) return { categories: [], series: [] }
const categories = list.map((_, index) => String(index + 1))
if (list.length) {
const categories = list.map((_, index) => String(index + 1))
sleepChartData.value = {
categories,
series: [
{
name: '睡眠(小时)',
data: list.map((r) => r.duration),
},
],
sleepChartData.value = {
categories,
series: [
{
name: '睡眠(小时)',
data: list.map((r) => r.duration),
},
],
}
} else {
sleepChartData.value = {
categories: [], series: []
}
}
}
function getSportChartData() {
const list = getRecentRecords('sport', 7)
if (!list.length) return { categories: [], series: [] }
const categories = list.map((_, index) => String(index + 1))
if (list.length) {
const categories = list.map((_, index) => String(index + 1))
sportChartData.value = {
categories,
series: [
{
name: '运动(分钟)',
data: list.map((r) => r.duration),
},
],
sportChartData.value = {
categories,
series: [
{
name: '运动(分钟)',
data: list.map((r) => r.duration),
},
],
}
} else {
sportChartData.value = {
categories: [], series: []
}
}
}
function getBloodPressureChartData() {
const list = getRecentRecords('bloodPressure', 7)
if (!list.length) return { categories: [], series: [] }
const categories = list.map((_, index) => String(index + 1))
if (list.length) {
const categories = list.map((_, index) => String(index + 1))
bloodPressureChartData.value = {
categories,
series: [
{ name: '收缩压mmHg', data: list.map((r) => r.systolic) },
{ name: '舒张压mmHg', data: list.map((r) => r.diastolic) },
],
bloodPressureChartData.value = {
categories,
series: [
{ name: '收缩压mmHg', data: list.map((r) => r.systolic) },
{ name: '舒张压mmHg', data: list.map((r) => r.diastolic) },
],
}
} else {
bloodPressureChartData.value = {
categories: [], series: []
}
}
}
function getBloodSugarChartData() {
const list = getRecentRecords('bloodSugar', 7)
if (!list.length) return { categories: [], series: [] }
const categories = list.map((_, index) => String(index + 1))
if (list.length) {
const categories = list.map((_, index) => String(index + 1))
bloodSugarChartData.value = {
categories,
series: [
{
name: '血糖mmol/L',
data: list.map((r) => r.value),
},
],
bloodSugarChartData.value = {
categories,
series: [
{
name: '血糖mmol/L',
data: list.map((r) => r.value),
},
],
}
} else {
bloodSugarChartData.value = {
categories: [], series: []
}
}
}
function getTemperatureChartData() {
const list = getRecentRecords('temperature', 7)
if (!list.length) return { categories: [], series: [] }
const categories = list.map((_, index) => String(index + 1))
if (list.length) {
const categories = list.map((_, index) => String(index + 1))
temperatureChartData.value = {
categories,
series: [
{
name: '体温(℃)',
data: list.map((r) => r.value),
},
],
temperatureChartData.value = {
categories,
series: [
{
name: '体温(℃)',
data: list.map((r) => r.value),
},
],
}
} else {
temperatureChartData.value = {
categories: [], series: []
}
}
}