mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-21 09:57:28 +08:00
Revert "feat: add message float components"
This reverts commit b0eef220a6.
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
<template>
|
||||
<div class="chat-container">
|
||||
<div class="window-controls">
|
||||
<button v-if="!isFloat" @click="shrink" class="control-btn">
|
||||
<i class="fas fa-window-minimize"></i>
|
||||
</button>
|
||||
<button v-else @click="expand" class="control-btn">
|
||||
<i class="fas fa-expand"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="!loading" class="chat-header">
|
||||
<NuxtLink to="/message-box" class="back-button">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
@@ -81,11 +73,9 @@ import { useChannelsUnreadCount } from '~/composables/useChannelsUnreadCount'
|
||||
import TimeManager from '~/utils/time'
|
||||
import BaseTimeline from '~/components/BaseTimeline.vue'
|
||||
import BasePlaceholder from '~/components/BasePlaceholder.vue'
|
||||
import { openMessageFloat } from '~/composables/useMessageFloat'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const API_BASE_URL = config.public.apiBaseUrl
|
||||
const { connect, disconnect, subscribe, isConnected } = useWebSocket()
|
||||
const { fetchUnreadCount: refreshGlobalUnreadCount } = useUnreadCount()
|
||||
@@ -107,7 +97,6 @@ const loadingMore = ref(false)
|
||||
let scrollInterval = null
|
||||
const conversationName = ref('')
|
||||
const isChannel = ref(false)
|
||||
const isFloat = computed(() => route.query.float === '1')
|
||||
|
||||
const hasMoreMessages = computed(() => currentPage.value < totalPages.value - 1)
|
||||
|
||||
@@ -126,24 +115,6 @@ function handleAvatarError(event) {
|
||||
event.target.src = '/default-avatar.svg'
|
||||
}
|
||||
|
||||
function shrink() {
|
||||
openMessageFloat(route.fullPath)
|
||||
router.push('/')
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const base = route.fullPath.replace(/(\?|&)float=1/, '')
|
||||
window.top.location.href = base
|
||||
}
|
||||
|
||||
function openUser(id) {
|
||||
if (isFloat.value) {
|
||||
window.top.location.href = `/users/${id}`
|
||||
} else {
|
||||
navigateTo(`/users/${id}`, { replace: true })
|
||||
}
|
||||
}
|
||||
|
||||
// No changes needed here, as renderMarkdown is now imported.
|
||||
// The old function is removed.
|
||||
|
||||
@@ -185,7 +156,7 @@ async function fetchMessages(page = 0) {
|
||||
...item,
|
||||
src: item.sender.avatar,
|
||||
iconClick: () => {
|
||||
openUser(item.sender.id)
|
||||
navigateTo(`/users/${item.sender.id}`, { replace: true })
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -265,7 +236,7 @@ async function sendMessage(content, clearInput) {
|
||||
...newMessage,
|
||||
src: newMessage.sender.avatar,
|
||||
iconClick: () => {
|
||||
openUser(newMessage.sender.id)
|
||||
navigateTo(`/users/${newMessage.sender.id}`, { replace: true })
|
||||
},
|
||||
})
|
||||
clearInput()
|
||||
@@ -351,7 +322,7 @@ watch(isConnected, (newValue) => {
|
||||
...message,
|
||||
src: message.sender.avatar,
|
||||
iconClick: () => {
|
||||
openUser(message.sender.id)
|
||||
navigateTo(`/users/${message.sender.id}`, { replace: true })
|
||||
},
|
||||
})
|
||||
// 实时收到消息时自动标记为已读
|
||||
@@ -417,21 +388,6 @@ onUnmounted(() => {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.window-controls {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.control-btn {
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
color: var(--text-color-primary);
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.chat-header {
|
||||
display: flex;
|
||||
position: sticky;
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
<template>
|
||||
<div class="messages-container">
|
||||
<div class="window-controls">
|
||||
<button v-if="!isFloat" @click="shrink" class="control-btn">
|
||||
<i class="fas fa-window-minimize"></i>
|
||||
</button>
|
||||
<button v-else @click="expand" class="control-btn">
|
||||
<i class="fas fa-expand"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<div :class="['tab', { active: activeTab === 'messages' }]" @click="activeTab = 'messages'">
|
||||
站内信
|
||||
@@ -122,8 +114,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onUnmounted, watch, onActivated, computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { ref, onUnmounted, watch, onActivated } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getToken, fetchCurrentUser } from '~/utils/auth'
|
||||
import { toast } from '~/main'
|
||||
import { useWebSocket } from '~/composables/useWebSocket'
|
||||
@@ -133,15 +125,12 @@ import TimeManager from '~/utils/time'
|
||||
import { stripMarkdownLength } from '~/utils/markdown'
|
||||
import SearchPersonDropdown from '~/components/SearchPersonDropdown.vue'
|
||||
import BasePlaceholder from '~/components/BasePlaceholder.vue'
|
||||
import { openMessageFloat } from '~/composables/useMessageFloat'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const conversations = ref([])
|
||||
const loading = ref(true)
|
||||
const error = ref(null)
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const isFloat = computed(() => route.query.float === '1')
|
||||
const currentUser = ref(null)
|
||||
const API_BASE_URL = config.public.apiBaseUrl
|
||||
const { connect, disconnect, subscribe, isConnected } = useWebSocket()
|
||||
@@ -154,16 +143,6 @@ const activeTab = ref('messages')
|
||||
const channels = ref([])
|
||||
const loadingChannels = ref(false)
|
||||
|
||||
function shrink() {
|
||||
openMessageFloat(route.fullPath)
|
||||
router.push('/')
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const base = route.fullPath.replace(/(\?|&)float=1/, '')
|
||||
window.top.location.href = base
|
||||
}
|
||||
|
||||
async function fetchConversations() {
|
||||
const token = getToken()
|
||||
if (!token) {
|
||||
@@ -299,21 +278,6 @@ function goToConversation(id) {
|
||||
|
||||
<style scoped>
|
||||
.messages-container {
|
||||
position: relative;
|
||||
}
|
||||
.window-controls {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.control-btn {
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
color: var(--text-color-primary);
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
|
||||
Reference in New Issue
Block a user