|
|
@@ -65,7 +65,7 @@ const setActiveItem = (item: string) => {
|
|
|
activeCardTypeName.value = item
|
|
|
sessionStorage.setItem('activeCardTypeName', item)
|
|
|
activeTabName.value = 'All Notifications'
|
|
|
- getNotificationList()
|
|
|
+ getNotificationList(activeTabName.value, true)
|
|
|
}
|
|
|
|
|
|
const loading = ref(false)
|
|
|
@@ -83,14 +83,17 @@ const pageInfo = ref({
|
|
|
cp: 1,
|
|
|
ps: 5
|
|
|
})
|
|
|
-const getNotificationList = async (tabType: string = 'All Notification') => {
|
|
|
+const getNotificationList = async (
|
|
|
+ tabType: string = 'All Notifications',
|
|
|
+ isChangeNav: boolean = false
|
|
|
+) => {
|
|
|
loading.value = true
|
|
|
const rulesType = Object.entries(notificationTypeList.value).find(
|
|
|
(item) => item[1] === activeCardTypeName.value
|
|
|
)?.[0]
|
|
|
- let info_type: string | boolean = ''
|
|
|
- if (tabType === 'All Notification') {
|
|
|
- info_type = ''
|
|
|
+ let info_type: null | boolean = null
|
|
|
+ if (tabType === 'All Notifications') {
|
|
|
+ info_type = null
|
|
|
} else if (tabType === 'Unread') {
|
|
|
info_type = true
|
|
|
} else {
|
|
|
@@ -111,9 +114,13 @@ const getNotificationList = async (tabType: string = 'All Notification') => {
|
|
|
notificationList.value = [...notificationList.value, ...data.cardList]
|
|
|
// tabCountList.value = data.countList
|
|
|
!data?.cardList?.length && (notificationMessageCardRef.value.finished = true)
|
|
|
- if (tabType === 'All Notification') {
|
|
|
+ if (tabType === 'All Notifications') {
|
|
|
tabCountList.value = data.countList
|
|
|
- notificationList.value = [...notificationList.value, ...data.cardList]
|
|
|
+ if (isChangeNav) {
|
|
|
+ notificationList.value = [...data.cardList]
|
|
|
+ } else {
|
|
|
+ notificationList.value = [...notificationList.value, ...data.cardList]
|
|
|
+ }
|
|
|
} else if (tabType === 'Unread') {
|
|
|
unreadNotificationList.value = [...unreadNotificationList.value, ...data.cardList]
|
|
|
} else {
|
|
|
@@ -125,7 +132,7 @@ const getNotificationList = async (tabType: string = 'All Notification') => {
|
|
|
loading.value = false
|
|
|
curTabCount.value = []
|
|
|
notificationMessageCardRef.value.loading = false
|
|
|
- pageInfo.value.cp += 1
|
|
|
+ isChangeNav && (pageInfo.value.cp += 1)
|
|
|
})
|
|
|
} catch (error) {
|
|
|
loading.value = false
|
|
|
@@ -135,7 +142,7 @@ const getNotificationList = async (tabType: string = 'All Notification') => {
|
|
|
const notificationMessageCardRef = ref()
|
|
|
const handleMessageLoading = async () => {
|
|
|
pageInfo.value.cp += 1
|
|
|
- await getNotificationList()
|
|
|
+ await getNotificationList(activeTabName.value)
|
|
|
}
|
|
|
|
|
|
const changeCardRead = () => {
|
|
|
@@ -156,7 +163,8 @@ const handleTabChange = () => {
|
|
|
// item.info.isRead = true
|
|
|
// }
|
|
|
// })
|
|
|
- getNotificationList(activeTabName.value)
|
|
|
+ pageInfo.value.cp = 1
|
|
|
+ getNotificationList(activeTabName.value, true)
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|