| 44 | }, |
| 45 | |
| 46 | *changeNoticeReadState({ payload }, { put, select }) { |
| 47 | const notices = yield select(state => |
| 48 | state.global.notices.map(item => { |
| 49 | const notice = { ...item }; |
| 50 | |
| 51 | if (notice.id === payload) { |
| 52 | notice.read = true; |
| 53 | } |
| 54 | |
| 55 | return notice; |
| 56 | }), |
| 57 | ); |
| 58 | yield put({ |
| 59 | type: 'saveNotices', |
| 60 | payload: notices, |
| 61 | }); |
| 62 | yield put({ |
| 63 | type: 'user/changeNotifyCount', |
| 64 | payload: { |
| 65 | totalCount: notices.length, |
| 66 | unreadCount: notices.filter(item => !item.read).length, |
| 67 | }, |
| 68 | }); |
| 69 | }, |
| 70 | }, |
| 71 | reducers: { |
| 72 | changeRightDrawerVisible(state,{payload}){ |