|
|
@@ -71,17 +71,12 @@ const setActiveItem = (item: string) => {
|
|
|
const loading = ref(false)
|
|
|
const notificationList = ref<any[]>([])
|
|
|
|
|
|
-// const unreadNotificationList = computed(() => {
|
|
|
-// return notificationList.value.filter((item) => !item.info.isRead)
|
|
|
-// })
|
|
|
const unreadNotificationList = ref<any[]>([])
|
|
|
-// const readNotificationList = computed(() => {
|
|
|
-// return notificationList.value.filter((item) => item.info.isRead)
|
|
|
-// })
|
|
|
+
|
|
|
const readNotificationList = ref<any[]>([])
|
|
|
const pageInfo = ref({
|
|
|
cp: 0,
|
|
|
- ps: 5
|
|
|
+ ps: 7
|
|
|
})
|
|
|
const getNotificationList = async (
|
|
|
tabType: string = 'All Notifications',
|
|
|
@@ -94,6 +89,11 @@ const getNotificationList = async (
|
|
|
unreadNotificationList.value = []
|
|
|
readNotificationList.value = []
|
|
|
notificationList.value = []
|
|
|
+ if (activeCardTypeName.value === 'Feature Update') {
|
|
|
+ pageInfo.value.ps = 100
|
|
|
+ } else {
|
|
|
+ pageInfo.value.ps = 7
|
|
|
+ }
|
|
|
} else {
|
|
|
pageInfo.value.cp += 1
|
|
|
}
|
|
|
@@ -108,6 +108,7 @@ const getNotificationList = async (
|
|
|
} else {
|
|
|
info_type = false
|
|
|
}
|
|
|
+
|
|
|
try {
|
|
|
await notificationMsgStore.markMessageAsRead()
|
|
|
$api
|
|
|
@@ -118,61 +119,38 @@ const getNotificationList = async (
|
|
|
info_type
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // const data = res.data
|
|
|
- // if (!data?.cardList?.length || data?.cardList?.length < pageInfo.value.ps) {
|
|
|
- // notificationMessageCardRef.value.finished = true
|
|
|
- // }
|
|
|
-
|
|
|
- // if (tabType === 'All Notifications') {
|
|
|
- // tabCountList.value = data.countList
|
|
|
- // if (isChangeNav) {
|
|
|
- // notificationList.value = [...data.cardList]
|
|
|
- // } else {
|
|
|
- // notificationList.value = [...notificationList.value, ...data.cardList]
|
|
|
- // }
|
|
|
- // } else if (tabType === 'Unread') {
|
|
|
- // if (isChangeNav) {
|
|
|
- // unreadNotificationList.value = [...data.cardList]
|
|
|
- // } else {
|
|
|
- // unreadNotificationList.value = [...unreadNotificationList.value, ...data.cardList]
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if (isChangeNav) {
|
|
|
- // readNotificationList.value = [...data.cardList]
|
|
|
- // } else {
|
|
|
- // readNotificationList.value = [...readNotificationList.value, ...data.cardList]
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- const data = res.data
|
|
|
+ if (res.code === 200) {
|
|
|
+ const data = res.data
|
|
|
|
|
|
- // 判断是否结束加载
|
|
|
- if (!data?.cardList?.length || data.cardList.length < pageInfo.value.ps) {
|
|
|
- notificationMessageCardRef.value.finished = true
|
|
|
- }
|
|
|
+ // 判断是否结束加载
|
|
|
+ if (!data?.cardList?.length || data.cardList.length < pageInfo.value.ps) {
|
|
|
+ notificationMessageCardRef.value.finished = true
|
|
|
+ }
|
|
|
|
|
|
- const lists = {
|
|
|
- 'All Notifications': { list: notificationList, count: tabCountList },
|
|
|
- Unread: { list: unreadNotificationList },
|
|
|
- Read: { list: readNotificationList }
|
|
|
- }
|
|
|
+ const lists = {
|
|
|
+ 'All Notifications': { list: notificationList, count: tabCountList },
|
|
|
+ Unread: { list: unreadNotificationList },
|
|
|
+ Read: { list: readNotificationList }
|
|
|
+ }
|
|
|
|
|
|
- const config = lists[tabType]
|
|
|
- if (config) {
|
|
|
- config.list.value = isChangeNav
|
|
|
- ? [...data.cardList]
|
|
|
- : [...config.list.value, ...data.cardList]
|
|
|
- }
|
|
|
+ const config = lists[tabType]
|
|
|
+ if (config) {
|
|
|
+ config.list.value = isChangeNav
|
|
|
+ ? [...data.cardList]
|
|
|
+ : [...config.list.value, ...data.cardList]
|
|
|
+ }
|
|
|
|
|
|
- if (config?.count) {
|
|
|
- config.count.value = data.countList
|
|
|
+ if (config?.count) {
|
|
|
+ config.count.value = data.countList
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
|
loading.value = false
|
|
|
curTabCount.value = []
|
|
|
notificationMessageCardRef.value.loading = false
|
|
|
+
|
|
|
+ notificationMessageCardRef.value.adjustScrollTop()
|
|
|
})
|
|
|
} catch (error) {
|
|
|
loading.value = false
|
|
|
@@ -277,11 +255,10 @@ onMounted(() => {
|
|
|
<div
|
|
|
class="count"
|
|
|
:style="{ 'padding-top': isMac ? 0 : '1px' }"
|
|
|
- v-if="unreadNotificationList.length > 0 || unreadCardCount > 0"
|
|
|
+ v-if="unreadNotificationList.length > 0 && unreadCardCount > 0"
|
|
|
>
|
|
|
- <span>{{
|
|
|
- handleCount(unreadNotificationList.length) || handleCount(unreadCardCount)
|
|
|
- }}</span>
|
|
|
+ <!-- handleCount(unreadNotificationList.length) || -->
|
|
|
+ <span>{{ handleCount(unreadCardCount) }}</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
<div style="padding-bottom: 20px" v-if="activeTabName === 'Unread'">
|