修改pageSize
This commit is contained in:
@@ -85,52 +85,44 @@
|
||||
<!-- 主聊天区域 -->
|
||||
<main class="chat-main" :class="{ 'sidebar-open': isSidebarOpen }">
|
||||
<template v-if="currentRoomId">
|
||||
<div class="chat-room-wrapper">
|
||||
<!-- 自动填充加载遮罩 -->
|
||||
<div v-if="autoFilling" class="auto-fill-mask">
|
||||
<div class="loading-spinner"></div>
|
||||
<div class="loading-text">正在加载历史消息...</div>
|
||||
</div>
|
||||
|
||||
<ChatRoom
|
||||
ref="chatRoomRef"
|
||||
:messages="messages"
|
||||
:current-user-id="loginDomain.user.userId"
|
||||
:room-name="currentRoom?.roomName"
|
||||
:meeting-url="currentMeetingUrl"
|
||||
:show-meeting="showMeetingIframe"
|
||||
:file-download-url="FILE_DOWNLOAD_URL"
|
||||
:has-more="hasMore"
|
||||
:loading-more="loadingMore"
|
||||
@send-message="handleSendMessage"
|
||||
@start-meeting="startMeeting"
|
||||
@download-file="downloadFile"
|
||||
@load-more="loadMoreMessages"
|
||||
>
|
||||
<template #header>
|
||||
<div class="chat-room-header">
|
||||
<div class="header-left">
|
||||
<div class="room-avatar-small">
|
||||
{{ currentRoom?.guestName?.substring(0, 1) }}
|
||||
</div>
|
||||
<div class="room-title-group">
|
||||
<div class="room-name-text">{{ currentRoom?.roomName }}</div>
|
||||
<div class="room-subtitle">
|
||||
工单 #{{ currentRoom?.workcaseId }} · {{ currentRoom?.guestName }}
|
||||
</div>
|
||||
<ChatRoom
|
||||
ref="chatRoomRef"
|
||||
:messages="messages"
|
||||
:current-user-id="loginDomain.user.userId"
|
||||
:room-name="currentRoom?.roomName"
|
||||
:meeting-url="currentMeetingUrl"
|
||||
:show-meeting="showMeetingIframe"
|
||||
:file-download-url="FILE_DOWNLOAD_URL"
|
||||
:has-more="hasMore"
|
||||
:loading-more="loadingMore"
|
||||
@send-message="handleSendMessage"
|
||||
@start-meeting="startMeeting"
|
||||
@download-file="downloadFile"
|
||||
@load-more="loadMoreMessages"
|
||||
>
|
||||
<template #header>
|
||||
<div class="chat-room-header">
|
||||
<div class="header-left">
|
||||
<div class="room-avatar-small">
|
||||
{{ currentRoom?.guestName?.substring(0, 1) }}
|
||||
</div>
|
||||
<div class="room-title-group">
|
||||
<div class="room-name-text">{{ currentRoom?.roomName }}</div>
|
||||
<div class="room-subtitle">
|
||||
工单 #{{ currentRoom?.workcaseId }} · {{ currentRoom?.guestName }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #action-area>
|
||||
<ElButton type="primary" @click="handleWorkcaseAction">
|
||||
<FileText :size="16" />
|
||||
{{ currentWorkcaseId ? '查看工单' : '创建工单' }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</ChatRoom>
|
||||
</div>
|
||||
<template #action-area>
|
||||
<ElButton type="primary" @click="handleWorkcaseAction">
|
||||
<FileText :size="16" />
|
||||
{{ currentWorkcaseId ? '查看工单' : '创建工单' }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</ChatRoom>
|
||||
</template>
|
||||
|
||||
<!-- 空状态 -->
|
||||
@@ -212,8 +204,8 @@ const userType = true //web端固定这个
|
||||
const loading = ref(false)
|
||||
const messageLoading = ref(false)
|
||||
const loadingMore = ref(false)
|
||||
// 自动填充加载状态
|
||||
const autoFilling = ref(false)
|
||||
// 自动填充加载状态(已禁用)
|
||||
// const autoFilling = ref(false)
|
||||
|
||||
// 分页状态
|
||||
const PAGE_SIZE = 20
|
||||
@@ -323,8 +315,8 @@ const loadMessages = async (roomId: string) => {
|
||||
const dataList = result.pageDomain.dataList || []
|
||||
messages.value = [...dataList].reverse()
|
||||
|
||||
// 首次加载后自动填充消息直到出现滚动条
|
||||
await autoFillMessages(roomId)
|
||||
// 首次加载后自动填充消息直到出现滚动条(已禁用)
|
||||
// await autoFillMessages(roomId)
|
||||
}
|
||||
// 加载完成后滚动到底部
|
||||
scrollToBottom()
|
||||
@@ -336,9 +328,10 @@ const loadMessages = async (roomId: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 自动填充消息直到出现滚动条
|
||||
// 自动填充消息直到出现滚动条(已禁用)
|
||||
/*
|
||||
const autoFillMessages = async (roomId: string) => {
|
||||
autoFilling.value = true
|
||||
// autoFilling.value = true
|
||||
console.log('[autoFill] 开始检查消息高度, hasMore:', hasMore.value, 'messages:', messages.value.length)
|
||||
|
||||
// 等待DOM渲染
|
||||
@@ -412,8 +405,9 @@ const autoFillMessages = async (roomId: string) => {
|
||||
|
||||
console.log(`[autoFill] 自动填充结束 - 共尝试${attempts}次, 最终消息数: ${messages.value.length}, hasMore: ${hasMore.value}`)
|
||||
|
||||
autoFilling.value = false
|
||||
// autoFilling.value = false
|
||||
}
|
||||
*/
|
||||
|
||||
// 加载更多历史消息(滚动到顶部触发)
|
||||
const loadMoreMessages = async () => {
|
||||
|
||||
Reference in New Issue
Block a user