Merge branch 'feature_notification' of https://git.trustie.net/tongChong/forgeplus-react into feature_notification

This commit is contained in:
何童崇 2021-09-16 13:11:24 +08:00
commit 44dc10ff8c
2 changed files with 28 additions and 21 deletions

View File

@ -59,6 +59,9 @@ function MyNotice(props) {
if(response.status === 200){
getMessageList();
resetUserInfo();
//
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
}
});
}
@ -117,10 +120,17 @@ function MyNotice(props) {
axios.delete(`/users/${current_user.login}/messages.json`,{
data:params,
}).then((response)=>{
response.status === 200 && getMessageList();
if(response.status === 200){
getMessageList();
//
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
setSelectedNum(0);
}
});
}
});
}
function cancelBatchDelete(){
@ -135,6 +145,7 @@ function MyNotice(props) {
setBatchDeleteCheckAll(false);
}
//
function turnToMess(item){
if(item.notification_url){
window.open(`${item.notification_url}`);
@ -164,9 +175,8 @@ function MyNotice(props) {
{messageList && messageList.length>0 && <div className={isBatchDelete ? 'visible' : 'invisible'}>
<div className="vertical-center-style">
{/* <input type="checkbox" id="checkAll" onChange={onChangeAll} />&nbsp; */}
<Checkbox onChange={onChangeAll} checked={batchDeleteCheckedAll}>全选</Checkbox>
&nbsp;&nbsp;&nbsp;已选择&nbsp;<span id="numberSpan">{selectedNum}</span>&nbsp;
&nbsp;&nbsp;&nbsp;已选择&nbsp;<span className="numberSpan">{selectedNum}</span>&nbsp;
</div>
<div>
<button onClick={cancelBatchDelete}>取消</button>&nbsp;&nbsp;&nbsp;&nbsp;
@ -183,7 +193,7 @@ function MyNotice(props) {
<div className="mynotice-cont stretch-style">
{item.status === 1 ? <Badge color="#FA2020" /> : <span className="system-notice-blank"></span>}
<i className={"iconfont "+noticeSourceType[item.source]}></i>
<span className={item.notification_url?"sysNotice-length highlightSpan":"sysNotice-length"} onClick={() => {item.notification_url && window.open("https://"+`${item.notification_url}`);readNotice([item.id])}} dangerouslySetInnerHTML={{__html: item.content}}></span>
<span className={`sysNotice-length ${item.notification_url?'highlightSpan':''}`} onClick={() => {turnToMess(item)}} dangerouslySetInnerHTML={{__html: item.content}}></span>
</div>
<div className="mynotice-cont vertical-center-style float-left-little">
<span className={item.status === 1?"timeSpan":""}>{item.time_ago}</span>
@ -192,16 +202,15 @@ function MyNotice(props) {
</div>
)
} else if (noticeType === "2") {
console.log(item);
//@
return (
<div className={`mynotice-content vertical-center-style ${isBatchDelete?'batchDel':''}`} key={item.id}>
<div className="mynotice-cont vertical-center-style">
<Checkbox value={item.id} className={isBatchDelete ? 'visible-checkbox' : 'invisible-checkbox'} onChange={onChange} checked={item.checkedBatch}></Checkbox>
{item.sender && <img src={`https://testforgeplus.trustie.net//${item.sender.image_url}`} className="currentImg" onClick={()=>{window.open(`/${item.sender && item.sender.login}`);}}/>}
{item.status === 1 ? <Badge color="#FA2020" className="atme-umread-redDot"/> : <span className="system-notice-blank"></span>}
<div className={`atme-notice-text ${item.notification_url && 'highlightSpan'}`} onClick={() => {turnToMess(item)}}>
{item.sender && <span dangerouslySetInnerHTML={{__html: "<b>" + item.sender.name+ "</b> "+ item.content +" 中@我"}}></span>}
<div className={`atme-notice-text stretch-style ${item.notification_url && 'highlightSpan'}`} onClick={() => {turnToMess(item)}}>
{item.status === 1 ? <Badge color="#FA2020"/> : <span className="system-notice-blank"></span>}
{item.sender && <span className="atme-length" dangerouslySetInnerHTML={{__html: "<b class = 'atme-notice-name'>" + item.sender.name+ "</b> "+ item.content +" 中@我"}}></span>}
</div>
</div>
<div className="mynotice-cont vertical-center-style">

View File

@ -16,10 +16,6 @@
position: relative;
}
// #item-private{
// margin: 0 24px 0 34px !important;
// }
li.ant-menu-item, .ant-menu-horizontal > .ant-menu-item {
border-bottom: 0px;
}
@ -92,15 +88,10 @@ button:active {
cursor: pointer;
}
& .atme-umread-redDot{
position: relative;
top: -13px;
right: -5px;
}
& b{
font-weight: 400;
text-shadow: 0.5px 0 #333;
margin: 0 6px;
}
& .invisable-read{
@ -158,8 +149,15 @@ button:active {
}
.atme-notice-text{
margin-left: 6px;
max-width: 48rem;
word-break: break-all;
& .atme-notice-name{
margin: 0 0 ;
}
& .atme-length{
max-width: 48rem;
word-break: break-all;
}
}
}
@ -229,7 +227,7 @@ button:active {
}
#numberSpan{
.numberSpan{
color: #466AFF;
}