feat: 增加版本号功能
This commit is contained in:
@@ -82,22 +82,28 @@ import { getRecentRecords } from '@/utils/record'
|
|||||||
import { onShow } from "@dcloudio/uni-app";
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
|
|
||||||
const weightChartData = ref({
|
const weightChartData = ref({
|
||||||
categories: []
|
categories: [] as string[],
|
||||||
|
series: [] as any[]
|
||||||
})
|
})
|
||||||
const sleepChartData = ref({
|
const sleepChartData = ref({
|
||||||
categories: []
|
categories: [] as string[],
|
||||||
|
series: [] as any[]
|
||||||
})
|
})
|
||||||
const sportChartData = ref({
|
const sportChartData = ref({
|
||||||
categories: []
|
categories: [] as string[],
|
||||||
|
series: [] as any[]
|
||||||
})
|
})
|
||||||
const bloodPressureChartData = ref({
|
const bloodPressureChartData = ref({
|
||||||
categories: []
|
categories: [] as string[],
|
||||||
|
series: [] as any[]
|
||||||
})
|
})
|
||||||
const bloodSugarChartData = ref({
|
const bloodSugarChartData = ref({
|
||||||
categories: []
|
categories: [] as string[],
|
||||||
|
series: [] as any[]
|
||||||
})
|
})
|
||||||
const temperatureChartData = ref({
|
const temperatureChartData = ref({
|
||||||
categories: []
|
categories: [] as string[],
|
||||||
|
series: [] as any[]
|
||||||
})
|
})
|
||||||
|
|
||||||
// 图表配置
|
// 图表配置
|
||||||
@@ -115,8 +121,8 @@ const chartOpts = {
|
|||||||
|
|
||||||
function getWeightChartData() {
|
function getWeightChartData() {
|
||||||
const list = getRecentRecords('weight', 7)
|
const list = getRecentRecords('weight', 7)
|
||||||
if (!list.length) return { categories: [], series: [] }
|
|
||||||
|
|
||||||
|
if (list.length) {
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
weightChartData.value = {
|
weightChartData.value = {
|
||||||
@@ -128,12 +134,17 @@ function getWeightChartData() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
weightChartData.value = {
|
||||||
|
categories: [], series: []
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSleepChartData() {
|
function getSleepChartData() {
|
||||||
const list = getRecentRecords('sleep', 7)
|
const list = getRecentRecords('sleep', 7)
|
||||||
if (!list.length) return { categories: [], series: [] }
|
|
||||||
|
|
||||||
|
if (list.length) {
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
sleepChartData.value = {
|
sleepChartData.value = {
|
||||||
@@ -145,12 +156,17 @@ function getSleepChartData() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sleepChartData.value = {
|
||||||
|
categories: [], series: []
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSportChartData() {
|
function getSportChartData() {
|
||||||
const list = getRecentRecords('sport', 7)
|
const list = getRecentRecords('sport', 7)
|
||||||
if (!list.length) return { categories: [], series: [] }
|
|
||||||
|
|
||||||
|
if (list.length) {
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
sportChartData.value = {
|
sportChartData.value = {
|
||||||
@@ -162,12 +178,17 @@ function getSportChartData() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sportChartData.value = {
|
||||||
|
categories: [], series: []
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBloodPressureChartData() {
|
function getBloodPressureChartData() {
|
||||||
const list = getRecentRecords('bloodPressure', 7)
|
const list = getRecentRecords('bloodPressure', 7)
|
||||||
if (!list.length) return { categories: [], series: [] }
|
|
||||||
|
|
||||||
|
if (list.length) {
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
bloodPressureChartData.value = {
|
bloodPressureChartData.value = {
|
||||||
@@ -177,12 +198,17 @@ function getBloodPressureChartData() {
|
|||||||
{ name: '舒张压(mmHg)', data: list.map((r) => r.diastolic) },
|
{ name: '舒张压(mmHg)', data: list.map((r) => r.diastolic) },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
bloodPressureChartData.value = {
|
||||||
|
categories: [], series: []
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBloodSugarChartData() {
|
function getBloodSugarChartData() {
|
||||||
const list = getRecentRecords('bloodSugar', 7)
|
const list = getRecentRecords('bloodSugar', 7)
|
||||||
if (!list.length) return { categories: [], series: [] }
|
|
||||||
|
|
||||||
|
if (list.length) {
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
bloodSugarChartData.value = {
|
bloodSugarChartData.value = {
|
||||||
@@ -194,12 +220,17 @@ function getBloodSugarChartData() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
bloodSugarChartData.value = {
|
||||||
|
categories: [], series: []
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTemperatureChartData() {
|
function getTemperatureChartData() {
|
||||||
const list = getRecentRecords('temperature', 7)
|
const list = getRecentRecords('temperature', 7)
|
||||||
if (!list.length) return { categories: [], series: [] }
|
|
||||||
|
|
||||||
|
if (list.length) {
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
temperatureChartData.value = {
|
temperatureChartData.value = {
|
||||||
@@ -211,6 +242,11 @@ function getTemperatureChartData() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
temperatureChartData.value = {
|
||||||
|
categories: [], series: []
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
<wd-cell size="large" title="存储详情" is-link @click="openStoragePopup"/>
|
<wd-cell size="large" title="存储详情" is-link @click="openStoragePopup"/>
|
||||||
</wd-cell-group>
|
</wd-cell-group>
|
||||||
|
|
||||||
|
<wd-text :text="`版本号:${appStore.version}`" custom-style="margin-top: 5px;display:block; text-align:center;"></wd-text>
|
||||||
|
|
||||||
<profile-popup />
|
<profile-popup />
|
||||||
|
|
||||||
<storage-popup />
|
<storage-popup />
|
||||||
@@ -44,10 +46,12 @@ import PlanPopup from "@/components/Profile/PlanPopup.vue";
|
|||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { getOverview, getPlan, getProfile } from '@/utils/profile'
|
import { getOverview, getPlan, getProfile } from '@/utils/profile'
|
||||||
import { useProfileStore } from '@/store/profile'
|
import { useProfileStore } from '@/store/profile'
|
||||||
|
import { useAppStore } from "@/store/app";
|
||||||
import type { IProfile } from "@/type/profile";
|
import type { IProfile } from "@/type/profile";
|
||||||
import { countRecordsByMonth, getTotalCount } from "@/utils/record";
|
import { countRecordsByMonth, getTotalCount } from "@/utils/record";
|
||||||
|
|
||||||
const profileStore = useProfileStore()
|
const profileStore = useProfileStore()
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const profile = ref<IProfile>(getProfile())
|
const profile = ref<IProfile>(getProfile())
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
|
|||||||
|
|
||||||
export const useAppStore = defineStore('app', {
|
export const useAppStore = defineStore('app', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
version: '1.0.1',
|
||||||
viewRecordType: 'calendar',
|
viewRecordType: 'calendar',
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
Reference in New Issue
Block a user