import { createSlice } from '@reduxjs/toolkit'; const initialState = { notifications: [ { id: 1, type: 'permission', icon: 'bi-shield', title: '新的权限请求', content: '张三请求访问销售数据集', time: '10分钟前', hasDetail: true, }, { id: 2, type: 'system', icon: 'bi-info-circle', title: '系统更新通知', content: '系统将在今晚23:00进行例行维护', time: '1小时前', hasDetail: false, }, { id: 3, type: 'permission', icon: 'bi-shield', title: '新的权限请求', content: '李四请求访问用户数据集', time: '2小时前', hasDetail: true, }, { id: 4, type: 'system', icon: 'bi-exclamation-circle', title: '安全提醒', content: '检测到异常登录行为,请及时查看', time: '3小时前', hasDetail: true, }, { id: 5, type: 'permission', icon: 'bi-shield', title: '权限变更通知', content: '管理员修改了您的数据访问权限', time: '1天前', hasDetail: true, }, ], }; const notificationCenterSlice = createSlice({ name: 'notificationCenter', initialState, reducers: { clearNotifications: (state) => { state.notifications = []; }, }, }); export const { clearNotifications } = notificationCenterSlice.actions; export default notificationCenterSlice.reducer;