|
|
@@ -24,7 +24,7 @@ const pageInfo = ref({
|
|
|
cp: 1,
|
|
|
ps: 30
|
|
|
})
|
|
|
-const getNotificationList = () => {
|
|
|
+const getNotificationList = (isChangeType?: boolean) => {
|
|
|
loading.value = true
|
|
|
$api
|
|
|
.getNotificationList({
|
|
|
@@ -38,9 +38,6 @@ const getNotificationList = () => {
|
|
|
if (res.data.length === 0 || res.data.length < pageInfo.value.ps) {
|
|
|
notificationMessageCardRef.value.finished = true
|
|
|
}
|
|
|
- // nextTick(() => {
|
|
|
- // init()
|
|
|
- // })
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
|
@@ -48,7 +45,7 @@ const getNotificationList = () => {
|
|
|
pageInfo.value.cp += 1
|
|
|
notificationMessageCardRef.value.loading = false
|
|
|
|
|
|
- notificationMessageCardRef.value.adjustScrollTop()
|
|
|
+ notificationMessageCardRef.value.adjustScrollTop(isChangeType ? 0 : undefined)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -82,9 +79,18 @@ const handleSettingMessage = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const handleChangeNotificationType = async (value: string) => {
|
|
|
+ notificationList.value = []
|
|
|
+ pageInfo.value.cp = 1
|
|
|
+ notificationMessageCardRef.value.adjustScrollTop(0)
|
|
|
+ notificationMessageCardRef.value.finished = false
|
|
|
+ getNotificationList(true)
|
|
|
+}
|
|
|
+
|
|
|
const closeDrawer = () => {
|
|
|
notificationList.value = []
|
|
|
notificationType.value = 'all'
|
|
|
+ notificationMessageCardRef.value.adjustScrollTop(0)
|
|
|
notificationMsgStore.markMessageAsRead()
|
|
|
pageInfo.value.cp = 1
|
|
|
}
|
|
|
@@ -93,7 +99,7 @@ const closeDrawer = () => {
|
|
|
<template>
|
|
|
<el-drawer
|
|
|
ref="drawerRef"
|
|
|
- @open="getNotificationList"
|
|
|
+ @open="getNotificationList(true)"
|
|
|
@closed="closeDrawer"
|
|
|
class="notice-drawer"
|
|
|
size="432px"
|
|
|
@@ -101,7 +107,7 @@ const closeDrawer = () => {
|
|
|
<template #header>
|
|
|
<el-select
|
|
|
size="large"
|
|
|
- @change="getNotificationList"
|
|
|
+ @change="handleChangeNotificationType"
|
|
|
v-model="notificationType"
|
|
|
class="notification-type"
|
|
|
>
|
|
|
@@ -146,6 +152,7 @@ const closeDrawer = () => {
|
|
|
@loading="getNotificationList"
|
|
|
:data="notificationList"
|
|
|
:topOffset="185"
|
|
|
+ :isDrawer="true"
|
|
|
ref="notificationMessageCardRef"
|
|
|
/>
|
|
|
</div>
|