修改版本
This commit is contained in:
@@ -1,101 +1,102 @@
|
||||
<script setup lang="ts">
|
||||
// import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index.esm'
|
||||
import ToolbarItemContainer from '../toolbar-item-container/index.vue'
|
||||
import custom from '../../../../assets/icon/telephone-icon.svg'
|
||||
import videoIcon from '../../../../assets/icon/video-icon.svg'
|
||||
import { isUniFrameWork } from '../../../../utils/env'
|
||||
import { computed, ref } from 'vue'
|
||||
import { type IConversationModel } from '@tencentcloud/chat-uikit-engine-lite'
|
||||
// import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index.esm'
|
||||
import ToolbarItemContainer from '../toolbar-item-container/index.vue'
|
||||
import custom from '../../../../assets/icon/telephone-icon.svg'
|
||||
import videoIcon from '../../../../assets/icon/video-icon.svg'
|
||||
import { isUniFrameWork } from '../../../../utils/env'
|
||||
import { computed, ref } from 'vue'
|
||||
import { type IConversationModel } from '@tencentcloud/chat-uikit-engine-lite'
|
||||
|
||||
// CallLib.init({});
|
||||
// CallLib.init({});
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 通话状态: 0 语音 1 视频 */
|
||||
type?: '0' | '1'
|
||||
/** 信息数据 */
|
||||
currentConversation?: IConversationModel
|
||||
}>(),
|
||||
{
|
||||
type: '0',
|
||||
currentConversation: () => ({} as IConversationModel)
|
||||
}
|
||||
)
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 通话状态: 0 语音 1 视频 */
|
||||
type?: '0' | '1'
|
||||
/** 信息数据 */
|
||||
currentConversation?: IConversationModel
|
||||
}>(),
|
||||
{
|
||||
type: '0',
|
||||
currentConversation: () => ({} as IConversationModel)
|
||||
}
|
||||
)
|
||||
|
||||
/** 语音通话状态 */
|
||||
const isType = computed(() => props.type === '0')
|
||||
|
||||
const evaluateIcon = isType.value ? custom : videoIcon
|
||||
/** 语音通话状态 */
|
||||
const isType = computed(() => props.type === '0')
|
||||
|
||||
const emits = defineEmits(['onDialogPopupShowOrHide'])
|
||||
const evaluateIcon = isType.value ? custom : videoIcon
|
||||
|
||||
const container = ref()
|
||||
const closeDialog = () => {
|
||||
container?.value?.toggleDialogDisplay(false)
|
||||
}
|
||||
const emits = defineEmits(['onDialogPopupShowOrHide'])
|
||||
|
||||
const onDialogShow = () => {
|
||||
console.log('弹出窗口', isType.value)
|
||||
console.log('弹出窗口', props.currentConversation)
|
||||
let targetId = props.currentConversation.userProfile.userID
|
||||
// emits('onDialogPopupShowOrHide', true)
|
||||
callOut('single', isType.value ? 'audio' : 'video', targetId)
|
||||
}
|
||||
const container = ref()
|
||||
const closeDialog = () => {
|
||||
container?.value?.toggleDialogDisplay(false)
|
||||
}
|
||||
|
||||
function callOut(callSelect, mediaSelect, targetId) {
|
||||
console.log('callSelect: ', callSelect)
|
||||
console.log('mediaSelect: ', mediaSelect)
|
||||
console.log('targetId: ', targetId)
|
||||
//单聊音频
|
||||
if (callSelect === 'single' && mediaSelect === 'audio') {
|
||||
if (targetId === '') {
|
||||
uni.showToast({
|
||||
title: '请输入对方ID',
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
callMsg(mediaSelect, targetId, callSelect)
|
||||
} else if (callSelect === 'single' && mediaSelect === 'video') {
|
||||
if (targetId === '') {
|
||||
uni.showToast({
|
||||
title: '请输入对方ID',
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
//单聊视频
|
||||
callMsg(mediaSelect, targetId, callSelect)
|
||||
}
|
||||
}
|
||||
const onDialogShow = () => {
|
||||
console.log('弹出窗口', isType.value)
|
||||
console.log('弹出窗口', props.currentConversation)
|
||||
let targetId = props.currentConversation.userProfile.userID
|
||||
// emits('onDialogPopupShowOrHide', true)
|
||||
callOut('single', isType.value ? 'audio' : 'video', targetId)
|
||||
}
|
||||
|
||||
function callMsg(mediaSelect, targetId, callSelect) {
|
||||
console.log(targetId)
|
||||
console.log(mediaSelect)
|
||||
uni.setStorageSync('room-parameters', {
|
||||
callType: 'out',
|
||||
mediaType: mediaSelect,
|
||||
targetId: targetId,
|
||||
callSelect: callSelect
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: '/pages/room/room'
|
||||
})
|
||||
}
|
||||
function callOut(callSelect, mediaSelect, targetId) {
|
||||
console.log('callSelect: ', callSelect)
|
||||
console.log('mediaSelect: ', mediaSelect)
|
||||
console.log('targetId: ', targetId)
|
||||
//单聊音频
|
||||
if (callSelect === 'single' && mediaSelect === 'audio') {
|
||||
if (targetId === '') {
|
||||
uni.showToast({
|
||||
title: '请输入对方ID',
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
callMsg(mediaSelect, targetId, callSelect)
|
||||
} else if (callSelect === 'single' && mediaSelect === 'video') {
|
||||
if (targetId === '') {
|
||||
uni.showToast({
|
||||
title: '请输入对方ID',
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
//单聊视频
|
||||
callMsg(mediaSelect, targetId, callSelect)
|
||||
}
|
||||
}
|
||||
|
||||
const onDialogClose = () => {
|
||||
console.log('关闭窗口')
|
||||
emits('onDialogPopupShowOrHide', false)
|
||||
}
|
||||
function callMsg(mediaSelect, targetId, callSelect) {
|
||||
console.log(targetId)
|
||||
console.log(mediaSelect)
|
||||
uni.setStorageSync('room-parameters', {
|
||||
callType: 'out',
|
||||
mediaType: mediaSelect,
|
||||
targetId: targetId,
|
||||
callSelect: callSelect
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: '/pages/room/room'
|
||||
})
|
||||
}
|
||||
|
||||
const onDial = () => {
|
||||
const data = props.currentConversation.userProfile
|
||||
// data.userID
|
||||
CallLib.enableMicrophone(true)
|
||||
CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
|
||||
}
|
||||
const onDialogClose = () => {
|
||||
console.log('关闭窗口')
|
||||
emits('onDialogPopupShowOrHide', false)
|
||||
}
|
||||
|
||||
const onDial = () => {
|
||||
const data = props.currentConversation.userProfile
|
||||
// data.userID
|
||||
CallLib.enableMicrophone(true)
|
||||
CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user