diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index 967ba0bf9..bb19a60fe 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -98,8 +98,9 @@ function MyNotice(props) { type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", ids:id, }; - axios.post(`/users/${current_user.login}/messages/read.json`,params); - getMessageList; + axios.post(`/users/${current_user.login}/messages/read.json`,params).then((response)=>{ + response.status === 0 && getMessageList(); + }); } } @@ -138,34 +139,33 @@ function MyNotice(props) { } function deleteNotice(id) { - console.log(id); - const ids = new Array(); - if(id[0] == 0){ - messageList.map((item)=>{ - item.bacheckedBatch ? ids.push(item.id):""; - }) + + const ids = []; + console.log(messageList); + if(!id){ + messageList.map(item=>{ + item.checkedBatch && ids.push(item.id); + }); } console.log(ids); - if(id){ DelModal({ title: noticeType === "1" ? '删除私信' : '删除与我相关', - contentTitle: noticeType === "1" ? '您确定要删除与 xxx 的聊天吗?' : id[0] != 0 ? '您确定要删除这条@我消息吗?' : '您确定要删除选中的' + selectedNum + '条消息吗?', - content: noticeType === "1" ? '此操作将删除与xxx的聊天框和xxx的所有聊天记录,请进行确认以防数据的丢失' : id[0] != 0 ? '此操作将删除这条消息,请进行确认以防数据的丢失' : '此操作将删除选中的' + selectedNum + '条消息,请进行确认以防数据的丢失', + contentTitle: noticeType === "1" ? '您确定要删除与 xxx 的聊天吗?' : id ? '您确定要删除这条@我消息吗?' : '您确定要删除选中的' + selectedNum + '条消息吗?', + content: noticeType === "1" ? '此操作将删除与xxx的聊天框和xxx的所有聊天记录,请进行确认以防数据的丢失' : id ? '此操作将删除这条消息,请进行确认以防数据的丢失' : '此操作将删除选中的' + selectedNum + '条消息,请进行确认以防数据的丢失', onOk: () => { const params = { type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", - ids:id[0]===0?ids:id, + ids:id?id:ids, }; console.log(params); axios.delete(`/users/${current_user.login}/messages.json`,{ data:params, }).then((response)=>{ - console.log(response); + response.status === 0 && getMessageList(); }); - getMessageList(); } }); - } + } return ( @@ -196,7 +196,7 @@ function MyNotice(props) {
     - +
}