mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-30 14:37:35 +08:00
fix: 站内信:从红点点进去又退出来,没有消退红点,新信息也没适配 #712
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
<i class="fas fa-compress" @click="minimize" title="最小化"></i>
|
<i class="fas fa-compress" @click="minimize" title="最小化"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<div :class="['tab', { active: activeTab === 'messages' }]" @click="activeTab = 'messages'">
|
<div :class="['tab', { active: activeTab === 'messages' }]" @click="switchToMessage">
|
||||||
站内信
|
站内信
|
||||||
</div>
|
</div>
|
||||||
<div :class="['tab', { active: activeTab === 'channels' }]" @click="switchToChannels">
|
<div :class="['tab', { active: activeTab === 'channels' }]" @click="switchToChannels">
|
||||||
@@ -147,7 +147,7 @@ const { fetchChannelUnread: refreshChannelUnread, setFromList: setChannelUnreadF
|
|||||||
useChannelsUnreadCount()
|
useChannelsUnreadCount()
|
||||||
let subscription = null
|
let subscription = null
|
||||||
|
|
||||||
const activeTab = ref('messages')
|
const activeTab = ref('channels')
|
||||||
const channels = ref([])
|
const channels = ref([])
|
||||||
const loadingChannels = ref(false)
|
const loadingChannels = ref(false)
|
||||||
const isFloatMode = computed(() => route.query.float === '1')
|
const isFloatMode = computed(() => route.query.float === '1')
|
||||||
@@ -159,6 +159,7 @@ async function fetchConversations() {
|
|||||||
toast.error('请先登录')
|
toast.error('请先登录')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/messages/conversations`, {
|
const response = await fetch(`${API_BASE_URL}/api/messages/conversations`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -215,11 +216,14 @@ async function fetchChannels() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function switchToMessage() {
|
||||||
|
activeTab.value = 'messages'
|
||||||
|
fetchConversations()
|
||||||
|
}
|
||||||
|
|
||||||
function switchToChannels() {
|
function switchToChannels() {
|
||||||
activeTab.value = 'channels'
|
activeTab.value = 'channels'
|
||||||
if (channels.value.length === 0) {
|
fetchChannels()
|
||||||
fetchChannels()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function goToChannel(id) {
|
async function goToChannel(id) {
|
||||||
@@ -244,12 +248,15 @@ async function goToChannel(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onActivated(async () => {
|
onActivated(async () => {
|
||||||
loading.value = true
|
|
||||||
currentUser.value = await fetchCurrentUser()
|
currentUser.value = await fetchCurrentUser()
|
||||||
|
|
||||||
if (currentUser.value) {
|
if (currentUser.value) {
|
||||||
await fetchConversations()
|
if (activeTab.value === 'messages') {
|
||||||
refreshGlobalUnreadCount() // Refresh global count when entering the list
|
await fetchConversations()
|
||||||
|
} else {
|
||||||
|
await fetchChannels()
|
||||||
|
}
|
||||||
|
refreshGlobalUnreadCount()
|
||||||
refreshChannelUnread()
|
refreshChannelUnread()
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (token && !isConnected.value) {
|
if (token && !isConnected.value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user