上传通知修改

This commit is contained in:
何童崇 2021-09-14 16:33:08 +08:00
parent 9852bb14c3
commit 0e31deb88c
4 changed files with 62 additions and 52 deletions

View File

@ -280,7 +280,7 @@ class NewHeader extends Component {
};
render() {
const { match ,hisroty ,showNotification} = this.props;
const { match ,resetUserInfo ,showNotification} = this.props;
let current_user = this.props.user;
let {
AccountProfiletype,
@ -444,7 +444,7 @@ class NewHeader extends Component {
<Popover
overlayClassName="notice-popover"
placement={`bottomRight`}
content={<NoticeContent current_user={current_user} showNotification={showNotification}/>}
content={<NoticeContent visible={visible} current_user={current_user} showNotification={showNotification} resetUserInfo={resetUserInfo}/>}
visible={visible}
onVisibleChange={this.handleVisibleChange}
>

View File

@ -3,13 +3,14 @@ import { Badge, Menu } from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios';
import AppPullRefresh from './AppPullRefresh';
import { noticeSourceType } from '../common/static';
import './header.scss';
import '../SecuritySetting/notice/manager/Index.scss';
import '../SecuritySetting/Index.scss';
import '../SecuritySetting/notice/myNotice/Index.scss';
function NoticeContent({ showNotification, current_user: { login } }) {
function NoticeContent({ visible, showNotification, resetUserInfo, current_user: { login } }) {
const [initialize, setInitialize] = useState(true);
const [noticeType, setNoticeType] = useState("notification");
const [letterUnreadCount, setLetterUnreadCount] = useState(0);//
@ -43,8 +44,8 @@ function NoticeContent({ showNotification, current_user: { login } }) {
if (initialize) {
params.type = "atme"
}
getMessageList(params);
}, [reload]);
visible && getMessageList(params);
}, [reload, visible]);
function getMessageList(params) {
@ -87,6 +88,7 @@ function NoticeContent({ showNotification, current_user: { login } }) {
if (!data) return;
if (data.status === 0) {
setReload(Math.random());
resetUserInfo();
} else {
showNotification(data.message);
}
@ -113,6 +115,7 @@ function NoticeContent({ showNotification, current_user: { login } }) {
if (!data) return;
if (data.status === 0) {
changeReadMark(item);
resetUserInfo();
item.notification_url && window.open(item.notification_url);
} else {
showNotification(data.message);
@ -126,11 +129,17 @@ function NoticeContent({ showNotification, current_user: { login } }) {
let index = noticeUnreadList.indexOf(item);
list[index].status = 2;
setNoticeUnreadList(list);
if (noticeUnreadCount > 0) {
setNoticeUnreadCount(noticeUnreadCount - 1);
}
} else if (item.type === "atme") {
let list = atUnreadList.slice();
let index = atUnreadList.indexOf(item);
list[index].status = 2;
setAtUnreadList(list);
if (atUnreadCount > 0) {
setAtUnreadCount(atUnreadCount - 1);
}
}
}
@ -149,7 +158,7 @@ function NoticeContent({ showNotification, current_user: { login } }) {
className='hoverNotice-body' // className
onPullRefresh={() => { setNoticePage(noticePage + 1); }} //ajaxfunction
// type={2} //
count={noticeUnreadCount} //
count={noticeUnreadList.length} //
pageSize={10} //
>
{
@ -161,7 +170,7 @@ function NoticeContent({ showNotification, current_user: { login } }) {
<span style={{ visibility: item.status === 1 ? 'visible' : 'hidden' }}>
<Badge color="#FA2020" />
</span>
<i className="iconfont icon-yixiuicon1"></i>
<i className={"iconfont "+noticeSourceType[item.source]}></i>
<div className="noticeCont-text">
<span dangerouslySetInnerHTML={{ __html: contentStr ? contentStr : item.content.length >= 48 ? item.content.substr(0, 48) + "..." : item.content }}></span>
<span className="timeSpan">{item.time_ago}</span>
@ -179,7 +188,7 @@ function NoticeContent({ showNotification, current_user: { login } }) {
className='hoverNotice-body' // className
onPullRefresh={() => { setAtPage(atPage + 1); }} //ajaxfunction
// type={1} //
count={atUnreadCount} //
count={atUnreadList.length} //
pageSize={10} //
>
{atUnreadList.map(item => {

View File

@ -1,17 +1,18 @@
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import { Badge, Button, Checkbox, Menu, Pagination } from 'antd';
import DelModal from '../../../Component/ModalFun';
import NoneData from '../../../Nodata.js';
import { noticeSourceType } from '../../../common/static';
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 [noticeType, setNoticeType] = useState("0");//tab
const [selectedNum, setSelectedNum] = useState(0);//@
const [isBatchDelete, setIsBatchDelete] = useState(false);//@
const [batchDeleteCheckedAll, setBatchDeleteCheckAll] = useState(false);//@--
@ -23,45 +24,6 @@ function MyNotice(props) {
const [messTotalCount, setMessTotalCount] = useState();//
const [currentPage, setCurrentPage] = useState(1);//
const [onlyUnread, setOnlyUnread] = useState();
const noticeSourceType = {
//
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:"icon-xitongtongzhiicon", //
//
OrganizationJoined:"icon-xiaoxi2", //
OrganizationLeft:"icon-xiaoxi2", //
rganizationRole:"icon-xiaoxi2", //
ProjectJoined:"icon-xiaoxi2", //
ProjectLeft:"icon-xiaoxi2", //
ProjectRole:"icon-xiaoxi2", //
//
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:"icon-hebingqingqiuicon", // /
PullRequestAssigned:"icon-hebingqingqiuicon", //
PullRequestAtme:"icon-hebingqingqiuicon", // @
PullRequestChanged:"icon-hebingqingqiuicon", //
PullRequestJournal:"icon-hebingqingqiuicon", //
//
ProjectMilestone:"icon-lichengbeiicon", //
};
useEffect(() => {
// const params = {

View File

@ -0,0 +1,39 @@
export const noticeSourceType = {
// 易修
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:"icon-xitongtongzhiicon", //登录异常提示
//个人状态类通知
OrganizationJoined:"icon-xiaoxi2", // 账号被拉入组织
OrganizationLeft:"icon-xiaoxi2", // 账号被移出组织
rganizationRole:"icon-xiaoxi2", // 账号组织权限变更
ProjectJoined:"icon-xiaoxi2", // 账号被拉入项目
ProjectLeft:"icon-xiaoxi2", // 账号被移出项目
ProjectRole:"icon-xiaoxi2", // 账号仓库权限变更
//其他仓库通知
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:"icon-hebingqingqiuicon", // 我管理/关注的仓库有新的合并请求
PullRequestAssigned:"icon-hebingqingqiuicon", // 有新指派给我的合并请求
PullRequestAtme:"icon-hebingqingqiuicon", // 在合并请求中@我
PullRequestChanged:"icon-hebingqingqiuicon", // 我创建或负责的合并请求状态变更
PullRequestJournal:"icon-hebingqingqiuicon", // 我创建或负责的合并请求有新的评论
//里程碑
ProjectMilestone:"icon-lichengbeiicon", // 我管理的仓库有新的里程碑
};