diff --git a/src/pages/stats/index.vue b/src/pages/stats/index.vue
index 9217785..43bb6b9 100644
--- a/src/pages/stats/index.vue
+++ b/src/pages/stats/index.vue
@@ -1,115 +1,122 @@
-
-
-
-
- 最近7次趋势
-
+
+
+
+
+
+ 最近7次趋势
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/utils/record.ts b/src/utils/record.ts
index 170dd4b..46d9b99 100644
--- a/src/utils/record.ts
+++ b/src/utils/record.ts
@@ -84,7 +84,13 @@ function addRecord(type: string, data: Record, timestamp: number) {
* @param limit
*/
function appendRecentRecord(type: string, record: any, limit = 7) {
- const key = `recent_${type}`
+ let key = ''
+ if (type === 'bloodSugar') {
+ key = `recent_${type}_${record.period}`
+ } else {
+ key = `recent_${type}`
+ }
+
const recent = wx.getStorageSync(key) || []
// 正序:timestamp 小的在前
@@ -105,10 +111,16 @@ function appendRecentRecord(type: string, record: any, limit = 7) {
/**
* 删除最近记录的数据
* @param type 类型
+ * @param record 记录
* @param id id
*/
-function removeFromRecentIndex(type: string, id: string) {
- const key = `recent_${type}`
+function removeFromRecentIndex(type: string, record: any, id: string) {
+ let key = ''
+ if (type === 'bloodSugar') {
+ key = `recent_${type}_${record.period}`
+ } else {
+ key = `recent_${type}`
+ }
const recent = wx.getStorageSync(key) || []
const idx = recent.findIndex((item: any) => item.id === id)
@@ -159,7 +171,7 @@ export function deleteRecordByDate(date: string, id: string) {
wx.setStorageSync(key, all)
}
- removeFromRecentIndex(type, id)
+ removeFromRecentIndex(type, record, id)
}
/**