Merge pull request '我的通知' (#24) from durian/forgeplus-react:feature_notification_xiesi into feature_notification
This commit is contained in:
commit
993b1bde40
|
@ -369,7 +369,6 @@ class NewHeader extends Component {
|
||||||
|
|
||||||
let search_url = settings && settings.common && settings.common.search;
|
let search_url = settings && settings.common && settings.common.search;
|
||||||
let notice_url = settings && settings.common && settings.common.notice;
|
let notice_url = settings && settings.common && settings.common.notice;
|
||||||
console.log(current_user);
|
|
||||||
return (
|
return (
|
||||||
<div className="newHeaders" id="nHeader">
|
<div className="newHeaders" id="nHeader">
|
||||||
<div className="headerContent">
|
<div className="headerContent">
|
||||||
|
@ -448,11 +447,11 @@ class NewHeader extends Component {
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onVisibleChange={this.handleVisibleChange}
|
onVisibleChange={this.handleVisibleChange}
|
||||||
>
|
>
|
||||||
<a className="message-icon" href={`/settings/notice`}>
|
<Link to={{pathname:"/settings/notice",state:{noticeType:"notification"}}} className="message-icon">
|
||||||
<Badge count={current_user.message_unread_total}>
|
<Badge count={current_user.message_unread_total}>
|
||||||
<i className="iconfont icon-xiaoxilingdang color-grey-6 ml15 mr15"></i>
|
<i className="iconfont icon-xiaoxilingdang color-grey-6 ml15 mr15"></i>
|
||||||
</Badge>
|
</Badge>
|
||||||
</a>
|
</Link>
|
||||||
</Popover>
|
</Popover>
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user:
|
||||||
const [atPage, setAtPage] = useState(0);
|
const [atPage, setAtPage] = useState(0);
|
||||||
const [atUnreadList, setAtUnreadList] = useState([]);//未读@我列表
|
const [atUnreadList, setAtUnreadList] = useState([]);//未读@我列表
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
resetUserInfo();
|
||||||
|
}, [noticeUnreadCount,atUnreadCount]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const params = {
|
const params = {
|
||||||
type: noticeType,
|
type: noticeType,
|
||||||
|
@ -86,7 +90,6 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user:
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
if (data.status === 0) {
|
if (data.status === 0) {
|
||||||
resetUserInfo();
|
|
||||||
changeReadMarkAll(noticeType);
|
changeReadMarkAll(noticeType);
|
||||||
} else {
|
} else {
|
||||||
showNotification(data.message);
|
showNotification(data.message);
|
||||||
|
@ -133,7 +136,6 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user:
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
if (data.status === 0) {
|
if (data.status === 0) {
|
||||||
changeReadMark(item);
|
changeReadMark(item);
|
||||||
resetUserInfo();
|
|
||||||
item.notification_url && window.open(item.notification_url);
|
item.notification_url && window.open(item.notification_url);
|
||||||
} else {
|
} else {
|
||||||
showNotification(data.message);
|
showNotification(data.message);
|
||||||
|
@ -244,7 +246,7 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user:
|
||||||
)
|
)
|
||||||
}) : "暂无数据" : ""} */}
|
}) : "暂无数据" : ""} */}
|
||||||
<div className="hoverNotice-buttom">
|
<div className="hoverNotice-buttom">
|
||||||
<Link to="/settings/notice">全部消息</Link>
|
<Link to={{pathname:"/settings/notice",state:{noticeType:noticeType}}}>全部消息</Link>
|
||||||
{noticeUnreadCount > 0 && noticeType === "notification" && <a onClick={readAll}>所有系统消息一键已读</a>}
|
{noticeUnreadCount > 0 && noticeType === "notification" && <a onClick={readAll}>所有系统消息一键已读</a>}
|
||||||
{atUnreadCount > 0 && noticeType === "atme" && <a onClick={readAll}>所有@我一键已读</a>}
|
{atUnreadCount > 0 && noticeType === "atme" && <a onClick={readAll}>所有@我一键已读</a>}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -181,6 +181,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
.ant-scroll-number{
|
.ant-scroll-number{
|
||||||
right:12px;
|
right:12px;
|
||||||
|
padding: 0 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ function Index(props){
|
||||||
</ul>
|
</ul>
|
||||||
<ul className="securityUl ul-border-buttom">
|
<ul className="securityUl ul-border-buttom">
|
||||||
<li>消息通知</li>
|
<li>消息通知</li>
|
||||||
<li className={pathname.indexOf("/settings/notice")>-1 || pathname.indexOf("/settings/notice/privateLetter")>-1 ?"active":""}><Link to={`/settings/notice`}><i className="iconfont icon-wodetongzhi"></i><span className="text-shodow-bold">我的通知</span></Link></li>
|
<li className={pathname.indexOf("/settings/notice")>-1 || pathname.indexOf("/settings/notice/privateLetter")>-1 ?"active":""}><Link to={{pathname:"/settings/notice",state:{noticeType:"notification"}}}><i className="iconfont icon-wodetongzhi"></i><span className="text-shodow-bold">我的通知</span></Link></li>
|
||||||
{/* <li className={pathname.indexOf("/settings/notice/noticeManager")>-1 ?"active":""}><Link to={`/settings/notice/noticeManager`}><i className="iconfont icon-tongzhiguanli"></i><span className="text-shodow-bold">通知管理</span></Link></li> */}
|
{/* <li className={pathname.indexOf("/settings/notice/noticeManager")>-1 ?"active":""}><Link to={`/settings/notice/noticeManager`}><i className="iconfont icon-tongzhiguanli"></i><span className="text-shodow-bold">通知管理</span></Link></li> */}
|
||||||
</ul>
|
</ul>
|
||||||
<ul className="securityUl">
|
<ul className="securityUl">
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
padding-left: 17px;
|
padding-left: 17px;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 12px;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
li{
|
li{
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
|
@ -9,11 +9,14 @@ import './Index.scss';
|
||||||
import '../manager/Index.scss'
|
import '../manager/Index.scss'
|
||||||
|
|
||||||
function MyNotice(props) {
|
function MyNotice(props) {
|
||||||
|
// console.log(props.location.state);
|
||||||
let current_user = props.current_user;
|
let current_user = props.current_user;
|
||||||
let resetUserInfo = props.resetUserInfo;
|
let resetUserInfo = props.resetUserInfo;
|
||||||
|
//消息悬停框选择tab
|
||||||
|
let popover = props.location.state && props.location.state.noticeType;
|
||||||
|
|
||||||
let pageSize = 15;
|
let pageSize = 15;
|
||||||
|
const [noticeType, setNoticeType] = useState(popover==="atme"?"2":"0");//消息类别tab栏选择
|
||||||
const [noticeType, setNoticeType] = useState("0");//消息类别tab栏选择
|
|
||||||
const [selectedNum, setSelectedNum] = useState(0);//@我批量删除选择消息条数
|
const [selectedNum, setSelectedNum] = useState(0);//@我批量删除选择消息条数
|
||||||
const [isBatchDelete, setIsBatchDelete] = useState(false);//@我是否批量删除
|
const [isBatchDelete, setIsBatchDelete] = useState(false);//@我是否批量删除
|
||||||
const [batchDeleteCheckedAll, setBatchDeleteCheckAll] = useState(false);//@我批量删除--全选
|
const [batchDeleteCheckedAll, setBatchDeleteCheckAll] = useState(false);//@我批量删除--全选
|
||||||
|
@ -26,9 +29,17 @@ function MyNotice(props) {
|
||||||
const [currentPage, setCurrentPage] = useState(1);//当前页数
|
const [currentPage, setCurrentPage] = useState(1);//当前页数
|
||||||
const [onlyUnread, setOnlyUnread] = useState();
|
const [onlyUnread, setOnlyUnread] = useState();
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
popover==="notification" ? setNoticeType("0"):setNoticeType("2");
|
||||||
|
},[popover])
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
resetUserInfo();
|
||||||
|
},[noticeUnreadCount,atUnreadCount])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getMessageList();
|
getMessageList();
|
||||||
}, [noticeType, onlyUnread, currentPage])
|
}, [noticeType, onlyUnread, currentPage, current_user])
|
||||||
|
|
||||||
function getMessageList() {
|
function getMessageList() {
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -58,7 +69,7 @@ function MyNotice(props) {
|
||||||
axios.post(`/users/${current_user.login}/messages/read.json`,params).then((response)=>{
|
axios.post(`/users/${current_user.login}/messages/read.json`,params).then((response)=>{
|
||||||
if(response.status === 200){
|
if(response.status === 200){
|
||||||
getMessageList();
|
getMessageList();
|
||||||
resetUserInfo();
|
|
||||||
//已读当前页码最后一条数据时跳转到前一页
|
//已读当前页码最后一条数据时跳转到前一页
|
||||||
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
|
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
|
||||||
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
|
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
|
||||||
|
@ -125,7 +136,10 @@ function MyNotice(props) {
|
||||||
//删除当前页码最后一条数据时跳转到前一页
|
//删除当前页码最后一条数据时跳转到前一页
|
||||||
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
|
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
|
||||||
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
|
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
|
||||||
|
console.log(totlaPage);
|
||||||
|
console.log(currentPage);
|
||||||
setSelectedNum(0);
|
setSelectedNum(0);
|
||||||
|
setBatchDeleteCheckAll(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,12 @@ button:active {
|
||||||
&:hover .invisable-read{
|
&:hover .invisable-read{
|
||||||
display: block;
|
display: block;
|
||||||
color: #466AFF;
|
color: #466AFF;
|
||||||
|
opacity: 0.6;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover{
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover .timeSpan{
|
&:hover .timeSpan{
|
||||||
|
|
|
@ -64,7 +64,7 @@ function SSH(props) {
|
||||||
{
|
{
|
||||||
list.map((i,k)=>{
|
list.map((i,k)=>{
|
||||||
return(
|
return(
|
||||||
<List.Item>
|
<List.Item key={i.id}>
|
||||||
<img src={miyao} alt=""/>
|
<img src={miyao} alt=""/>
|
||||||
<div>
|
<div>
|
||||||
<p className="color-grey-3"><a className="task-hide" style={{display:"block",fontWeight:"500"}} onClick={()=>{setContent(i);setVisibleDesc(true)}}>{i.name}</a></p>
|
<p className="color-grey-3"><a className="task-hide" style={{display:"block",fontWeight:"500"}} onClick={()=>{setContent(i);setVisibleDesc(true)}}>{i.name}</a></p>
|
||||||
|
|
|
@ -13,10 +13,11 @@ export const noticeSourceType = {
|
||||||
//个人状态类通知
|
//个人状态类通知
|
||||||
OrganizationJoined:"icon-xiaoxi2", // 账号被拉入组织
|
OrganizationJoined:"icon-xiaoxi2", // 账号被拉入组织
|
||||||
OrganizationLeft:"icon-xiaoxi2", // 账号被移出组织
|
OrganizationLeft:"icon-xiaoxi2", // 账号被移出组织
|
||||||
rganizationRole:"icon-xiaoxi2", // 账号组织权限变更
|
OrganizationRole:"icon-xiaoxi2", // 账号组织权限变更
|
||||||
ProjectJoined:"icon-xiaoxi2", // 账号被拉入项目
|
ProjectJoined:"icon-xiaoxi2", // 账号被拉入项目
|
||||||
ProjectLeft:"icon-xiaoxi2", // 账号被移出项目
|
ProjectLeft:"icon-xiaoxi2", // 账号被移出项目
|
||||||
ProjectRole:"icon-xiaoxi2", // 账号仓库权限变更
|
ProjectRole:"icon-xiaoxi2", // 账号仓库权限变更
|
||||||
|
|
||||||
//其他仓库通知
|
//其他仓库通知
|
||||||
ProjectDelete:"icon-daimakuicon1", // 我关注的仓库被删除
|
ProjectDelete:"icon-daimakuicon1", // 我关注的仓库被删除
|
||||||
ProjectFollowed:"icon-daimakuicon1", // 我管理的仓库被关注
|
ProjectFollowed:"icon-daimakuicon1", // 我管理的仓库被关注
|
||||||
|
@ -34,6 +35,7 @@ export const noticeSourceType = {
|
||||||
PullRequestAtme:"icon-hebingqingqiuicon", // 在合并请求中@我
|
PullRequestAtme:"icon-hebingqingqiuicon", // 在合并请求中@我
|
||||||
PullRequestChanged:"icon-hebingqingqiuicon", // 我创建或负责的合并请求状态变更
|
PullRequestChanged:"icon-hebingqingqiuicon", // 我创建或负责的合并请求状态变更
|
||||||
PullRequestJournal:"icon-hebingqingqiuicon", // 我创建或负责的合并请求有新的评论
|
PullRequestJournal:"icon-hebingqingqiuicon", // 我创建或负责的合并请求有新的评论
|
||||||
|
PullRequestClosed:"icon-hebingqingqiuicon", // 提交的合并请求被拒绝
|
||||||
//里程碑
|
//里程碑
|
||||||
ProjectMilestone:"icon-lichengbeiicon", // 我管理的仓库有新的里程碑
|
ProjectMilestone:"icon-lichengbeiicon", // 我管理的仓库有新的里程碑
|
||||||
};
|
};
|
Loading…
Reference in New Issue