|
|
|
@ -40,7 +40,7 @@ export class ChatWindowComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await signalR.initSR(this.taskId); |
|
|
|
|
await this.getAllMessages(); |
|
|
|
|
|
|
|
|
|
// 接收来自中心的消息
|
|
|
|
|
(signalR.SR as any).on('receiveMessage', (message: any) => { |
|
|
|
|
console.log('收到消息', message) |
|
|
|
@ -50,7 +50,28 @@ export class ChatWindowComponent implements OnInit {
|
|
|
|
|
this.scrollToBottom() |
|
|
|
|
}, 0); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 接收群组信息
|
|
|
|
|
(signalR.SR as any).on('receiveGroup', (group: any) => { |
|
|
|
|
try { |
|
|
|
|
console.log('收到群组信息', group) |
|
|
|
|
this.isLoading = true |
|
|
|
|
this.MessagesList = group.taskChatMessages || []; |
|
|
|
|
this.members = group.members || []; |
|
|
|
|
this.members.forEach(item => { |
|
|
|
|
this.chatName += (item.name || '') + ' ' |
|
|
|
|
}); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.scrollToBottom() |
|
|
|
|
}, 0); |
|
|
|
|
this.isLoading = false |
|
|
|
|
console.log('chatName', this.chatName) |
|
|
|
|
console.log('消息列表', this.MessagesList) |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log(error, 'error') |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 消息列表 |
|
|
|
|