This commit is contained in:
cc
2026-02-05 17:54:43 +08:00
parent 2d503bab83
commit 1bb4170b50
4 changed files with 586 additions and 695 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name" : "密谈IM", "name" : "密谈IM",
"appid" : "__UNI__D40A151", "appid" : "__UNI__BE00EFC",
"description" : "", "description" : "",
"versionName" : "1.1.3", "versionName" : "1.1.3",
"versionCode" : 112, "versionCode" : 112,

View File

@@ -441,17 +441,6 @@
} }
} }
}, },
{
"path" : "pages/room/room",
"style" :
{
"navigationBarTitleText": "Room",
"enablePullDownRefresh": false,
"navigationStyle":"custom",
"gestureBack":"NO"
}
},
// #endif // #endif
// #ifdef H5 // #ifdef H5
{ {
@@ -469,6 +458,16 @@
} }
}, },
// #endif // #endif
{
"path" : "pages/room/room",
"style" :
{
"navigationBarTitleText": "Room",
"enablePullDownRefresh": false,
"navigationStyle":"custom",
"gestureBack":"NO"
}
},
{ {
"path": "pages/adduser/index", "path": "pages/adduser/index",
"style": { "style": {

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,11 @@ import {
import * as CallLib from "@/uni_modules/RongCloud-CallWrapper/lib/index" import * as CallLib from "@/uni_modules/RongCloud-CallWrapper/lib/index"
import RCIMIWEngine from '@/uni_modules/RongCloud-IMWrapper-V2/js_sdk/RCIMEngine' import RCIMIWEngine from '@/uni_modules/RongCloud-IMWrapper-V2/js_sdk/RCIMEngine'
import permision from "@/js_sdk/wa-permission/permission.js" import permision from "@/js_sdk/wa-permission/permission.js"
import {reasonDeal,errorDeal,imCode} from '@/utils/code.js' import {
reasonDeal,
errorDeal,
imCode
} from '@/utils/code.js'
// #endif // #endif
// #ifdef H5 // #ifdef H5
import { import {
@@ -85,6 +89,7 @@ export const useUserStore = defineStore('user', () => {
/** 用户积分数 */ /** 用户积分数 */
const integralData = ref(0) const integralData = ref(0)
// 融云
const imEngine = ref(null) const imEngine = ref(null)
/** /**
@@ -173,7 +178,9 @@ export const useUserStore = defineStore('user', () => {
const options = { const options = {
naviServer: '' naviServer: ''
} }
imEngine.value = await RCIMIWEngine.create(tencentUserSig.value.appKey, options) if(!imEngine.value){
imEngine.value = await RCIMIWEngine.create(tencentUserSig.value.appKey, options)
}
imEngine.value.setOnConnectedListener((res) => { imEngine.value.setOnConnectedListener((res) => {
if (res.code != 0) { if (res.code != 0) {
uni.hideLoading(); uni.hideLoading();
@@ -187,8 +194,6 @@ export const useUserStore = defineStore('user', () => {
CallLib.init({}); CallLib.init({});
onAllListeners() onAllListeners()
console.log('call.init') console.log('call.init')
// this.libPage = true;
// this.loginUserId = res.userId;
uni.hideLoading(); uni.hideLoading();
console.log('登录成功') console.log('登录成功')
if (uni.getSystemInfoSync().platform === 'android') { if (uni.getSystemInfoSync().platform === 'android') {
@@ -205,38 +210,54 @@ export const useUserStore = defineStore('user', () => {
}) })
} }
} }
function onAllListeners(){ function onAllListeners() {
CallLib.onCallReceived(res => { CallLib.onCallReceived(res => {
console.log(res) console.log(res)
console.log( console.log(
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>', 'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
res.data.targetId res.data.targetId
) )
let session = res.data
// //呼入
uni.setStorageSync('room-parameters', {
callType: 'in',
mediaType: session.mediaType === 0 ? 'audio' : 'video'
});
//跳转.nvue
uni.navigateTo({
url:'/pages/room/room'
});
}) })
CallLib.onCallConnected(res => { CallLib.onCallConnected(res => {
console.log(res) console.log(res)
console.log( console.log(
'Engine:OnCallConnected=>' + 'Engine:OnCallConnected=>' +
'已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息', '已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
res res
) )
}) })
CallLib.onRemoteUserInvited((res)=>{
console.log("Engine:OnRemoteUserInvited=>"+"通话中的某一个参与者,邀请好友加入通话 ,远端Id为=>", res.data.userId);
uni.$emit('OnCallConnected');
})
CallLib.onRemoteUserJoined(res => { CallLib.onRemoteUserJoined(res => {
console.log( console.log(
'Engine:OnRemoteUserJoined=>' + 'Engine:OnRemoteUserJoined=>' +
'主叫端拨出电话被叫端收到请求后加入通话被叫端Id为=>', '主叫端拨出电话被叫端收到请求后加入通话被叫端Id为=>',
res.data.userId res.data.userId
) )
uni.$emit('OnCallConnected');
}) })
CallLib.onCallDisconnected(res => { CallLib.onCallDisconnected(res => {
console.log( console.log(
'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>', 'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
res.data.reason res.data.reason
) )
uni.$emit('OnCallDisconnected');
}) })
} }
@@ -264,6 +285,7 @@ export const useUserStore = defineStore('user', () => {
// #ifdef APP-PLUS // #ifdef APP-PLUS
removeFriendList() removeFriendList()
removeGroupList() removeGroupList()
removeAllListeners()
await useLoginState().logout() await useLoginState().logout()
// #endif // #endif
// #ifdef H5 // #ifdef H5
@@ -278,6 +300,31 @@ export const useUserStore = defineStore('user', () => {
reLaunch('/pages/login/login') reLaunch('/pages/login/login')
} }
} }
function removeAllListeners(){
CallLib.unInit();
//移除监听-接收到通话呼入
CallLib.removeCallReceivedListener();
// 移除监听-开始呼叫通话的回调
CallLib.removeCallOutgoingListener();
// 移除监听-通话已接通
CallLib.removeCallReceivedListener();
// 移除监听-通话已结束
CallLib.removeCallDisconnectedListener();
// 移除监听-对端用户正在振铃
CallLib.removeRemoteUserRingingListener();
// 移除监听-对端用户加入了通话
CallLib.removeRemoteUserJoinedListener();
// 移除监听-有用户被邀请加入通话
CallLib.removeRemoteUserInvited();
// 移除监听-对端用户挂断
CallLib.removeRemoteUserLeftListener();
// 移除监听-对端用户切换了媒体类型
CallLib.removeRemoteUserMediaTypeChangedListener();
// 移除监听-通话出现错误的回调
CallLib.removeErrorListener();
}
/** 清空所有用户缓存 */ /** 清空所有用户缓存 */
const clearAllUserInfo = async () => { const clearAllUserInfo = async () => {