我的通知

This commit is contained in:
谢思 2021-09-15 14:41:59 +08:00
parent aaa58e532b
commit ee6a40a5d9
3 changed files with 16 additions and 12 deletions

View File

@ -447,7 +447,6 @@ class NewHeader extends Component {
content={<NoticeContent visible={visible} current_user={current_user} showNotification={showNotification} resetUserInfo={resetUserInfo}/>}
visible={visible}
onVisibleChange={this.handleVisibleChange}
visible = 'true'
>
<a className="message-icon" href={`/settings/notice/Notice`}>
<Badge count={current_user.message_unread_total}>

View File

@ -163,18 +163,15 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user:
>
{
noticeUnreadList.map(item => {
console.log(item.content);
console.log(item.content.length);
let contentStr = item.content.endsWith("</b>") && item.content.length >= 50 && item.content.replace("</b>", "").substr(0, 40) + "...";
return (
<div key={item.id + Math.random()} className="noticeCont-back" onClick={() => { readItem(item) }}>
<div className="noticeCont" style={{ height: item.content.length > 30 && item.content.length <= 34 ? '65px' : "" }}>
<div className="noticeCont">
<span style={{ visibility: item.status === 1 ? 'visible' : 'hidden' }}>
<Badge color="#FA2020" />
</span>
<i className={"iconfont "+noticeSourceType[item.source]}></i>
<div className="noticeCont-text">
<span className="content-span" dangerouslySetInnerHTML={{ __html: contentStr ? contentStr : item.content.length >= 48 ? item.content.substr(0, 48) + "..." : item.content }}></span>
<span className="content-span notice-cont-span" dangerouslySetInnerHTML={{ __html: item.content }}></span>
<span className="timeSpan">{item.time_ago}</span>
</div>
</div>
@ -196,12 +193,12 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user:
{atUnreadList.map(item => {
return (
<div key={item.id + Math.random()} className="noticeCont-back" onClick={() => { readItem(item) }}>
<div className="noticeCont" style={{ height: item.content.length > 30 && item.content.length <= 42 ? '65px' : "" }}>
<div className="noticeCont">
<span style={{ visibility: item.status === 1 ? 'visible' : 'hidden' }}>
<Badge color="#FA2020" />
</span>
<div className="noticeCont-text">
<span className="content-span" dangerouslySetInnerHTML={{ __html: item.content.length >= 50 ? item.content.substr(0, 50) + "...@我" : item.content }}></span>
<span className="content-span atme-cont-span" dangerouslySetInnerHTML={{ __html: item.content }}></span>
<span className="timeSpan">{item.time_ago}</span>
</div>
</div>

View File

@ -228,12 +228,20 @@
color:#333333;
& .content-span{
width: 255px;
max-height: 42px;
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* 这里是超出几行省略 */
overflow: hidden;
// white-space: nowrap;
// text-overflow: ellipsis;
}
& .atme-cont-span{
width: 275px;
}
& .notice-cont-span{
width: 255px;
}
.timeSpan{