feat(notice): 新增公告优先级和未读状态功能,优化公告展示逻辑
This commit is contained in:
@@ -241,7 +241,9 @@ const loadNotices = async () => {
|
||||
try {
|
||||
const res = await getUserNotices()
|
||||
if (res.code === 200) {
|
||||
noticeList.value = res.data || []
|
||||
noticeList.value = (res.data || []).sort((a, b) => {
|
||||
return new Date(b.createTime) - new Date(a.createTime)
|
||||
})
|
||||
// 设置第一个未读公告为激活状态,如果没有未读则设置第一个
|
||||
const firstUnread = noticeList.value.find(n => !n.isRead)
|
||||
if (firstUnread) {
|
||||
@@ -359,7 +361,8 @@ defineExpose({
|
||||
}
|
||||
|
||||
.notice-list {
|
||||
width: 380px;
|
||||
width: 25%;
|
||||
min-width: 200px;
|
||||
border-right: 1px solid #e4e7ed;
|
||||
background: #fafafa;
|
||||
|
||||
@@ -368,6 +371,7 @@ defineExpose({
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
transition: all 0.3s;
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
background: #f0f2f5;
|
||||
|
||||
Reference in New Issue
Block a user