语音通话展示

This commit is contained in:
2022-02-21 13:24:52 +08:00
parent f4b06bbf01
commit 31ff366457
4 changed files with 25 additions and 11 deletions

View File

@@ -22,10 +22,10 @@
<view class="preview" v-if="msg.objectName=='RC:LBSMsg'">
<text v-if="conversationType == 3">{{ user.name }}</text>[位置]
</view>
<view class="preview" v-if="msg.objectName=='RC:InfoNtf' && msg.message=='0'">
<view class="preview" v-if="msg.objectName=='RC:InfoNtf' && JSON.parse(msg.message).mediaType=='0'">
<text v-if="conversationType == 3">{{ user.name }}</text>[语音通话]
</view>
<view class="preview" v-if="msg.objectName=='RC:InfoNtf' && msg.message=='1'">
<view class="preview" v-if="msg.objectName=='RC:InfoNtf' && JSON.parse(msg.message).mediaType=='1'">
<text v-if="conversationType == 3">{{ user.name }}</text>[视频通话]
</view>
<view class="preview" v-if="msg.objectName=='RC:GrpNtf'">

View File

@@ -2,8 +2,12 @@
<view class="msg--text">
<text class="name" v-if="!guest && name">{{ name }}</text>
<view>
<text class="im--text" :class="guest ? 'right': 'left'" v-if="msg.message == '1'">语音通话</text>
<text class="im--text" :class="guest ? 'right': 'left'" v-else>视频通话</text>
<text class="im--text" :class="guest ? 'right': 'left'" v-if="message.mediaType == '1'">
<u-icon name="camera" /> {{ message.connected ? '通话时长' + message.duration : '未接通' }}
</text>
<text class="im--text" :class="guest ? 'right': 'left'" v-else>
<u-icon name="phone" /> {{ message.connected ? '通话时长' + message.duration : '未接通' }}
</text>
</view>
</view>
</template>
@@ -38,8 +42,13 @@
default: true
}
},
computed: {
message() {
return JSON.parse(this.msg.message)
}
},
mounted() {
console.log(this.msg);
console.log(this.message);
}
}
</script>

View File

@@ -73,7 +73,9 @@
// 关闭麦克风
micOff: false,
// 关闭扬声器
volumeOff: false
volumeOff: false,
// 通话时长
duration: 0
}
},
onLoad(e) {
@@ -84,7 +86,7 @@
// 进入页面开启外呼
if (this.isCall) {
CallLib.startSingleCall(this.targetId, this.mediaType, '');
if (this.mediaType == 1) {
if (this.mediaType == '1') {
const session = CallLib.getCurrentCallSession()
setTimeout(() => {
CallLib.setVideoView(session.mine.userId, this.$refs.bigVideoView.ref, 0, false)
@@ -136,8 +138,11 @@
const messageContent = {
objectName: 'RC:InfoNtf',
userInfo: this.$store.getters.sender,
message: String(this.mediaType),
extra: '这里传接通和时长信息',
message: JSON.stringify({
mediaType: this.mediaType,
connected: this.connected,
duration: this.duration
})
}
const sentTime = 0 // 消息的发送时间
IMLib.insertOutgoingMessage(conversationType, targetId, sentStatus, messageContent, sentTime,
@@ -175,7 +180,7 @@
// 设置链接状态
this.connected = true
// 视频通话,才开摄像头
if (this.mediaType == 1) {
if (this.mediaType == '1') {
const session = CallLib.getCurrentCallSession()
setTimeout(() => {
CallLib.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0, false)

View File

@@ -123,7 +123,7 @@
this.conversationType,
this.targetId,
0,
120,
20,
true,
(messages) => {
this.messages = messages