实现消息记录功能,包括增删改查和标记已读,优化消息列表展示和未读消息计数
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 22s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s

This commit is contained in:
孙诚
2025-12-29 14:18:09 +08:00
parent e613c88770
commit 13bf23a48c
12 changed files with 664 additions and 35 deletions

20
Web/src/stores/message.js Normal file
View File

@@ -0,0 +1,20 @@
import { ref } from 'vue'
import { defineStore } from 'pinia'
import { getUnreadCount } from '@/api/message'
export const useMessageStore = defineStore('message', () => {
const unreadCount = ref(0)
const updateUnreadCount = async () => {
try {
const res = await getUnreadCount()
if (res.success) {
unreadCount.value = res.data
}
} catch (error) {
console.error('获取未读消息数量失败', error)
}
}
return { unreadCount, updateUnreadCount }
})