From 069f0a31c0ed2f2cecf04bcbe331f0b565150d1b Mon Sep 17 00:00:00 2001 From: Sunwuyuan Date: Sat, 29 Nov 2025 15:18:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E8=80=83=E5=8B=A4?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=90=8C=E6=AD=A5=E4=B8=8E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pages/index.vue b/src/pages/index.vue index 0bcaa66..2a96451 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -122,7 +122,7 @@ :attendance="state.boardData.attendance" :date-string="state.dateString" @save="saveAttendance" - @change="state.synced = false" + @change="handleAttendanceChange" /> @@ -343,6 +343,7 @@ export default { students: false, }, debouncedUpload: null, + debouncedAttendanceSave: null, throttledReflow: null, sortedItemsCache: { key: "", @@ -615,10 +616,20 @@ export default { }, deep: true, }, + "state.attendanceDialog": { + handler(newValue) { + this.handleAttendanceDialogClose(newValue); + }, + }, }, created() { this.debouncedUpload = debounce(this.uploadData, 2000); + this.debouncedAttendanceSave = debounce(async () => { + if (this.autoSave) { + await this.trySave(true); + } + }, 2000); this.throttledReflow = throttle(() => { if (this.$refs.gridContainer) { this.optimizeGridLayout(this.sortedItems); @@ -1400,6 +1411,11 @@ export default { return this.trySave(false); }, + handleAttendanceChange() { + this.state.synced = false; + this.debouncedAttendanceSave(); + }, + async handleAttendanceDialogClose(newValue) { if (!newValue && !this.state.synced) { await this.trySave(true);