mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2026-02-13 17:30:27 +08:00
Merge branch 'main' into pages
This commit is contained in:
@@ -19,6 +19,8 @@ buttons:
|
||||
pureBackTop: BackTop
|
||||
pureOpenText: Open
|
||||
pureCloseText: Close
|
||||
pureWatchMore: Watch More
|
||||
pureMarkAsRead: Mark As Read
|
||||
search:
|
||||
pureTotal: Total
|
||||
pureHistory: History
|
||||
|
||||
@@ -19,6 +19,8 @@ buttons:
|
||||
pureBackTop: 回到顶部
|
||||
pureOpenText: 开
|
||||
pureCloseText: 关
|
||||
pureWatchMore: 查看更多
|
||||
pureMarkAsRead: 标为已读
|
||||
search:
|
||||
pureTotal: 共
|
||||
pureHistory: 搜索历史
|
||||
|
||||
@@ -8,6 +8,10 @@ defineProps({
|
||||
noticeItem: {
|
||||
type: Object as PropType<ListItem>,
|
||||
default: () => {}
|
||||
},
|
||||
isLast: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +53,11 @@ function hoverDescription(event, description) {
|
||||
|
||||
<template>
|
||||
<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
|
||||
v-if="noticeItem.avatar"
|
||||
@@ -119,8 +127,6 @@ function hoverDescription(event, description) {
|
||||
justify-content: space-between;
|
||||
padding: 12px 0;
|
||||
|
||||
// border-bottom: 1px solid #f0f0f0;
|
||||
|
||||
.notice-container-avatar {
|
||||
margin-right: 16px;
|
||||
background: #fff;
|
||||
|
||||
@@ -18,7 +18,12 @@ defineProps({
|
||||
|
||||
<template>
|
||||
<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>
|
||||
<el-empty v-else :description="transformI18n(emptyText)" />
|
||||
</template>
|
||||
|
||||
@@ -3,9 +3,12 @@ import { useI18n } from "vue-i18n";
|
||||
import { ref, computed } from "vue";
|
||||
import { noticesData } from "./data";
|
||||
import NoticeList from "./components/NoticeList.vue";
|
||||
|
||||
import BellIcon from "~icons/lucide/bell";
|
||||
import ArrowRightIcon from "~icons/ri/arrow-right-s-line";
|
||||
|
||||
const { t } = useI18n();
|
||||
const dropdownRef = ref();
|
||||
const notices = ref(noticesData);
|
||||
const activeKey = ref(noticesData[0]?.key);
|
||||
|
||||
@@ -13,10 +16,30 @@ const getLabel = computed(
|
||||
() => item =>
|
||||
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>
|
||||
|
||||
<template>
|
||||
<el-dropdown trigger="click" placement="bottom-end">
|
||||
<el-dropdown ref="dropdownRef" trigger="click" placement="bottom-end">
|
||||
<span
|
||||
:class="['dropdown-badge', 'navbar-bg-hover', 'select-none', 'mr-[7px]']"
|
||||
>
|
||||
@@ -42,7 +65,7 @@ const getLabel = computed(
|
||||
<span v-else>
|
||||
<template v-for="item in notices" :key="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">
|
||||
<NoticeList :list="item.list" :emptyText="item.emptyText" />
|
||||
</div>
|
||||
@@ -51,6 +74,20 @@ const getLabel = computed(
|
||||
</template>
|
||||
</span>
|
||||
</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>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
||||
Reference in New Issue
Block a user