fix: update some files
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m44s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m44s
This commit is contained in:
@@ -12,14 +12,14 @@
|
||||
:key="tab.value"
|
||||
type="button"
|
||||
:class="{ active: activeCategory === tab.value }"
|
||||
@click="activeCategory = tab.value"
|
||||
@click="handleCategoryChange(tab.value)"
|
||||
>
|
||||
{{ tab.label }}<span v-if="tab.count"> ({{ tab.count }})</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div v-loading="notificationStore.loading" class="scroll">
|
||||
<div ref="notificationListRef" v-loading="notificationStore.loading" class="scroll">
|
||||
<button
|
||||
v-for="item in filteredItems"
|
||||
:key="item.id"
|
||||
@@ -43,6 +43,21 @@
|
||||
<p>暂无通知</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="notificationStore.notificationTotal > notificationStore.notificationPageSize"
|
||||
class="pagination"
|
||||
>
|
||||
<ElPagination
|
||||
:current-page="notificationStore.notificationPage"
|
||||
:page-size="notificationStore.notificationPageSize"
|
||||
:total="notificationStore.notificationTotal"
|
||||
:pager-count="5"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
small
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,6 +79,7 @@
|
||||
const router = useRouter()
|
||||
const notificationStore = useNotificationStore()
|
||||
const activeCategory = ref<'all' | NotificationCategory>('all')
|
||||
const notificationListRef = ref<HTMLElement | null>(null)
|
||||
const visible = computed(() => props.modelValue)
|
||||
|
||||
const categoryMatches = (item: NotificationItem, category: string) => {
|
||||
@@ -96,6 +112,24 @@
|
||||
|
||||
const close = () => emit('update:modelValue', false)
|
||||
|
||||
const loadNotificationPage = async (page: number) => {
|
||||
try {
|
||||
await notificationStore.loadNotifications(page)
|
||||
notificationListRef.value?.scrollTo({ top: 0 })
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error?.message || '获取通知失败')
|
||||
}
|
||||
}
|
||||
|
||||
const handleCategoryChange = (category: 'all' | NotificationCategory) => {
|
||||
activeCategory.value = category
|
||||
void loadNotificationPage(1)
|
||||
}
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
void loadNotificationPage(page)
|
||||
}
|
||||
|
||||
const handleMarkAllRead = async () => {
|
||||
try {
|
||||
const response = await notificationStore.markAllRead()
|
||||
|
||||
Reference in New Issue
Block a user