mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2025-12-07 21:13:11 +00:00
Merge branch 'main' of https://github.com/ZeroCatDev/Classworks
This commit is contained in:
commit
3d81ddb8f9
@ -681,17 +681,14 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.persistentNotifications = this.persistentNotifications.filter(n => n.id !== 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.$message?.success('已删除')
|
this.$message?.success('已删除')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('删除失败', e)
|
console.error('删除失败', e)
|
||||||
this.$message?.error('删除失败')
|
this.$message?.error('删除失败')
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
deletePersistentNotification(id) {
|
|
||||||
this.itemToDelete = id
|
|
||||||
this.deleteConfirmDialog = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2066,7 +2066,9 @@ export default {
|
|||||||
},
|
},
|
||||||
async removePersistentNotification(id) {
|
async removePersistentNotification(id) {
|
||||||
this.persistentNotifications = this.persistentNotifications.filter(n => n.id !== 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;
|
this.notificationDetailDialog = false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user