我的通知
This commit is contained in:
parent
7fbd76630c
commit
9ea8ec422d
|
@ -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);
|
||||
});
|
||||
getMessageList();
|
||||
}
|
||||
response.status === 0 && getMessageList();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -196,7 +196,7 @@ function MyNotice(props) {
|
|||
</div>
|
||||
<div>
|
||||
<button onClick={() => { setIsBatchDelete(false); setSelectedNum(0); }}>取消</button>
|
||||
<button className="deleteBut" onClick={selectedNum > 0 ? ()=>deleteNotice([0]) : () => { }}>删除</button>
|
||||
<button className="deleteBut" onClick={selectedNum > 0 ? ()=>deleteNotice() : () => { }}>删除</button>
|
||||
</div>
|
||||
</div>}
|
||||
|
||||
|
|
Loading…
Reference in New Issue