Merge branch 'main' into pages

This commit is contained in:
xiaoxian521
2026-01-30 10:41:03 +08:00
5 changed files with 58 additions and 6 deletions

View File

@@ -19,6 +19,8 @@ buttons:
pureBackTop: BackTop pureBackTop: BackTop
pureOpenText: Open pureOpenText: Open
pureCloseText: Close pureCloseText: Close
pureWatchMore: Watch More
pureMarkAsRead: Mark As Read
search: search:
pureTotal: Total pureTotal: Total
pureHistory: History pureHistory: History

View File

@@ -19,6 +19,8 @@ buttons:
pureBackTop: 回到顶部 pureBackTop: 回到顶部
pureOpenText: pureOpenText:
pureCloseText: pureCloseText:
pureWatchMore: 查看更多
pureMarkAsRead: 标为已读
search: search:
pureTotal: pureTotal:
pureHistory: 搜索历史 pureHistory: 搜索历史

View File

@@ -8,6 +8,10 @@ defineProps({
noticeItem: { noticeItem: {
type: Object as PropType<ListItem>, type: Object as PropType<ListItem>,
default: () => {} default: () => {}
},
isLast: {
type: Boolean,
default: false
} }
}); });
@@ -49,7 +53,11 @@ function hoverDescription(event, description) {
<template> <template>
<div <div
class="notice-container border-0 border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]" :class="[
'notice-container',
'border-0 border-solid border-[#f0f0f0] dark:border-[#303030]',
{ 'border-b': !isLast }
]"
> >
<el-avatar <el-avatar
v-if="noticeItem.avatar" v-if="noticeItem.avatar"
@@ -119,8 +127,6 @@ function hoverDescription(event, description) {
justify-content: space-between; justify-content: space-between;
padding: 12px 0; padding: 12px 0;
// border-bottom: 1px solid #f0f0f0;
.notice-container-avatar { .notice-container-avatar {
margin-right: 16px; margin-right: 16px;
background: #fff; background: #fff;

View File

@@ -18,7 +18,12 @@ defineProps({
<template> <template>
<div v-if="list.length"> <div v-if="list.length">
<NoticeItem v-for="(item, index) in list" :key="index" :noticeItem="item" /> <NoticeItem
v-for="(item, index) in list"
:key="index"
:noticeItem="item"
:isLast="index === list.length - 1"
/>
</div> </div>
<el-empty v-else :description="transformI18n(emptyText)" /> <el-empty v-else :description="transformI18n(emptyText)" />
</template> </template>

View File

@@ -3,9 +3,12 @@ import { useI18n } from "vue-i18n";
import { ref, computed } from "vue"; import { ref, computed } from "vue";
import { noticesData } from "./data"; import { noticesData } from "./data";
import NoticeList from "./components/NoticeList.vue"; import NoticeList from "./components/NoticeList.vue";
import BellIcon from "~icons/lucide/bell"; import BellIcon from "~icons/lucide/bell";
import ArrowRightIcon from "~icons/ri/arrow-right-s-line";
const { t } = useI18n(); const { t } = useI18n();
const dropdownRef = ref();
const notices = ref(noticesData); const notices = ref(noticesData);
const activeKey = ref(noticesData[0]?.key); const activeKey = ref(noticesData[0]?.key);
@@ -13,10 +16,30 @@ const getLabel = computed(
() => item => () => item =>
t(item.name) + (item.list.length > 0 ? `(${item.list.length})` : "") t(item.name) + (item.list.length > 0 ? `(${item.list.length})` : "")
); );
const currentNoticeHasData = computed(() => {
const currentNotice = notices.value.find(
item => item.key === activeKey.value
);
return currentNotice && currentNotice.list.length > 0;
});
const onWatchMore = () => {
dropdownRef.value.handleClose();
};
const onMarkAsRead = () => {
const currentNotice = notices.value.find(
item => item.key === activeKey.value
);
if (currentNotice) {
currentNotice.list = [];
}
};
</script> </script>
<template> <template>
<el-dropdown trigger="click" placement="bottom-end"> <el-dropdown ref="dropdownRef" trigger="click" placement="bottom-end">
<span <span
:class="['dropdown-badge', 'navbar-bg-hover', 'select-none', 'mr-[7px]']" :class="['dropdown-badge', 'navbar-bg-hover', 'select-none', 'mr-[7px]']"
> >
@@ -42,7 +65,7 @@ const getLabel = computed(
<span v-else> <span v-else>
<template v-for="item in notices" :key="item.key"> <template v-for="item in notices" :key="item.key">
<el-tab-pane :label="getLabel(item)" :name="`${item.key}`"> <el-tab-pane :label="getLabel(item)" :name="`${item.key}`">
<el-scrollbar max-height="330px"> <el-scrollbar max-height="345px">
<div class="noticeList-container"> <div class="noticeList-container">
<NoticeList :list="item.list" :emptyText="item.emptyText" /> <NoticeList :list="item.list" :emptyText="item.emptyText" />
</div> </div>
@@ -51,6 +74,20 @@ const getLabel = computed(
</template> </template>
</span> </span>
</el-tabs> </el-tabs>
<div
v-if="currentNoticeHasData"
class="border-t border-t-(--el-border-color-light) text-sm"
>
<div class="flex-bc m-1">
<el-button type="primary" size="small" text @click="onWatchMore">
{{ t("buttons.pureWatchMore") }}
<IconifyIconOffline :icon="ArrowRightIcon" />
</el-button>
<el-button type="primary" size="small" text @click="onMarkAsRead">
{{ t("buttons.pureMarkAsRead") }}
</el-button>
</div>
</div>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>