You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
import { getUnreadNotifyMessageCount } from '@/api/system/notify/message'
|
|
|
|
|
|
|
|
interface MessageState {
|
|
|
|
unreadCount: number // 未读消息数量
|
|
|
|
}
|
|
|
|
|
|
|
|
export const useUserMessageStore = defineStore('userMessage', {
|
|
|
|
state: (): MessageState => ({
|
|
|
|
unreadCount: 0,
|
|
|
|
}),
|
|
|
|
getters: {
|
|
|
|
getUnreadCount(state) {
|
|
|
|
return state.unreadCount
|
|
|
|
},
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
// 更新未读消息的数量
|
|
|
|
async updateUnreadCount() {
|
|
|
|
const count = await getUnreadNotifyMessageCount()
|
|
|
|
this.unreadCount = count
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|