feat: 增加版本号功能
This commit is contained in:
@@ -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: []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
<wd-cell size="large" title="存储详情" is-link @click="openStoragePopup"/>
|
||||
</wd-cell-group>
|
||||
|
||||
<wd-text :text="`版本号:${appStore.version}`" custom-style="margin-top: 5px;display:block; text-align:center;"></wd-text>
|
||||
|
||||
<profile-popup />
|
||||
|
||||
<storage-popup />
|
||||
@@ -44,10 +46,12 @@ import PlanPopup from "@/components/Profile/PlanPopup.vue";
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { getOverview, getPlan, getProfile } from '@/utils/profile'
|
||||
import { useProfileStore } from '@/store/profile'
|
||||
import { useAppStore } from "@/store/app";
|
||||
import type { IProfile } from "@/type/profile";
|
||||
import { countRecordsByMonth, getTotalCount } from "@/utils/record";
|
||||
|
||||
const profileStore = useProfileStore()
|
||||
const appStore = useAppStore()
|
||||
|
||||
const profile = ref<IProfile>(getProfile())
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
|
||||
|
||||
export const useAppStore = defineStore('app', {
|
||||
state: () => ({
|
||||
version: '1.0.1',
|
||||
viewRecordType: 'calendar',
|
||||
}),
|
||||
actions: {
|
||||
|
||||
Reference in New Issue
Block a user