聊天室创建逻辑修改和样式修正

This commit is contained in:
2025-12-30 20:55:25 +08:00
parent babfe9fb48
commit f287f36496
14 changed files with 591 additions and 312 deletions

View File

@@ -13,6 +13,7 @@ export interface TbChatRoomDTO extends BaseDTO {
status?: string
guestId?: string
guestName?: string
deviceCode?: string
aiSessionId?: string
currentAgentId?: string
agentCount?: number
@@ -164,6 +165,7 @@ export interface ChatRoomVO extends BaseVO {
status?: string
guestId?: string
guestName?: string
deviceCode?: string
aiSessionId?: string
currentAgentId?: string
currentAgentName?: string

View File

@@ -189,7 +189,7 @@ import { Client } from '@stomp/stompjs'
// WebSocket配置 (通过Nginx代理访问网关再到workcase服务)
// SockJS URL (http://)
const getWsUrl = () => {
const token = localStorage.getItem('token')!
const token = JSON.parse(localStorage.getItem('token')!).value
const protocol = window.location.protocol
const host = window.location.host
return `${protocol}//${host}/api/urban-lifeline/workcase/ws/chat-sockjs?token=${encodeURIComponent(token)}`
@@ -557,32 +557,6 @@ const startMeeting = async () => {
}
return
}
// 没有活跃会议,创建新会议
const createResult = await workcaseChatAPI.createVideoMeeting({
roomId: currentRoomId.value,
meetingName: currentRoom.value?.roomName || '视频会议'
})
if (createResult.success && createResult.data) {
const currentMeetingId = createResult.data.meetingId!
// 开始会议
await workcaseChatAPI.startVideoMeeting(currentMeetingId)
// 加入会议获取会议页面URL
const joinResult = await workcaseChatAPI.joinVideoMeeting(currentMeetingId)
if (joinResult.success && joinResult.data?.iframeUrl) {
// 使用router跳转到JitsiMeetingView页面附加roomId参数用于返回
const meetingUrl = joinResult.data.iframeUrl + `&roomId=${currentRoomId.value}`
router.push(meetingUrl)
ElMessage.success('会议已创建')
} else {
ElMessage.error(joinResult.message || '获取会议链接失败')
}
} else {
ElMessage.error(createResult.message || '创建会议失败')
}
} catch (error) {
console.error('发起会议失败:', error)
ElMessage.error('发起会议失败')
@@ -707,8 +681,16 @@ const subscribeToRoom = (roomId: string) => {
// 避免重复添加自己发送的普通消息
// 但会议消息meet类型始终添加因为它是系统生成的通知
if (chatMessage.messageType === 'meet' || chatMessage.senderId !== loginDomain.user.userId) {
messages.value.push(chatMessage)
scrollToBottom()
// 会议消息延时处理,等待数据库事务提交
if (chatMessage.messageType === 'meet') {
console.log('[ChatRoom] 收到会议消息延时1秒后刷新')
setTimeout(() => {
loadMessages(roomId)
}, 1000)
} else {
messages.value.push(chatMessage)
scrollToBottom()
}
}
})
}