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,101 +121,131 @@ const chartOpts = {
|
|||||||
|
|
||||||
function getWeightChartData() {
|
function getWeightChartData() {
|
||||||
const list = getRecentRecords('weight', 7)
|
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 = {
|
weightChartData.value = {
|
||||||
categories,
|
categories,
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: '体重(Kg)',
|
name: '体重(Kg)',
|
||||||
data: list.map((r) => r.value),
|
data: list.map((r) => r.value),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
} 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: [] }
|
|
||||||
|
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
if (list.length) {
|
||||||
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
sleepChartData.value = {
|
sleepChartData.value = {
|
||||||
categories,
|
categories,
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: '睡眠(小时)',
|
name: '睡眠(小时)',
|
||||||
data: list.map((r) => r.duration),
|
data: list.map((r) => r.duration),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
} 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: [] }
|
|
||||||
|
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
if (list.length) {
|
||||||
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
sportChartData.value = {
|
sportChartData.value = {
|
||||||
categories,
|
categories,
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: '运动(分钟)',
|
name: '运动(分钟)',
|
||||||
data: list.map((r) => r.duration),
|
data: list.map((r) => r.duration),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
} 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: [] }
|
|
||||||
|
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
if (list.length) {
|
||||||
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
bloodPressureChartData.value = {
|
bloodPressureChartData.value = {
|
||||||
categories,
|
categories,
|
||||||
series: [
|
series: [
|
||||||
{ name: '收缩压(mmHg)', data: list.map((r) => r.systolic) },
|
{ name: '收缩压(mmHg)', data: list.map((r) => r.systolic) },
|
||||||
{ 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: [] }
|
|
||||||
|
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
if (list.length) {
|
||||||
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
bloodSugarChartData.value = {
|
bloodSugarChartData.value = {
|
||||||
categories,
|
categories,
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: '血糖(mmol/L)',
|
name: '血糖(mmol/L)',
|
||||||
data: list.map((r) => r.value),
|
data: list.map((r) => r.value),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
} 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: [] }
|
|
||||||
|
|
||||||
const categories = list.map((_, index) => String(index + 1))
|
if (list.length) {
|
||||||
|
const categories = list.map((_, index) => String(index + 1))
|
||||||
|
|
||||||
temperatureChartData.value = {
|
temperatureChartData.value = {
|
||||||
categories,
|
categories,
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: '体温(℃)',
|
name: '体温(℃)',
|
||||||
data: list.map((r) => r.value),
|
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 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