feat: 增加存储容量显示

This commit is contained in:
2026-09-01 09:20:46 +08:00
parent f85a6ded2a
commit bb5a9b3c0f
6 changed files with 28 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import type {IDefaultRecordValue, IProfile} from "@/type/profile";
import type {IStats} from "@/type";
import {countRecordsByMonth, getMaxRecord, getTotalCount} from "@/utils/record";
export const useProfileStore = defineStore('profile', {
state: () => ({
@@ -25,6 +26,7 @@ export const useProfileStore = defineStore('profile', {
bloodSugarValue: 5.4,
temperatureValue: 36.5,
} as IDefaultRecordValue,
currentStorageSize: 0,
storageStats: [] as IStats[],
storageTotal: 0,
storageMax: 1000,
@@ -35,6 +37,12 @@ export const useProfileStore = defineStore('profile', {
isRefresh: false,
}),
actions: {
refreshStorage() {
const storageInfo = wx.getStorageInfoSync()
this.currentStorageSize = storageInfo.currentSize
this.storageStats = countRecordsByMonth()
this.storageTotal = getTotalCount()
this.storageMax = getMaxRecord()
}
},
})