feat: 增加可以自定义默认值功能

This commit is contained in:
2026-08-30 21:44:37 +08:00
parent 196251dfc9
commit 5f497f82f8
15 changed files with 205 additions and 26 deletions

View File

@@ -1,8 +1,9 @@
import type { IProfile } from "@/type/profile";
import type {IDefaultRecordValue, IProfile} from "@/type/profile";
const PROFILE_KEY = 'user_profile'
const OVERVIEW_KEY = 'user_overview'
const PLAN_KEY = 'user_plan'
const DEFAULT_RECORD_VALUE_KEY = 'user_default_record_value'
function getEmptyProfile(): IProfile {
return {
@@ -20,6 +21,14 @@ export function saveProfile(data: IProfile) {
wx.setStorageSync(PROFILE_KEY, data)
}
export function getDefaultRecordValue(): IDefaultRecordValue {
return wx.getStorageSync(DEFAULT_RECORD_VALUE_KEY)
}
export function saveDefaultRecordValue(data: IDefaultRecordValue) {
wx.setStorageSync(DEFAULT_RECORD_VALUE_KEY, data)
}
export function getOverview(): string[] {
return wx.getStorageSync(OVERVIEW_KEY) || []
}