- {/* 系统消息 */}
- {noticeType==="0"?notice_unread_list.length>0?notice_unread_list.map(item=>{
- let contentStr = item.content.endsWith("") && item.content.length>=50 && item.content.replace("","").substr(0,40)+"...";
- let iconName = item.type===1?"icon-xitongtongzhiicon":item.type===2?"icon-xiaoxi2":item.type===3?"icon-yixiuicon1":item.type===4?"icon-hebingqingqiuicon":item.type===5?"icon-lichengbeiicon":"icon-daimakuicon1";
- return(
-
-
=30 && item.content.length<=34?'65px':""}}>
-
-
-
-
=48?item.content.substr(0,48)+"...":item.content}}>
-
{item.create_time?timeAgo(item.create_time):"刚刚"}
+ {message_list.map(item=>{
+ // 系统消息
+ if(noticeType ==="0" && item.type === "notification" && item.status===1){
+ let contentStr = item.content.endsWith("") && item.content.length>=50 && item.content.replace("","").substr(0,40)+"...";
+ // let iconName = item.type===1?"icon-xitongtongzhiicon":item.type===2?"icon-xiaoxi2":item.type===3?"icon-yixiuicon1":item.type===4?"icon-hebingqingqiuicon":item.type===5?"icon-lichengbeiicon":"icon-daimakuicon1";
+ return(
+
+
30 && item.content.length<=34?'65px':""}}>
+
+
+
+ =48?item.content.substr(0,48)+"...":item.content}}>
+ {item.time_ago}
+
+
-
-
- )
- }):"暂无数据":""}
+ )
+ }else if(noticeType ==="2" && item.type === "atme" && item.status===1){
+ // @我
+ return(
+
+
30 && item.content.length<=42?'65px':""}}>
+
+
+ =56?item.content.substr(0,56)+"...@我":item.content}}>
+ {item.time_ago}
+
+
+
+ )
+ }
+ })}
{/* 私信 */}
{noticeType==="1"?letter_unread_list.length>0?letter_unread_list.map(item=>{
@@ -220,59 +145,6 @@ function NoticeContent(props) {
)
}):"暂无数据":""}
-
- {/* @我 */}
- {noticeType==="2"?at_unread_list.length>0?at_unread_list.map(item=>{
- return(
-
-
=30 && item.content.length<=42?'65px':""}}>
-
-
- {/* {item.name} */}
- =56?item.content.substr(0,56)+"...@我":item.content}}>
- {item.create_time?timeAgo(item.create_time):"刚刚"}
-
-
-
- )
- }):"暂无数据":""}
-
- {/*
-
- {noticeType === "0" ?
: ""}
-
- 蒋宇航:
- 最好的OpenStack控制台,对标Open社区项目Horizon,在易...
- 4分钟前
-
-
-
-
- {noticeType === "0" ?
: ""}
-
- 蒋宇航:
- 最好的OpenStack控制台,对标Open社区项目Horizon,在易...
- 4分钟前
-
-
-
-
- {noticeType === "0" ?
: ""}
-
- 蒋宇航:
- 最好的OpenStack控制台,对标Open社区项目Horizon,在易...
- 4分钟前
-
-
-
-
- {noticeType === "0" ?
: ""}
-
- 蒋宇航:
- 最好的OpenStack控制台,对标Open社区项目Horizon,在易...
- 4分钟前
-
-
*/}
全部消息
diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx
index 9badf448b..a2d5631b9 100644
--- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx
+++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx
@@ -3,23 +3,51 @@ 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 { Link } from 'react-router-dom';
function MyNotice(props) {
- const [noticeType, setNoticeType] = useState("2");
+ 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 [onlyUnread,setOnlyUnread] = useState();
+
+ 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`, {
+ params: params,
+ }).then((response) => {
+ setNotice_unread_count(response.data.unread_notification);
+ setAt_unread_count(response.data.unread_atme);
+ setMessage_list(response.data.messages);
+ })
+ }
function handleClick(e) {
setNoticeType(e.key);
if (e.key != "2") {
setIsBatchDelete(false);
}
+
}
function onChange() {
var selectedNum = 0;
- const checkbox = document.getElementsByClassName("checkbox");
+ const checkbox = document.getElementsByClassName("atme-checkbox");
for (var i = 0; i < checkbox.length; i++) {
checkbox[i].checked ? selectedNum++ : "";
}
@@ -29,7 +57,7 @@ function MyNotice(props) {
function onCheckAllChange(e) {
- const checkbox = document.getElementsByClassName("checkbox");
+ const checkbox = document.getElementsByClassName("atme-checkbox");
for (var i = 0; i < checkbox.length; i++) {
checkbox[i].checked = e.target.checked;
}
@@ -51,16 +79,16 @@ function MyNotice(props) {
-
+
- 仅看未读{noticeType === "1" ? "私信" : "消息"}(12)
+ e.target.checked?setOnlyUnread(1):setOnlyUnread(2)}>仅看未读{noticeType === "1" ? `私信(12)` : noticeType==="0"?`消息(${notice_unread_count})`:`消息(${at_unread_count})`}
{noticeType === "2" ?
: ""}
@@ -71,99 +99,49 @@ function MyNotice(props) {
全选 已选择
{selectedNum} 项
-
-
+
+
- {noticeType === "1" ?
-
-
-
-
-
蒋宇航
-
4分钟前
-
删除
+ {message_list.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}
+
标记为已读
+
-
props.history.push('/settings/notice/privateLetter')}>
-
最好的OpenStack控制台,对标OpenStack社区Horizon项目,最好的OpenStack控制台,对标OpenStack社区Horizon项目,在易用性、页面性能等方面进行深度优化,提供简单控制台。
+ )
+ } else if(noticeType ==="2" && item.type === "atme"){
+ //@我
+ return(
+
+
+
+
+
+ {item.status === 1? :}
+ {item.content}
+
+
+
-
-
- :
-
-
- {/* 系统通知 */}
- {noticeType === "0" ?
: ""}
- {noticeType === "0" ?
: ""}
- {noticeType === "2" ?
: ""}
- {/* {noticeType === "2" ?
: ""} */}
-
{noticeType === "2" ? : ""}蒋宇航在Gitlink/Gitlink新建易修:【Bug】链接地址错误
-
-
-
4分钟前
-
标记为已读 {noticeType === "0" ? "" :
删除}
-
-
}
-
- {noticeType === "1" ?
-
-
-
-
-
- gitlink平台 react 前端代码
-
-
-
- :
-
-
- {/* 系统通知 */}
- {noticeType === "0" ?
: ""}
- {noticeType === "0" ?
: ""}
- {noticeType === "2" ?
: ""}
- {/* {noticeType === "2" ?
: ""} */}
-
{noticeType === "2" ? : ""}蒋宇航在蒋宇航/软件工程课程协同开发案例指派给你一个合并请求:请进行合并请求test请进行合并请求test请进行合并请求test请进行合并请求test请进行合并请求test请进行合并请求test
-
-
-
10分钟前
-
标记为已读 {noticeType === "0" ? "" :
删除}
-
-
}
-
- {noticeType === "1" ?
-
-
-
-
-
- 构建卷积神经网络,训练模型,预测模型效果。
-
-
-
- :
-
-
- {/* 系统通知 */}
- {noticeType === "0" ?
: ""}
- {noticeType === "0" ?
: ""}
- {noticeType === "2" ?
: ""}
-
你关注的仓库王涛/协同案例分析已被删除
-
-
-
1小时前
-
标记为已读 {noticeType === "0" ? "" :
删除}
-
-
}
+ )
+ }
+ })}
)
}
diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.scss b/src/forge/SecuritySetting/notice/myNotice/Index.scss
index 69f5e1a7f..1a5ee3fb7 100644
--- a/src/forge/SecuritySetting/notice/myNotice/Index.scss
+++ b/src/forge/SecuritySetting/notice/myNotice/Index.scss
@@ -127,11 +127,9 @@ button:active {
.mynotice-cont{
padding:0;
- position: relative;
- & .at-badge{
- position: absolute;
- left: 50px;
+ & .atme-checkbox{
+ margin-right: 10px;
}
}
@@ -143,6 +141,10 @@ button:active {
min-width: 8px;
height: 8px;
}
+
+ & .system-notice-blank{
+ margin-right: 14px;
+ }
}
.baselineDiv{
@@ -159,6 +161,7 @@ button:active {
height: 30px;
padding: 0 10px;
color: #333333;
+ margin-bottom: 5px;
button{
padding:0px 12px;
}
@@ -193,7 +196,7 @@ button:active {
.at-length{
max-width: 48rem;
- margin-left: 22px;
+ margin-left: 18px;
}
#numberSpan{
color: #466AFF;