修改版本

This commit is contained in:
bobobobo
2026-02-05 01:59:57 +08:00
parent a54dfee158
commit 2d503bab83
6 changed files with 154 additions and 121 deletions

View File

@@ -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>

View File

@@ -1,9 +1,9 @@
{
"name" : "密谈IM",
"appid" : "__UNI__BE00EFC",
"appid" : "__UNI__D40A151",
"description" : "",
"versionName" : "1.1.2",
"versionCode" : 111,
"versionName" : "1.1.3",
"versionCode" : 112,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@@ -112,13 +112,27 @@
}
},
"nativePlugins" : {
"RongCloud-Beauty" : {
"__plugin_info__" : {
"name" : "RCUniBeauty",
"description" : "融云基础版美颜插件,服务于 RCUniRtc 或 RCUniCall",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=7982",
"android_package_name" : "",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 1,
"pid" : "7982",
"parameters" : {}
}
},
"RongCloud-Call" : {
"__plugin_info__" : {
"name" : "RCUniCall",
"description" : "融云实时音视频 SDK uni 原生插件",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=6372",
"android_package_name" : "",
"android_package_name" : "uni.app.UNI9EFDC69WWCC",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 1,
@@ -132,27 +146,13 @@
"description" : "融云即时通讯 SDK uni 原生插件V2",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=9227",
"android_package_name" : "",
"android_package_name" : "uni.app.UNI9EFDC69WWCC",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 1,
"pid" : "9227",
"parameters" : {}
}
},
"RongCloud-Beauty" : {
"__plugin_info__" : {
"name" : "RCUniBeauty",
"description" : "融云基础版美颜插件,服务于 RCUniRtc 或 RCUniCall",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=7982",
"android_package_name" : "com.audio.im",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 1,
"pid" : "7982",
"parameters" : {}
}
}
}
},

View File

@@ -75,11 +75,7 @@
style="width: 72rpx; height: 72rpx;"
@click="navigateTo('/pages/shop-together/user', {
type: 1,
id: currentLive.liveID,
text: currentLive.liveName,
cover: currentLive.coverUrl,
avatarUrl: currentLive.liveOwner.avatarUrl
title: currentLive.liveOwner.title
id: currentLive.liveID
})"
/>
<Like />

View File

@@ -91,6 +91,11 @@
></image>
</template>
<template #right>
<!-- shareDialog = true -->
<!-- navigateTo('/pages/shop-together/user', {
type: 1,
id: currentLive.liveID
}) -->
<image
src="/static/images/public/share-icon.png"
mode="heightFix"

View File

@@ -6,9 +6,11 @@
} from '@tencentcloud/chat-uikit-engine-lite'
import { reactive, ref } from 'vue'
import { onLoad, onBackPress } from '@dcloudio/uni-app'
import { useLiveListState } from '@/uni_modules/tuikit-atomic-x/state/LiveListState'
import { navigateBack } from '../../utils/router'
import { useUI } from '../../utils/use-ui'
import { CHAT_MSG_CUSTOM_TYPE } from '../../TUIKit/constant'
import { isEnabledMessageReadReceiptGlobal } from '../../TUIKit/components/TUIChat/utils/utils'
const { showLoading, hideLoading, showToast, showDialog } = useUI()
@@ -31,6 +33,9 @@
title: ''
})
/** 直播数据 */
const liveData = ref({})
/** 多选状态 */
const isMultiple = ref(false)
/** 群列表 */
@@ -122,6 +127,29 @@
to = item.id.split('C2C')[1]
isGroup = false
}
const live = liveData.value
console.log(
'===',
propsData.type == 1
? {
id: propsData.id,
businessID: CHAT_MSG_CUSTOM_TYPE.LIVE,
title: live.liveName,
cover: live.cover,
userLiveData: {
avatarUrl: live.liveOwner.avatarURL,
title: live.liveOwner.userName || live.liveOwner.userID
}
}
: {
id: propsData.id,
businessID: CHAT_MSG_CUSTOM_TYPE.GOODS,
title: propsData.text,
cover: propsData.cover,
price: propsData.price
}
)
const payload = {
data: JSON.stringify(
@@ -129,11 +157,11 @@
? {
id: propsData.id,
businessID: CHAT_MSG_CUSTOM_TYPE.LIVE,
title: propsData.text,
cover: propsData.cover,
title: live.liveName,
cover: live.cover,
userLiveData: {
avatarUrl: propsData.avatarUrl,
title: propsData.title
avatarUrl: live.liveOwner.avatarURL,
title: live.liveOwner.userName || live.liveOwner.userID
}
}
: {
@@ -165,8 +193,8 @@
await Promise.all(requests)
hideLoading()
await showToast('分享成功', 'success')
isShow.value = false
navigateBack()
isShow.value = false
}
/**
@@ -192,13 +220,18 @@
await sendCustomData(item)
hideLoading()
await showToast('分享成功', 'success')
isShow.value = false
navigateBack()
isShow.value = false
}
}
onLoad(e => {
console.log('===', e)
propsData.id = e.id
propsData.type = e.type
if (e.type == 1) {
const { currentLive } = useLiveListState(e.id)
liveData.value = currentLive.value
}
TUIStore.watch(StoreName.GRP, {
groupList: onGroupListUpdated
})

View File

@@ -190,9 +190,7 @@ export const useUserStore = defineStore('user', () => {
// this.libPage = true;
// this.loginUserId = res.userId;
uni.hideLoading();
uni.showToast({
title: res.userId
});
console.log('登录成功')
if (uni.getSystemInfoSync().platform === 'android') {
permision.requestAndroidPermission('android.permission.CAMERA');
permision.requestAndroidPermission('android.permission.RECORD_AUDIO');