移动端聊天实现

This commit is contained in:
2023-10-08 21:38:22 +08:00
parent 7aa2e17897
commit df59768830
25 changed files with 505 additions and 377 deletions

View File

@@ -174,7 +174,7 @@
onLoad(e) {
// // 监听接收聊天信息
// uni.$on('onP2PMessage', this.onMessage)
uni.$on('onP2PMessage', this.onMessage)
this.talkTo = e;
console.log(this.talkTo)
@@ -232,8 +232,6 @@
);
},
onPageScroll() {
this.clickToSubmitSure();
@@ -267,7 +265,19 @@
},
methods: {
onMessage(message) {
//判断当前是单聊还是群聊
if (this.talkTo.windowType != 'SINGLE') {
return;
}
//如果是单聊,则判断当前消息发送人是不是当前窗口的聊天对象
if(this.talkTo.userId!=message.fromId){
return;
}
console.log("message 聊天页收到回调")
console.log(message)
//如果当前消息发送人和当前窗口的聊天对象一致,则发送已读回执
console.log("########### 此时需要发送已读回执 ###########")
this.$store.dispatch('sendP2PMessageReciveAck',message)
},
addMsg(e) {
this.msg += e;