私聊中头像错误展示

This commit is contained in:
2022-02-16 16:58:45 +08:00
parent fe9b79a18d
commit 255a727d32
8 changed files with 43 additions and 38 deletions

View File

@@ -64,7 +64,7 @@
}
},
computed: {
user() {
sender() {
return this.$store.getters.sender
}
},
@@ -87,8 +87,7 @@
sourceType: ['album'],
success: res => {
im.sentImage(this.conversationType, this.targetId, res.tempFilePaths[0],
this.user, (
res) => {
this.sender, (res) => {
this.success()
})
}
@@ -99,8 +98,7 @@
sourceType: ['camera'],
success: res => {
im.sentImage(this.conversationType, this.targetId, res.tempFilePaths[0],
this.user, (
res) => {
this.sender, (res) => {
this.success()
})
}

View File

@@ -29,7 +29,7 @@
disabled() {
return this.inputTxt.length === 0
},
user() {
sender() {
return this.$store.getters.sender
}
},
@@ -50,7 +50,7 @@
sent() {
if (!this.disabled) {
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
im.sentText(this.conversationType, this.targetId, this.inputTxt, this.user, () => {
im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => {
this.$emit('success')
this.inputTxt = ''
})

View File

@@ -36,7 +36,7 @@
}
},
computed: {
user() {
sender() {
return this.$store.getters.sender
}
},
@@ -85,8 +85,7 @@
// 监听录音结束
this.recorderManager.onStop(res => {
im.sentVoice(this.conversationType, this.targetId, res.tempFilePath, (this.maxRecordTime -
this
.recordTime), this.user, () => {
this.recordTime), this.sender, () => {
setTimeout(() => {
this.$emit('success')
}, 500)

View File

@@ -8,7 +8,7 @@
</view>
<view class="cell-item" :class="item.messageDirection == 1 ? 'right' : 'left'">
<u-avatar class="avatar" size="36" shape="square" @click="showUser(targetId, item.messageDirection)"
:src="userInfo.portraitUrl" />
:src="contact(item.senderUserId).portraitUrl" />
<view class="msg">
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
:msg="item.content" />
@@ -69,6 +69,11 @@
sentTime: 0
}
}
},
contact() {
return function(targetId) {
return this.$store.getters.contactInfo(targetId)
}
}
},
onLoad(e) {
@@ -113,6 +118,7 @@
1,
false,
(messages) => {
console.log(messages);
this.messages = this.messages.concat(messages)
this.scrollBottom()
})
@@ -126,6 +132,7 @@
100,
true,
(messages) => {
console.log(messages);
this.messages = messages.reverse()
this.scrollBottom()
})

View File

@@ -109,8 +109,7 @@ class userAuth {
.access_token)
// 在这里登录成功链接IM服务
getImToken().then(res => {
console.log('在这获取IM-TOKEN', res);
im.connect(res.token, res.userInfo)
im.connect(res.token, res.userInfo, () => {})
})
resolve()
}).catch(err => {

View File

@@ -151,14 +151,15 @@ const sentImage = (conversationType, targetId, imageUrl, user, callback) => {
})
}
const sentGif = (conversationType, targetId, gifUrl, time, callback) => {
const sentGif = (conversationType, targetId, gifUrl, time, user, callback) => {
const msg = {
conversationType: conversationType,
targetId: String(targetId),
content: {
objectName: 'RC:GIFMsg',
local: 'file:///' + plus.io.convertLocalFileSystemURL(gifUrl),
duration: time
duration: time,
userInfo: user
}
}
RongIMLib.sendMediaMessage(msg, {
@@ -177,14 +178,15 @@ const sentGif = (conversationType, targetId, gifUrl, time, callback) => {
})
}
const sendFile = (conversationType, targetId, fileUrl, time, callback) => {
const sendFile = (conversationType, targetId, fileUrl, time, user, callback) => {
const msg = {
conversationType: conversationType,
targetId: String(targetId),
content: {
objectName: 'RC:FileMsg',
local: 'file:///' + plus.io.convertLocalFileSystemURL(fileUrl),
duration: time
duration: time,
userInfo: user
}
}
RongIMLib.sendMediaMessage(msg, {