feat: 增加存储容量显示
This commit is contained in:
@@ -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()
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user