Skip to content

Commit 653d322

Browse files
committed
Merge branch 'main' into pages
2 parents 495456e + 3ce26d6 commit 653d322

5 files changed

Lines changed: 58 additions & 6 deletions

File tree

locales/en.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ buttons:
1919
pureBackTop: BackTop
2020
pureOpenText: Open
2121
pureCloseText: Close
22+
pureWatchMore: Watch More
23+
pureMarkAsRead: Mark As Read
2224
search:
2325
pureTotal: Total
2426
pureHistory: History

locales/zh-CN.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ buttons:
1919
pureBackTop: 回到顶部
2020
pureOpenText:
2121
pureCloseText:
22+
pureWatchMore: 查看更多
23+
pureMarkAsRead: 标为已读
2224
search:
2325
pureTotal:
2426
pureHistory: 搜索历史

src/layout/components/lay-notice/components/NoticeItem.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ defineProps({
88
noticeItem: {
99
type: Object as PropType<ListItem>,
1010
default: () => {}
11+
},
12+
isLast: {
13+
type: Boolean,
14+
default: false
1115
}
1216
});
1317
@@ -49,7 +53,11 @@ function hoverDescription(event, description) {
4953

5054
<template>
5155
<div
52-
class="notice-container border-0 border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
56+
:class="[
57+
'notice-container',
58+
'border-0 border-solid border-[#f0f0f0] dark:border-[#303030]',
59+
{ 'border-b': !isLast }
60+
]"
5361
>
5462
<el-avatar
5563
v-if="noticeItem.avatar"
@@ -119,8 +127,6 @@ function hoverDescription(event, description) {
119127
justify-content: space-between;
120128
padding: 12px 0;
121129
122-
// border-bottom: 1px solid #f0f0f0;
123-
124130
.notice-container-avatar {
125131
margin-right: 16px;
126132
background: #fff;

src/layout/components/lay-notice/components/NoticeList.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ defineProps({
1818

1919
<template>
2020
<div v-if="list.length">
21-
<NoticeItem v-for="(item, index) in list" :key="index" :noticeItem="item" />
21+
<NoticeItem
22+
v-for="(item, index) in list"
23+
:key="index"
24+
:noticeItem="item"
25+
:isLast="index === list.length - 1"
26+
/>
2227
</div>
2328
<el-empty v-else :description="transformI18n(emptyText)" />
2429
</template>

src/layout/components/lay-notice/index.vue

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,43 @@ import { useI18n } from "vue-i18n";
33
import { ref, computed } from "vue";
44
import { noticesData } from "./data";
55
import NoticeList from "./components/NoticeList.vue";
6+
67
import BellIcon from "~icons/lucide/bell";
8+
import ArrowRightIcon from "~icons/ri/arrow-right-s-line";
79
810
const { t } = useI18n();
11+
const dropdownRef = ref();
912
const notices = ref(noticesData);
1013
const activeKey = ref(noticesData[0]?.key);
1114
1215
const getLabel = computed(
1316
() => item =>
1417
t(item.name) + (item.list.length > 0 ? `(${item.list.length})` : "")
1518
);
19+
20+
const currentNoticeHasData = computed(() => {
21+
const currentNotice = notices.value.find(
22+
item => item.key === activeKey.value
23+
);
24+
return currentNotice && currentNotice.list.length > 0;
25+
});
26+
27+
const onWatchMore = () => {
28+
dropdownRef.value.handleClose();
29+
};
30+
31+
const onMarkAsRead = () => {
32+
const currentNotice = notices.value.find(
33+
item => item.key === activeKey.value
34+
);
35+
if (currentNotice) {
36+
currentNotice.list = [];
37+
}
38+
};
1639
</script>
1740

1841
<template>
19-
<el-dropdown trigger="click" placement="bottom-end">
42+
<el-dropdown ref="dropdownRef" trigger="click" placement="bottom-end">
2043
<span
2144
:class="['dropdown-badge', 'navbar-bg-hover', 'select-none', 'mr-[7px]']"
2245
>
@@ -42,7 +65,7 @@ const getLabel = computed(
4265
<span v-else>
4366
<template v-for="item in notices" :key="item.key">
4467
<el-tab-pane :label="getLabel(item)" :name="`${item.key}`">
45-
<el-scrollbar max-height="330px">
68+
<el-scrollbar max-height="345px">
4669
<div class="noticeList-container">
4770
<NoticeList :list="item.list" :emptyText="item.emptyText" />
4871
</div>
@@ -51,6 +74,20 @@ const getLabel = computed(
5174
</template>
5275
</span>
5376
</el-tabs>
77+
<div
78+
v-if="currentNoticeHasData"
79+
class="border-t border-t-(--el-border-color-light) text-sm"
80+
>
81+
<div class="flex-bc m-1">
82+
<el-button type="primary" size="small" text @click="onWatchMore">
83+
{{ t("buttons.pureWatchMore") }}
84+
<IconifyIconOffline :icon="ArrowRightIcon" />
85+
</el-button>
86+
<el-button type="primary" size="small" text @click="onMarkAsRead">
87+
{{ t("buttons.pureMarkAsRead") }}
88+
</el-button>
89+
</div>
90+
</div>
5491
</el-dropdown-menu>
5592
</template>
5693
</el-dropdown>

0 commit comments

Comments
 (0)