|
|
@@ -65,7 +65,7 @@ if (locale in languageMap) {
|
|
|
}
|
|
|
|
|
|
const { userLogout } = useLogin()
|
|
|
-const { backHome } = useNavigation()
|
|
|
+const { backHome, route } = useNavigation()
|
|
|
|
|
|
const loginStore = useLoginStore()
|
|
|
const noticeStore = useNoticeStore()
|
|
|
@@ -128,23 +128,26 @@ eventBus.$on('LogoutNotify', (msg) => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
-watch(() => noticeStore.isInitialized, () => {
|
|
|
- const readKey = 'read_' + loginStore.loginId
|
|
|
- const readValue = formatDate(new Date().toISOString(), 'YYYY-MM-DD')
|
|
|
-
|
|
|
- const storageValue = localStorage.getItem(readKey)
|
|
|
- const showUnread = props.showUnread && storageValue !== readValue // 未读消息一天内只会弹框一次
|
|
|
-
|
|
|
- // 过滤数据
|
|
|
- const filteredData = noticeStore.localizedDataList.filter((e) => (showUnread && !e.readed) || e.isforcedisplay)
|
|
|
- // 浅拷贝,防止数据引用
|
|
|
- message.dataList = filteredData.map((e) => ({ ...e }))
|
|
|
-
|
|
|
- if (message.dataList.length) {
|
|
|
- localStorage.setItem(readKey, readValue) // 记录用户已读日期
|
|
|
- message.index = 0
|
|
|
- message.show = true
|
|
|
- noticeStore.updateNoticeReaded(message.dataList[0].autoid)
|
|
|
+watch(() => [noticeStore.isInitialized, route.name], ([isInitialized, routeName]) => {
|
|
|
+ if (routeName !== 'boot' && isInitialized) {
|
|
|
+ const readKey = 'read_' + loginStore.loginId
|
|
|
+ const readValue = formatDate(new Date().toISOString(), 'YYYY-MM-DD')
|
|
|
+
|
|
|
+ const storageValue = localStorage.getItem(readKey)
|
|
|
+ const showUnread = props.showUnread && storageValue !== readValue // 未读消息一天内只会弹框一次
|
|
|
+
|
|
|
+ // 过滤数据
|
|
|
+ const filteredData = noticeStore.localizedDataList.filter((e) => (showUnread && !e.readed) || e.isforcedisplay)
|
|
|
+ // 浅拷贝,防止数据引用
|
|
|
+ message.dataList = filteredData.map((e) => ({ ...e }))
|
|
|
+
|
|
|
+ if (message.dataList.length) {
|
|
|
+ localStorage.setItem(readKey, readValue) // 记录用户已读日期
|
|
|
+ message.index = 0
|
|
|
+ message.show = true
|
|
|
+ noticeStore.updateNoticeReaded(message.dataList[0].autoid)
|
|
|
+ noticeStore.setUninitialized()
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|