app发送文字消息

This commit is contained in:
2023-09-27 22:16:03 +08:00
parent 72dc5e7cb3
commit 1459ec3656
4 changed files with 9 additions and 6 deletions

View File

@@ -600,6 +600,7 @@ export default {
var msgOnlie = {} var msgOnlie = {}
//聊天记录 //聊天记录
var msgList = {} var msgList = {}
debugger
var url = '' var url = ''
if (windowType == 'SINGLE') { if (windowType == 'SINGLE') {
msgOnlie = { msgOnlie = {
@@ -665,7 +666,7 @@ export default {
type: 3 type: 3
}; };
var msgSendType = 'wating'; var msgSendType = 'wating';
debugger
//开始发送消息 //开始发送消息
store.dispatch('sendMsg', { store.dispatch('sendMsg', {
userId: userId, userId: userId,

View File

@@ -36,9 +36,10 @@ export default {
console.log("onP2PMessage " + e); console.log("onP2PMessage " + e);
e = JSON.parse(e) e = JSON.parse(e)
e.data.pushType="MSG" e.data.pushType="MSG"
const _data=JSON.parse(e.data.messageBody)
e.data.msgContent={ e.data.msgContent={
msgType:"TEXT", msgType:"TEXT",
content:e.data.messageBody, content:_data.content,
disturb:false, disturb:false,
top:false, top:false,
} }

View File

@@ -66,6 +66,7 @@ import { createStore } from 'vuex'
console.log("========================") console.log("========================")
console.log("========================") console.log("========================")
console.error(data) console.error(data)
debugger
_im.sendP2PMessage(_im.createP2PTextMessage(data.userId,data.data.content)) _im.sendP2PMessage(_im.createP2PTextMessage(data.userId,data.data.content))
}, },
updateChatDataState(context,data){ updateChatDataState(context,data){
@@ -165,10 +166,6 @@ import { createStore } from 'vuex'
// }) // })
_im.getSingleUserInfo(userId).then((res)=>{ _im.getSingleUserInfo(userId).then((res)=>{
console.log(res.data)
console.log(res.data)
console.log(res.data)
console.log(res.data)
if (res.code == 200) { if (res.code == 200) {
var detail=res.data var detail=res.data
data1[userId]={ data1[userId]={

View File

@@ -177,6 +177,7 @@
// uni.$on('onP2PMessage', this.onMessage) // uni.$on('onP2PMessage', this.onMessage)
this.talkTo = e; this.talkTo = e;
console.log(this.talkTo)
// 根据Id // 根据Id
this.$store this.$store
.dispatch('createChatObj', { .dispatch('createChatObj', {
@@ -185,6 +186,9 @@
}) })
.then(res => { .then(res => {
this.localData = res.data; this.localData = res.data;
console.log(res.data)
if (e.windowType == 'SINGLE') { if (e.windowType == 'SINGLE') {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.localData.fromInfo.nickName title: this.localData.fromInfo.nickName