1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2025-12-07 13:03:59 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Sunwuyuan
a5cd6bcd08
Merge pull request #22 from ZeroCatDev/copilot/fix-notification-bug
Fix notification deletion: save {} instead of [] when list is empty
2025-12-01 18:28:43 +08:00
copilot-swe-agent[bot]
f282f1f4bc Fix notification deletion: save {} instead of [] when list is empty
Only modify the two files that need the fix, without any formatting changes.

Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
2025-12-01 10:24:14 +00:00
copilot-swe-agent[bot]
5ee4602181 Update .gitignore to exclude auto-generated files
Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
2025-12-01 10:17:20 +00:00
copilot-swe-agent[bot]
056225b6b3 Fix notification deletion bug: save {} instead of [] when list is empty
When all notifications are deleted, the persistentNotifications array
becomes empty ([]). The backend doesn't accept an empty array as a
valid value, requiring an empty object ({}) instead. This fix modifies
both index.vue and UrgentTestDialog.vue to save {} when the
notification list is empty.

Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
2025-12-01 10:16:47 +00:00
copilot-swe-agent[bot]
65b08653c8 Initial plan 2025-12-01 10:11:40 +00:00
2 changed files with 6 additions and 2 deletions

View File

@ -681,7 +681,9 @@ export default {
try {
this.persistentNotifications = this.persistentNotifications.filter(n => n.id !== id)
await dataProvider.saveData('notification-list', this.persistentNotifications)
// {} []
const dataToSave = this.persistentNotifications.length > 0 ? this.persistentNotifications : {}
await dataProvider.saveData('notification-list', dataToSave)
this.$message?.success('已删除')
} catch (e) {
console.error('删除失败', e)

View File

@ -2066,7 +2066,9 @@ export default {
},
async removePersistentNotification(id) {
this.persistentNotifications = this.persistentNotifications.filter(n => n.id !== id);
await dataProvider.saveData('notification-list', this.persistentNotifications);
// {} []
const dataToSave = this.persistentNotifications.length > 0 ? this.persistentNotifications : {};
await dataProvider.saveData('notification-list', dataToSave);
this.notificationDetailDialog = false;
},
},