From dabe7d655172ade46352c2bdb0b6e060b6036b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Mon, 13 Sep 2021 13:21:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SecuritySetting/notice/myNotice/Index.jsx | 76 +++++++++++-------- .../notice/myNotice/Index.scss | 12 +++ 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index a2d5631b..ffa87ad4 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -5,16 +5,21 @@ import '../manager/Index.scss' import DelModal from '../../../Wiki/components/ModalFun'; import Axios from 'axios'; import { Link } from 'react-router-dom'; +import { CheckboxGroup } from 'rsuite'; function MyNotice(props) { - const [noticeType, setNoticeType] = useState("0"); - const [selectedNum, setSelectedNum] = useState(0); - const [isBatchDelete, setIsBatchDelete] = useState(false); - const [notice_unread_count, setNotice_unread_count] = useState();//未读系统通知数量 - const [letter_unread_count, setLetter_unread_count] = useState(0);//未读私信数量 - const [at_unread_count, setAt_unread_count] = useState();//未读@我数量 - const [message_list, setMessage_list] = useState([]); + const [noticeType, setNoticeType] = useState("2");//消息类别tab栏选择 + const [selectedNum, setSelectedNum] = useState(0);//@我批量删除选择消息条数 + const [isBatchDelete, setIsBatchDelete] = useState(false);//@我是否批量删除 + const [batchDeleteCheckedAll,setBatchDeleteCheckAll] = useState(false);//@我批量删除--全选 + const [batchDeleteList,setBatchDeleteList] = useState(new Set());//@我批量删除--选中 + const [atmeCount,setAtmeCount] = useState(0); + + const [noticeUnreadCount, setNoticeUnreadCount] = useState();//未读系统通知数量 + const [letterUnreadCount, setLetterUnreadCount] = useState(0);//未读私信数量 + const [atUnreadCount, setAtUnreadCount] = useState();//未读@我数量 + const [messageList, setMessageList] = useState([]); const [onlyUnread,setOnlyUnread] = useState(); useEffect(() => { @@ -31,10 +36,15 @@ function MyNotice(props) { Axios.get(`/users/yystopf/messages.json`, { params: params, }).then((response) => { - setNotice_unread_count(response.data.unread_notification); - setAt_unread_count(response.data.unread_atme); - setMessage_list(response.data.messages); + setNoticeUnreadCount(response.data.unread_notification); + setAtUnreadCount(response.data.unread_atme); + setMessageList(response.data.messages); }) + var count = 0; + messageList.map(item=>{ + item.type==="atme"?count++:""; + }) + setAtmeCount(count); } function handleClick(e) { @@ -42,26 +52,27 @@ function MyNotice(props) { if (e.key != "2") { setIsBatchDelete(false); } - } - function onChange() { - var selectedNum = 0; - const checkbox = document.getElementsByClassName("atme-checkbox"); - for (var i = 0; i < checkbox.length; i++) { - checkbox[i].checked ? selectedNum++ : ""; + function onChange(e) { + if(e.target.checked){ + batchDeleteList.has(e.target.name)?"":setBatchDeleteList(batchDeleteList.add(e.target.name)); + }else{ + batchDeleteList.delete(e.target.name); } - document.getElementById("checkAll").checked = selectedNum === checkbox.length; - setSelectedNum(selectedNum === checkbox.length ? checkbox.length : selectedNum); + batchDeleteList.size === atmeCount?setBatchDeleteCheckAll(true):""; + console.log(batchDeleteCheckedAll); } function onCheckAllChange(e) { - const checkbox = document.getElementsByClassName("atme-checkbox"); - for (var i = 0; i < checkbox.length; i++) { - checkbox[i].checked = e.target.checked; - } - setSelectedNum(e.target.checked ? checkbox.length : 0); + // setBatchDeleteList(e.target.checked?) + setBatchDeleteCheckAll(e.target.checked); + // const checkbox = document.getElementsByClassName("atme-checkbox"); + // for (var i = 0; i < checkbox.length; i++) { + // checkbox[i].checked = e.target.checked; + // } + // setSelectedNum(e.target.checked ? checkbox.length : 0); } function deleteNotice() { @@ -79,24 +90,25 @@ function MyNotice(props) {
- 系统通知 + 系统通知 私信 - @我 + @我
- e.target.checked?setOnlyUnread(1):setOnlyUnread(2)}>仅看未读{noticeType === "1" ? `私信(12)` : noticeType==="0"?`消息(${notice_unread_count})`:`消息(${at_unread_count})`} + e.target.checked?setOnlyUnread(1):setOnlyUnread(2)}>仅看未读{noticeType === "1" ? `私信(12)` : noticeType==="0"?`消息(${noticeUnreadCount})`:`消息(${atUnreadCount})`}
{noticeType === "2" ? : ""}
-   - 全选   已选择 {selectedNum} 项 + {/*   */} + 全选 +    已选择 {selectedNum} 项
     @@ -104,7 +116,8 @@ function MyNotice(props) {
- {message_list.map(item => { + + {messageList.map(item => { // 系统消息 // 消息类别 // const iconName = item.source.startsWith("Issue")?"icon-yixiuicon1":item.source.startsWith("Project")?"icon-daimakuicon1":item.source.startsWith("Project")?"icon-daimakuicon1": @@ -127,7 +140,8 @@ function MyNotice(props) { return(
- + {/* */} + {item.status === 1? :} @@ -141,7 +155,7 @@ function MyNotice(props) {
) } - })} + })}
) } diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.scss b/src/forge/SecuritySetting/notice/myNotice/Index.scss index 1a5ee3fb..ef1fef27 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.scss +++ b/src/forge/SecuritySetting/notice/myNotice/Index.scss @@ -209,4 +209,16 @@ button:active { .float-left-little{ margin-right: 10px; +} + +.invisible_checkGroup{ + & .ant-checkbox-inner{ + display: none; + } +} +.notice01{ + & .ant-checkbox-group{ + display: flex; + flex-direction: column; + } } \ No newline at end of file From f30903072edac378808723e04c48ecb364d2cee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Mon, 13 Sep 2021 14:25:52 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SecuritySetting/notice/myNotice/Index.jsx | 137 ++++++++++-------- .../notice/myNotice/Index.scss | 5 +- 2 files changed, 80 insertions(+), 62 deletions(-) diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index ffa87ad4..cdf95afd 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -9,28 +9,28 @@ import { CheckboxGroup } from 'rsuite'; function MyNotice(props) { - const [noticeType, setNoticeType] = useState("2");//消息类别tab栏选择 + const [noticeType, setNoticeType] = useState("0");//消息类别tab栏选择 const [selectedNum, setSelectedNum] = useState(0);//@我批量删除选择消息条数 const [isBatchDelete, setIsBatchDelete] = useState(false);//@我是否批量删除 - const [batchDeleteCheckedAll,setBatchDeleteCheckAll] = useState(false);//@我批量删除--全选 - const [batchDeleteList,setBatchDeleteList] = useState(new Set());//@我批量删除--选中 - const [atmeCount,setAtmeCount] = useState(0); + const [batchDeleteCheckedAll, setBatchDeleteCheckAll] = useState(false);//@我批量删除--全选 + const [batchDeleteList, setBatchDeleteList] = useState([]);//@我批量删除--选中 + const [atmeList, setAtmeList] = useState([]); const [noticeUnreadCount, setNoticeUnreadCount] = useState();//未读系统通知数量 const [letterUnreadCount, setLetterUnreadCount] = useState(0);//未读私信数量 const [atUnreadCount, setAtUnreadCount] = useState();//未读@我数量 const [messageList, setMessageList] = useState([]); - const [onlyUnread,setOnlyUnread] = useState(); + const [onlyUnread, setOnlyUnread] = useState(); useEffect(() => { const params = { - type:noticeType==="0"?"notification":noticeType==="2"?"atme":"", - status:onlyUnread?onlyUnread:"", + type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", + status: onlyUnread ? onlyUnread : "", limit: 20, page: 0, } getMessageList(params); - }, [noticeType,onlyUnread]) + }, [noticeType, onlyUnread]) function getMessageList(params) { Axios.get(`/users/yystopf/messages.json`, { @@ -40,11 +40,13 @@ function MyNotice(props) { setAtUnreadCount(response.data.unread_atme); setMessageList(response.data.messages); }) - var count = 0; - messageList.map(item=>{ - item.type==="atme"?count++:""; + console.log(messageList); + const atmeList = new Array(); + messageList.map(item => { + item.type === "atme" ? atmeList.push(item.id.toString()) : ""; }) - setAtmeCount(count); + setAtmeList(atmeList); + console.log(atmeList); } function handleClick(e) { @@ -54,20 +56,21 @@ function MyNotice(props) { } } - function onChange(e) { - if(e.target.checked){ - batchDeleteList.has(e.target.name)?"":setBatchDeleteList(batchDeleteList.add(e.target.name)); - }else{ - batchDeleteList.delete(e.target.name); - } - batchDeleteList.size === atmeCount?setBatchDeleteCheckAll(true):""; - console.log(batchDeleteCheckedAll); + function onChange(batchDeleteList) { + setBatchDeleteCheckAll(batchDeleteList.length === atmeList.length) + // if(e.target.checked){ + // batchDeleteList.has(e.target.name)?"":setBatchDeleteList(batchDeleteList.add(e.target.name)); + // }else{ + // batchDeleteList.delete(e.target.name); + // } + // batchDeleteList.size === atmeCount?setBatchDeleteCheckAll(true):""; + // console.log(batchDeleteCheckedAll); } function onCheckAllChange(e) { - // setBatchDeleteList(e.target.checked?) setBatchDeleteCheckAll(e.target.checked); + setBatchDeleteList(e.target.checked ? atmeList : []); // const checkbox = document.getElementsByClassName("atme-checkbox"); // for (var i = 0; i < checkbox.length; i++) { // checkbox[i].checked = e.target.checked; @@ -86,6 +89,20 @@ function MyNotice(props) { }); } + function readNotice(id){ + alert("消息已读"); + console.log(id); + const params = { + type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", + ids:[id], + }; + Axios.post(`/users/yystopf/messages/read.json`,{ + params:params, + }).then((response)=>{ + console.log(response); + }) + } + return (
@@ -99,7 +116,7 @@ function MyNotice(props) {
- e.target.checked?setOnlyUnread(1):setOnlyUnread(2)}>仅看未读{noticeType === "1" ? `私信(12)` : noticeType==="0"?`消息(${noticeUnreadCount})`:`消息(${atUnreadCount})`} + e.target.checked ? setOnlyUnread(1) : setOnlyUnread(2)}>仅看未读{noticeType === "1" ? `私信(12)` : noticeType === "0" ? `消息(${noticeUnreadCount})` : `消息(${atUnreadCount})`}
{noticeType === "2" ? : ""}
@@ -107,7 +124,7 @@ function MyNotice(props) {
{/*   */} - 全选 + 全选    已选择 {selectedNum} 项
@@ -117,45 +134,45 @@ function MyNotice(props) {
- {messageList.map(item => { - // 系统消息 - // 消息类别 - // const iconName = item.source.startsWith("Issue")?"icon-yixiuicon1":item.source.startsWith("Project")?"icon-daimakuicon1":item.source.startsWith("Project")?"icon-daimakuicon1": - if(noticeType ==="0" && item.type === "notification"){ - return( -
-
- {item.status === 1? :} - - window.location.href=(`${item.notification_url}`)}>{item.content} + {messageList.map(item => { + // 系统消息 + // 消息类别 + // const iconName = item.source.startsWith("Issue")?"icon-yixiuicon1":item.source.startsWith("Project")?"icon-daimakuicon1":item.source.startsWith("Project")?"icon-daimakuicon1": + if (noticeType === "0" && item.type === "notification") { + return ( +
+
+ {item.status === 1 ? : } + + window.location.href = (`${item.notification_url}`)}>{item.content} +
+
+ {item.time_ago} + {item.status === 1 && 标记为已读} +
-
- {item.time_ago} - 标记为已读 + ) + } else if (noticeType === "2" && item.type === "atme") { + //@我 + return ( +
+
+ {/* */} + + + + {item.status === 1 ? : } + {item.content} + +
+
+ {item.time_ago} + 标记为已读   删除 +
-
- ) - } else if(noticeType ==="2" && item.type === "atme"){ - //@我 - return( -
-
- {/* */} - - - - {item.status === 1? :} - {item.content} - -
-
- {item.time_ago} - 标记为已读   删除 -
-
- ) - } - })} + ) + } + })}
) } diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.scss b/src/forge/SecuritySetting/notice/myNotice/Index.scss index ef1fef27..d8ce6ad0 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.scss +++ b/src/forge/SecuritySetting/notice/myNotice/Index.scss @@ -87,13 +87,14 @@ button:active { background: #F3F4F6; } - & a{ + & .invisable-read{ display: none; } - &:hover a{ + &:hover .invisable-read{ display: block; color: #466AFF; + cursor: pointer; } &:hover .timeSpan{ From c5bb61cb9ae6ed2b8db0ef4fc54f28537cdb816f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Tue, 14 Sep 2021 09:45:53 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/SecuritySetting/Index.jsx | 2 +- .../SecuritySetting/notice/myNotice/Index.jsx | 336 ++++++++++++------ .../notice/myNotice/Index.scss | 31 +- 3 files changed, 247 insertions(+), 122 deletions(-) diff --git a/src/forge/SecuritySetting/Index.jsx b/src/forge/SecuritySetting/Index.jsx index 50f1bb39..65a80048 100644 --- a/src/forge/SecuritySetting/Index.jsx +++ b/src/forge/SecuritySetting/Index.jsx @@ -62,7 +62,7 @@ function Index(props){
  • 消息通知
  • -1 || pathname.indexOf("/settings/notice/privateLetter")>-1 ?"active":""}>我的通知
  • -
  • -1 ?"active":""}>通知管理
  • + {/*
  • -1 ?"active":""}>通知管理
  • */}
  • 安全设置
  • diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index cdf95afd..9a2f9e5b 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -3,37 +3,131 @@ import { Badge, Button, Checkbox, Menu } from 'antd'; import './Index.scss'; import '../manager/Index.scss' import DelModal from '../../../Wiki/components/ModalFun'; -import Axios from 'axios'; +import axios from 'axios'; import { Link } from 'react-router-dom'; -import { CheckboxGroup } from 'rsuite'; function MyNotice(props) { - const [noticeType, setNoticeType] = useState("0");//消息类别tab栏选择 + const [noticeType, setNoticeType] = useState("2");//消息类别tab栏选择 const [selectedNum, setSelectedNum] = useState(0);//@我批量删除选择消息条数 const [isBatchDelete, setIsBatchDelete] = useState(false);//@我是否批量删除 const [batchDeleteCheckedAll, setBatchDeleteCheckAll] = useState(false);//@我批量删除--全选 const [batchDeleteList, setBatchDeleteList] = useState([]);//@我批量删除--选中 - const [atmeList, setAtmeList] = useState([]); + const [atmeIds, setAtmeIds] = useState([]); const [noticeUnreadCount, setNoticeUnreadCount] = useState();//未读系统通知数量 const [letterUnreadCount, setLetterUnreadCount] = useState(0);//未读私信数量 - const [atUnreadCount, setAtUnreadCount] = useState();//未读@我数量 - const [messageList, setMessageList] = useState([]); - const [onlyUnread, setOnlyUnread] = useState(); - - useEffect(() => { - const params = { - type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", - status: onlyUnread ? onlyUnread : "", - limit: 20, - page: 0, + const [atUnreadCount, setAtUnreadCount] = useState(2);//未读@我数量 + const [messageList, setMessageList] = useState([ + { + "id": 1, + "status": 1, + "content": "Atme Message Content 1", + "notification_url": "http://www.baidu.com", + "source": "PullRequestAtme", + "time_ago": "1天前", + "type": "atme", + "sender": { + "id": 5, + "type": "User", + "name": "testforge2", + "login": "testforge2", + "image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png" + } + }, + { + "id": 2, + "status": 0, + "content": "Atme Message Content 2", + "notification_url": "http://www.baidu.com", + "source": "IssueAtme", + "time_ago": "1天前", + "type": "atme", + "sender": { + "id": 4, + "type": "User", + "name": "testforge1", + "login": "testforge1", + "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png" + } + }, + { + "id": 3, + "status": 1, + "content": "Notification Message Content 1", + "notification_url": "http://www.baidu.com", + "source": "IssueDelete", + "time_ago": "1天前", + "type": "notification" + }, + { + "id": 4, + "status": 0, + "content": "Notification Message Content 2", + "notification_url": "http://www.baidu.com", + "source": "IssueChanged", + "time_ago": "1天前", + "type": "notification" + }, + { + "id": 5, + "status": 0, + "content": "Notification Message Content 3", + "notification_url": "http://www.baidu.com", + "source": "ProjectJoined", + "time_ago": "1天前", + "type": "notification" } - getMessageList(params); - }, [noticeType, onlyUnread]) +]); + const [onlyUnread, setOnlyUnread] = useState(); + const noticeType = { + // 易修 + IssueAssigned:1, // 有新指派给我的易修 + IssueAssignerExpire:1, // 我负责的易修截止日期到达最后一天 + IssueAtme:1, // 在易修中@我 + IssueChanged:1, // 我创建或负责的易修状态变更 + IssueCreatorExpire:1, // 我创建的易修截止日期到达最后一天 + IssueDeleted:1, // 我创建或负责的易修删除 + IssueJournal:1, // 我创建或负责的易修有新的评论 + //平台通知 + LoginIpTip:2, //登录异常提示 + //个人状态类通知 + OrganizationJoined:3, // 账号被拉入组织 + OrganizationLeft:3, // 账号被移出组织 + rganizationRole:3, // 账号组织权限变更 + ProjectJoined:3, // 账号被拉入项目 + ProjectLeft:3, // 账号被移出项目 + ProjectRole:3, // 账号仓库权限变更 + //其他仓库通知 + ProjectDelete:4, // 我关注的仓库被删除 + ProjectFollowed:4, // 我管理的仓库被关注 + ProjectForked:4, // 我管理的仓库被复刻 + ProjectIssue:4, // 我管理/关注的仓库有新的易修 + ProjectSettingChanged:4, // 我管理的仓库项目设置被更改 + ProjectTransfer:4, // 我关注的仓库被转移 + ProjectVersion:4, // 我关注的仓库有新的发行版 + //合并请求类通知 + ProjectPullRequest:5, // 我管理/关注的仓库有新的合并请求 + PullRequestAssigned:5, // 有新指派给我的合并请求 + PullReuqestAtme:5, // 在合并请求中@我 + PullRequestChanged:5, // 我创建或负责的合并请求状态变更 + PullRequestJournal:5, // 我创建或负责的合并请求有新的评论 + //里程碑 + ProjectMilestone:6, // 我管理的仓库有新的里程碑 + }; + + // useEffect(() => { + // const params = { + // type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", + // status: onlyUnread ? onlyUnread : "", + // limit: 20, + // page: 0, + // } + // getMessageList(params); + // }, [noticeType, onlyUnread]) function getMessageList(params) { - Axios.get(`/users/yystopf/messages.json`, { + axios.get(`/users/yystopf/messages.json`, { params: params, }).then((response) => { setNoticeUnreadCount(response.data.unread_notification); @@ -41,12 +135,23 @@ function MyNotice(props) { setMessageList(response.data.messages); }) console.log(messageList); - const atmeList = new Array(); - messageList.map(item => { - item.type === "atme" ? atmeList.push(item.id.toString()) : ""; - }) - setAtmeList(atmeList); - console.log(atmeList); + //@我消息列表ids + const atmeIds = new Array(); + } + + function readNotice(id){ + if(id){ + const params = { + type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", + ids:id, + }; + console.log(params); + axios.post(`/users/yystopf/messages/read.json`,{ + params:params, + }).then((response)=>{ + console.log(response); + }) + } } function handleClick(e) { @@ -56,62 +161,64 @@ function MyNotice(props) { } } - function onChange(batchDeleteList) { - setBatchDeleteCheckAll(batchDeleteList.length === atmeList.length) - // if(e.target.checked){ - // batchDeleteList.has(e.target.name)?"":setBatchDeleteList(batchDeleteList.add(e.target.name)); - // }else{ - // batchDeleteList.delete(e.target.name); - // } - // batchDeleteList.size === atmeCount?setBatchDeleteCheckAll(true):""; - // console.log(batchDeleteCheckedAll); - } - - - function onCheckAllChange(e) { - setBatchDeleteCheckAll(e.target.checked); - setBatchDeleteList(e.target.checked ? atmeList : []); - // const checkbox = document.getElementsByClassName("atme-checkbox"); - // for (var i = 0; i < checkbox.length; i++) { - // checkbox[i].checked = e.target.checked; - // } - // setSelectedNum(e.target.checked ? checkbox.length : 0); - } - - function deleteNotice() { - DelModal({ - title: noticeType === "1" ? '删除私信' : '删除与我相关', - contentTitle: noticeType === "1" ? '您确定要删除与 xxx 的聊天吗?' : selectedNum === 0 ? '您确定要删除这条@我消息吗?' : '您确定要删除选中的' + selectedNum + '条消息吗?', - content: noticeType === "1" ? '此操作将删除与xxx的聊天框和xxx的所有聊天记录,请进行确认以防数据的丢失' : selectedNum === 0 ? '此操作将删除这条消息,请进行确认以防数据的丢失' : '此操作将删除选中的' + selectedNum + '条消息,请进行确认以防数据的丢失', - onOk: () => { - + function onChange(e) { + var checkboxNum = 0; + let messageListNew=messageList.slice(); + messageListNew.map((item)=>{ + if(item.id===e.target.value){ + item.checkedBatch = e.target.checked; } + item.checkedBatch?checkboxNum++:""; }); + setMessageList(messageListNew); + setSelectedNum(checkboxNum); + setBatchDeleteCheckAll(checkboxNum === atUnreadCount); } - function readNotice(id){ - alert("消息已读"); - console.log(id); - const params = { - type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", - ids:[id], - }; - Axios.post(`/users/yystopf/messages/read.json`,{ - params:params, - }).then((response)=>{ - console.log(response); - }) + + function onChangeAll(e) { + setBatchDeleteCheckAll(e.target.checked); + setSelectedNum(e.target.checked?messageList.length:0); + let messageListNew=messageList.slice(); + messageListNew.map((item)=>{ + item.checkedBatch = e.target.checked; + }); + setMessageList(messageListNew); } + function deleteNotice(id) { + if(id){ + DelModal({ + title: noticeType === "1" ? '删除私信' : '删除与我相关', + contentTitle: noticeType === "1" ? '您确定要删除与 xxx 的聊天吗?' : id[0] != -1 ? '您确定要删除这条@我消息吗?' : '您确定要删除选中的' + selectedNum + '条消息吗?', + content: noticeType === "1" ? '此操作将删除与xxx的聊天框和xxx的所有聊天记录,请进行确认以防数据的丢失' : id[0] != -1 ? '此操作将删除这条消息,请进行确认以防数据的丢失' : '此操作将删除选中的' + selectedNum + '条消息,请进行确认以防数据的丢失', + onOk: () => { + const params = { + type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", + ids:id, + }; + // console.log(params); + axios.delete(`/users/yystopf/messages.json`,{ + data:params, + }).then((response)=>{ + // console.log(response); + }) + } + }); + } + } + + + return (
    系统通知 - 私信 + {/* 私信 */} @我 - +
    @@ -123,56 +230,71 @@ function MyNotice(props) {
    - {/*   */} - 全选 + {/*   */} + 全选    已选择 {selectedNum} 项
         - +
    - - {messageList.map(item => { - // 系统消息 - // 消息类别 - // const iconName = item.source.startsWith("Issue")?"icon-yixiuicon1":item.source.startsWith("Project")?"icon-daimakuicon1":item.source.startsWith("Project")?"icon-daimakuicon1": - if (noticeType === "0" && item.type === "notification") { - return ( -
    -
    - {item.status === 1 ? : } - - window.location.href = (`${item.notification_url}`)}>{item.content} -
    -
    - {item.time_ago} - {item.status === 1 && 标记为已读} -
    + {messageList.map(item => { + // 系统消息 + // 消息类别 + // const iconName = item.source.startsWith("Issue")?"icon-yixiuicon1":item.source.startsWith("Project")?"icon-daimakuicon1":item.source.startsWith("Project")?"icon-daimakuicon1": + if (noticeType === "0" && item.type === "notification") { + return ( +
    +
    + {item.status === 1 ? : } + + window.location.href = (`${item.notification_url}`)}>{item.content}
    - ) - } else if (noticeType === "2" && item.type === "atme") { - //@我 - return ( -
    -
    - {/* */} - - - - {item.status === 1 ? : } - {item.content} - -
    -
    - {item.time_ago} - 标记为已读   删除 -
    +
    + {item.time_ago} + {item.status === 1 && readNotice([item.id])}>标记为已读}
    - ) - } - })} +
    + ) + } else if (noticeType === "2" && item.type === "atme") { + //@我 + return ( +
    +
    + {/* */} + + + + {item.status === 1 ? : } + {item.content} + +
    +
    + {item.time_ago} + {item.status === 1 && readNotice([item.id])}>标记为已读}    + deleteNotice([item.id])}>删除 +
    +
    + ) + } + })} + + {/* 私信 */} + {/*
    + +
    +
    + 蒋宇航 + 4分钟前 + 删除 +
    +
    props.history.push('/settings/notice/privateLetter')}> + 最好的OpenStack控制台,对标OpenStack社区Horizon项目,最好的OpenStack控制台,对标OpenStack社区Horizon项目,在易用性、页面性能等方面进行深度优化,提供简单控制台。 +
    +
    +
    */}
    ) } diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.scss b/src/forge/SecuritySetting/notice/myNotice/Index.scss index d8ce6ad0..2632f62b 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.scss +++ b/src/forge/SecuritySetting/notice/myNotice/Index.scss @@ -6,7 +6,7 @@ } .ant-menu-item{ padding:0px; - // margin-right:34px!important; + margin-right:34px!important; height: 34px; width: 64px; text-align: center; @@ -129,9 +129,12 @@ button:active { .mynotice-cont{ padding:0; - & .atme-checkbox{ + & .visible-checkbox{ margin-right: 10px; } + & .invisible-checkbox{ + display: none; + } } & .ant-badge-count, .ant-badge-dot, .ant-badge .ant-scroll-number-custom-component { @@ -197,7 +200,7 @@ button:active { .at-length{ max-width: 48rem; - margin-left: 18px; + margin-left: 12px; } #numberSpan{ color: #466AFF; @@ -212,14 +215,14 @@ button:active { margin-right: 10px; } -.invisible_checkGroup{ - & .ant-checkbox-inner{ - display: none; - } -} -.notice01{ - & .ant-checkbox-group{ - display: flex; - flex-direction: column; - } -} \ No newline at end of file +// .invisible_checkGroup{ +// & .ant-checkbox-inner{ +// display: none; +// } +// } +// .notice01{ +// & .ant-checkbox-group{ +// display: flex; +// flex-direction: column; +// } +// } \ No newline at end of file From 7fbd76630c349f6ee3ac1586c63e0099ec4634b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Tue, 14 Sep 2021 16:02:22 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Nodata.js | 2 +- .../SecuritySetting/notice/myNotice/Index.jsx | 263 ++++++++---------- .../notice/myNotice/Index.scss | 28 +- 3 files changed, 141 insertions(+), 152 deletions(-) diff --git a/src/forge/Nodata.js b/src/forge/Nodata.js index 3147e560..ccc74ac5 100644 --- a/src/forge/Nodata.js +++ b/src/forge/Nodata.js @@ -1,7 +1,7 @@ import React , { Component } from 'react'; import nodata from './Images/nodata.png'; - +import './css/index.scss'; class Nodata extends Component{ render(){ const { _html , small } = this.props; diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index 9a2f9e5b..967ba0bf 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -1,142 +1,95 @@ import React, { useState, useEffect } from 'react'; -import { Badge, Button, Checkbox, Menu } from 'antd'; +import { Badge, Button, Checkbox, Menu, Pagination } from 'antd'; import './Index.scss'; import '../manager/Index.scss' import DelModal from '../../../Wiki/components/ModalFun'; import axios from 'axios'; import { Link } from 'react-router-dom'; +import NoneData from '../../../Nodata.js'; function MyNotice(props) { + let current_user = props.current_user; + let pageSize = 20; const [noticeType, setNoticeType] = useState("2");//消息类别tab栏选择 const [selectedNum, setSelectedNum] = useState(0);//@我批量删除选择消息条数 const [isBatchDelete, setIsBatchDelete] = useState(false);//@我是否批量删除 const [batchDeleteCheckedAll, setBatchDeleteCheckAll] = useState(false);//@我批量删除--全选 - const [batchDeleteList, setBatchDeleteList] = useState([]);//@我批量删除--选中 - const [atmeIds, setAtmeIds] = useState([]); const [noticeUnreadCount, setNoticeUnreadCount] = useState();//未读系统通知数量 - const [letterUnreadCount, setLetterUnreadCount] = useState(0);//未读私信数量 - const [atUnreadCount, setAtUnreadCount] = useState(2);//未读@我数量 - const [messageList, setMessageList] = useState([ - { - "id": 1, - "status": 1, - "content": "Atme Message Content 1", - "notification_url": "http://www.baidu.com", - "source": "PullRequestAtme", - "time_ago": "1天前", - "type": "atme", - "sender": { - "id": 5, - "type": "User", - "name": "testforge2", - "login": "testforge2", - "image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png" - } - }, - { - "id": 2, - "status": 0, - "content": "Atme Message Content 2", - "notification_url": "http://www.baidu.com", - "source": "IssueAtme", - "time_ago": "1天前", - "type": "atme", - "sender": { - "id": 4, - "type": "User", - "name": "testforge1", - "login": "testforge1", - "image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png" - } - }, - { - "id": 3, - "status": 1, - "content": "Notification Message Content 1", - "notification_url": "http://www.baidu.com", - "source": "IssueDelete", - "time_ago": "1天前", - "type": "notification" - }, - { - "id": 4, - "status": 0, - "content": "Notification Message Content 2", - "notification_url": "http://www.baidu.com", - "source": "IssueChanged", - "time_ago": "1天前", - "type": "notification" - }, - { - "id": 5, - "status": 0, - "content": "Notification Message Content 3", - "notification_url": "http://www.baidu.com", - "source": "ProjectJoined", - "time_ago": "1天前", - "type": "notification" - } -]); + // const [letterUnreadCount, setLetterUnreadCount] = useState(0);//未读私信数量 + const [atUnreadCount, setAtUnreadCount] = useState();//未读@我数量 + const [messageList, setMessageList] = useState([]); + const [messTotalCount, setMessTotalCount] = useState();//消息总数 + const [currentPage, setCurrentPage] = useState(1);//当前页数 const [onlyUnread, setOnlyUnread] = useState(); - const noticeType = { + const noticeSourceType = { // 易修 - IssueAssigned:1, // 有新指派给我的易修 - IssueAssignerExpire:1, // 我负责的易修截止日期到达最后一天 - IssueAtme:1, // 在易修中@我 - IssueChanged:1, // 我创建或负责的易修状态变更 - IssueCreatorExpire:1, // 我创建的易修截止日期到达最后一天 - IssueDeleted:1, // 我创建或负责的易修删除 - IssueJournal:1, // 我创建或负责的易修有新的评论 + IssueAssigned:"icon-yixiuicon1", // 有新指派给我的易修 + IssueAssignerExpire:"icon-yixiuicon1", // 我负责的易修截止日期到达最后一天 + IssueAtme:"icon-yixiuicon1", // 在易修中@我 + IssueChanged:"icon-yixiuicon1", // 我创建或负责的易修状态变更 + IssueCreatorExpire:"icon-yixiuicon1", // 我创建的易修截止日期到达最后一天 + IssueDelete:"icon-yixiuicon1", // 我创建或负责的易修删除 + IssueDeleted:"icon-yixiuicon1", // 我创建或负责的易修删除 + IssueJournal:"icon-yixiuicon1", // 我创建或负责的易修有新的评论 //平台通知 - LoginIpTip:2, //登录异常提示 + LoginIpTip:"icon-xitongtongzhiicon", //登录异常提示 //个人状态类通知 - OrganizationJoined:3, // 账号被拉入组织 - OrganizationLeft:3, // 账号被移出组织 - rganizationRole:3, // 账号组织权限变更 - ProjectJoined:3, // 账号被拉入项目 - ProjectLeft:3, // 账号被移出项目 - ProjectRole:3, // 账号仓库权限变更 + OrganizationJoined:"icon-xiaoxi2", // 账号被拉入组织 + OrganizationLeft:"icon-xiaoxi2", // 账号被移出组织 + rganizationRole:"icon-xiaoxi2", // 账号组织权限变更 + ProjectJoined:"icon-xiaoxi2", // 账号被拉入项目 + ProjectLeft:"icon-xiaoxi2", // 账号被移出项目 + ProjectRole:"icon-xiaoxi2", // 账号仓库权限变更 //其他仓库通知 - ProjectDelete:4, // 我关注的仓库被删除 - ProjectFollowed:4, // 我管理的仓库被关注 - ProjectForked:4, // 我管理的仓库被复刻 - ProjectIssue:4, // 我管理/关注的仓库有新的易修 - ProjectSettingChanged:4, // 我管理的仓库项目设置被更改 - ProjectTransfer:4, // 我关注的仓库被转移 - ProjectVersion:4, // 我关注的仓库有新的发行版 + ProjectDelete:"icon-daimakuicon1", // 我关注的仓库被删除 + ProjectFollowed:"icon-daimakuicon1", // 我管理的仓库被关注 + ProjectForked:"icon-daimakuicon1", // 我管理的仓库被复刻 + ProjectIssue:"icon-daimakuicon1", // 我管理/关注的仓库有新的易修 + ProjectSettingChanged:"icon-daimakuicon1", // 我管理的仓库项目设置被更改 + ProjectTransfer:"icon-daimakuicon1", // 我关注的仓库被转移 + ProjectVersion:"icon-daimakuicon1", // 我关注的仓库有新的发行版 + ProjectMemberJoined:"icon-daimakuicon1", // 我管理的仓库有成员加入 + ProjectMemberLeft:"icon-daimakuicon1", // 我管理的仓库有成员移出 + ProjectPraised:"icon-daimakuicon1", // 我管理的仓库被点赞 //合并请求类通知 - ProjectPullRequest:5, // 我管理/关注的仓库有新的合并请求 - PullRequestAssigned:5, // 有新指派给我的合并请求 - PullReuqestAtme:5, // 在合并请求中@我 - PullRequestChanged:5, // 我创建或负责的合并请求状态变更 - PullRequestJournal:5, // 我创建或负责的合并请求有新的评论 + ProjectPullRequest:"icon-hebingqingqiuicon", // 我管理/关注的仓库有新的合并请求 + PullRequestAssigned:"icon-hebingqingqiuicon", // 有新指派给我的合并请求 + PullRequestAtme:"icon-hebingqingqiuicon", // 在合并请求中@我 + PullRequestChanged:"icon-hebingqingqiuicon", // 我创建或负责的合并请求状态变更 + PullRequestJournal:"icon-hebingqingqiuicon", // 我创建或负责的合并请求有新的评论 //里程碑 - ProjectMilestone:6, // 我管理的仓库有新的里程碑 + ProjectMilestone:"icon-lichengbeiicon", // 我管理的仓库有新的里程碑 }; - // useEffect(() => { - // const params = { - // type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", - // status: onlyUnread ? onlyUnread : "", - // limit: 20, - // page: 0, - // } - // getMessageList(params); - // }, [noticeType, onlyUnread]) + useEffect(() => { + // const params = { + // type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", + // status: onlyUnread ? onlyUnread : "", + // limit: pageSize, + // page: currentPage, + // } + getMessageList(); + }, [noticeType, onlyUnread, currentPage]) - function getMessageList(params) { - axios.get(`/users/yystopf/messages.json`, { + function getMessageList() { + const params = { + type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", + status: onlyUnread ? onlyUnread : "", + limit: pageSize, + page: currentPage, + }; + axios.get(`/users/${current_user.login}/messages.json`, { params: params, }).then((response) => { - setNoticeUnreadCount(response.data.unread_notification); - setAtUnreadCount(response.data.unread_atme); - setMessageList(response.data.messages); - }) - console.log(messageList); - //@我消息列表ids - const atmeIds = new Array(); + if(response && response.data){ + setNoticeUnreadCount(response.data.unread_notification); + setAtUnreadCount(response.data.unread_atme); + setMessageList(response.data.messages); + setMessTotalCount(response.data.total_count); + } + }); } function readNotice(id){ @@ -145,17 +98,15 @@ function MyNotice(props) { type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", ids:id, }; - console.log(params); - axios.post(`/users/yystopf/messages/read.json`,{ - params:params, - }).then((response)=>{ - console.log(response); - }) + axios.post(`/users/${current_user.login}/messages/read.json`,params); + getMessageList; } } function handleClick(e) { setNoticeType(e.key); + setCurrentPage(1); + setOnlyUnread(); if (e.key != "2") { setIsBatchDelete(false); } @@ -172,7 +123,7 @@ function MyNotice(props) { }); setMessageList(messageListNew); setSelectedNum(checkboxNum); - setBatchDeleteCheckAll(checkboxNum === atUnreadCount); + setBatchDeleteCheckAll(checkboxNum === messageList.length); } @@ -187,29 +138,36 @@ 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):""; + }) + } + console.log(ids); if(id){ DelModal({ title: noticeType === "1" ? '删除私信' : '删除与我相关', - contentTitle: noticeType === "1" ? '您确定要删除与 xxx 的聊天吗?' : id[0] != -1 ? '您确定要删除这条@我消息吗?' : '您确定要删除选中的' + selectedNum + '条消息吗?', - content: noticeType === "1" ? '此操作将删除与xxx的聊天框和xxx的所有聊天记录,请进行确认以防数据的丢失' : id[0] != -1 ? '此操作将删除这条消息,请进行确认以防数据的丢失' : '此操作将删除选中的' + selectedNum + '条消息,请进行确认以防数据的丢失', + contentTitle: noticeType === "1" ? '您确定要删除与 xxx 的聊天吗?' : id[0] != 0 ? '您确定要删除这条@我消息吗?' : '您确定要删除选中的' + selectedNum + '条消息吗?', + content: noticeType === "1" ? '此操作将删除与xxx的聊天框和xxx的所有聊天记录,请进行确认以防数据的丢失' : id[0] != 0 ? '此操作将删除这条消息,请进行确认以防数据的丢失' : '此操作将删除选中的' + selectedNum + '条消息,请进行确认以防数据的丢失', onOk: () => { const params = { type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", - ids:id, + ids:id[0]===0?ids:id, }; - // console.log(params); - axios.delete(`/users/yystopf/messages.json`,{ + console.log(params); + axios.delete(`/users/${current_user.login}/messages.json`,{ data:params, }).then((response)=>{ - // console.log(response); - }) + console.log(response); + }); + getMessageList(); } }); } } - - return (
    @@ -223,12 +181,14 @@ function MyNotice(props) {
    - e.target.checked ? setOnlyUnread(1) : setOnlyUnread(2)}>仅看未读{noticeType === "1" ? `私信(12)` : noticeType === "0" ? `消息(${noticeUnreadCount})` : `消息(${atUnreadCount})`} + e.target.checked ? setOnlyUnread(1) : setOnlyUnread()}>仅看未读{noticeType === "1" ? `私信(12)` : noticeType === "0" ? `消息(${noticeUnreadCount})` : `消息(${atUnreadCount})`}
    - {noticeType === "2" ? : ""} + {noticeType === "2" && messageList.length > 0 ? : ""}
    -
    + {messageList.length===0 ? :""} + + {messageList && messageList.length>0 &&
    {/*   */} 全选 @@ -236,21 +196,20 @@ function MyNotice(props) {
         - +
    -
    +
    } {messageList.map(item => { // 系统消息 - // 消息类别 - // const iconName = item.source.startsWith("Issue")?"icon-yixiuicon1":item.source.startsWith("Project")?"icon-daimakuicon1":item.source.startsWith("Project")?"icon-daimakuicon1": - if (noticeType === "0" && item.type === "notification") { + if (noticeType === "0") { + // 消息类别 return (
    -
    +
    {item.status === 1 ? : } - - window.location.href = (`${item.notification_url}`)}>{item.content} + + window.open("https://"+`${item.notification_url}`)}>{item.content}
    {item.time_ago} @@ -258,29 +217,41 @@ function MyNotice(props) {
    ) - } else if (noticeType === "2" && item.type === "atme") { + } else if (noticeType === "2") { //@我 return (
    {/* */} - - - {item.status === 1 ? : } - {item.content} - + {item.sender && } +
    +
    {item.status === 1 ? : }
    +
    {item.content}
    +
    {item.time_ago} {item.status === 1 && readNotice([item.id])}>标记为已读}    - deleteNotice([item.id])}>删除 + deleteNotice([item.id])}>删除
    ) } })} + {/* 分页 */} +
    + {setCurrentPage(page)}} + total = {messTotalCount} + hideOnSinglePage + > +
    + {/* 私信 */} {/*
    diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.scss b/src/forge/SecuritySetting/notice/myNotice/Index.scss index 2632f62b..b4a02b35 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.scss +++ b/src/forge/SecuritySetting/notice/myNotice/Index.scss @@ -82,7 +82,6 @@ button:active { padding: 15px 0 15px 10px; border-bottom: 1px solid #EEEEEE; color: #333333; - &:hover{ background: #F3F4F6; } @@ -135,6 +134,18 @@ button:active { & .invisible-checkbox{ display: none; } + .atme-notice-text{ + position: relative; + margin-left: 12px; + max-width: 48rem; + & .at-badge{ + position:absolute; + } + + & .highlightSpan{ + margin-left: 12px; + } + } } & .ant-badge-count, .ant-badge-dot, .ant-badge .ant-scroll-number-custom-component { @@ -198,10 +209,7 @@ button:active { max-width: 52rem; } -.at-length{ - max-width: 48rem; - margin-left: 12px; -} + #numberSpan{ color: #466AFF; } @@ -211,10 +219,20 @@ button:active { align-items: center; } +.stretch-style{ + display: flex; + align-items: baseline; +} + .float-left-little{ margin-right: 10px; } +.paging{ + float: right; + margin: 12px; +} + // .invisible_checkGroup{ // & .ant-checkbox-inner{ // display: none; From 9ea8ec422d122163917e86423b10a093979ed24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Tue, 14 Sep 2021 16:18:31 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SecuritySetting/notice/myNotice/Index.jsx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index 967ba0bf..bb19a60f 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) {
         - +
    }