diff --git a/manifest.json b/manifest.json
index 47bb6d0..2c77095 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name" : "密谈IM",
- "appid" : "__UNI__D40A151",
+ "appid" : "__UNI__BE00EFC",
"description" : "",
"versionName" : "1.1.3",
"versionCode" : 112,
diff --git a/pages.json b/pages.json
index 33996f2..c002ee4 100644
--- a/pages.json
+++ b/pages.json
@@ -441,17 +441,6 @@
}
}
},
- {
- "path" : "pages/room/room",
- "style" :
- {
- "navigationBarTitleText": "Room",
- "enablePullDownRefresh": false,
- "navigationStyle":"custom",
- "gestureBack":"NO"
- }
-
- },
// #endif
// #ifdef H5
{
@@ -469,6 +458,16 @@
}
},
// #endif
+ {
+ "path" : "pages/room/room",
+ "style" :
+ {
+ "navigationBarTitleText": "Room",
+ "enablePullDownRefresh": false,
+ "navigationStyle":"custom",
+ "gestureBack":"NO"
+ }
+ },
{
"path": "pages/adduser/index",
"style": {
diff --git a/pages/room/room.nvue b/pages/room/room.nvue
index 9aa6a5c..1244e66 100644
--- a/pages/room/room.nvue
+++ b/pages/room/room.nvue
@@ -1,712 +1,557 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ {{callDuration}}
+
-
-
- 邀请
-
-
- {{curCamera?'关闭':'开启'}}摄像头
-
-
- 切换摄像头
-
-
- {{isMicrophone?'关闭':'开启'}}麦克风
-
-
- {{isEnableSpeaker?'关闭':'开启'}}扬声器
-
-
- 美颜
-
-
-
- 挂断
- 切换语音
-
-
-
- 被邀请者ID:
-
-
- 必填;需加入群后,方可收到邀请,多个userId用英文半角逗号分开
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+ {{targetUser}}
+ 通话中
+
+
+
+
+
+
+
+
+ 切换
-
-
-
- 美颜{{isChecked?'开启':'关闭'}}
-
-
- X
-
-
-
-
-
- {{item.name}}
+
+
+
+
+
+
+
+ {{isMicrophoneOn ? '关闭' : '开启'}}麦克风
-
-
-
+
+
+
+
+
+ {{isCameraOn ? '关闭' : '开启'}}摄像头
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{isSpeakerOn ? '开启' : '关闭'}}扬声器
-
-
- {{item.text}}
+
+
+
+
+
+
+
+ {{mediaType === 'video' ? '切换语音' : '切换视频'}}
+
+
+
+
+
+
+ 挂断
+
+
+
+
+
+
+ 翻转
+
+
+
+
+
+
+ {{callerName}}
+ 视频通话邀请
+
+
+
+
+
+
+ 拒绝
+
+
+
+
+
+ 接听
+
+
+
-
-
\ No newline at end of file
diff --git a/stores/user.js b/stores/user.js
index 2d315ab..86908d8 100644
--- a/stores/user.js
+++ b/stores/user.js
@@ -21,7 +21,11 @@ import {
import * as CallLib from "@/uni_modules/RongCloud-CallWrapper/lib/index"
import RCIMIWEngine from '@/uni_modules/RongCloud-IMWrapper-V2/js_sdk/RCIMEngine'
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
// #ifdef H5
import {
@@ -85,6 +89,7 @@ export const useUserStore = defineStore('user', () => {
/** 用户积分数 */
const integralData = ref(0)
+ // 融云
const imEngine = ref(null)
/**
@@ -173,7 +178,9 @@ export const useUserStore = defineStore('user', () => {
const options = {
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) => {
if (res.code != 0) {
uni.hideLoading();
@@ -187,8 +194,6 @@ export const useUserStore = defineStore('user', () => {
CallLib.init({});
onAllListeners()
console.log('call.init')
- // this.libPage = true;
- // this.loginUserId = res.userId;
uni.hideLoading();
console.log('登录成功')
if (uni.getSystemInfoSync().platform === 'android') {
@@ -205,38 +210,54 @@ export const useUserStore = defineStore('user', () => {
})
}
}
-
- function onAllListeners(){
+
+ function onAllListeners() {
CallLib.onCallReceived(res => {
- console.log(res)
- console.log(
- 'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
- res.data.targetId
- )
+ console.log(res)
+ console.log(
+ 'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
+ 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 => {
- console.log(res)
- console.log(
- 'Engine:OnCallConnected=>' +
- '已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
- res
- )
+ console.log(res)
+ console.log(
+ 'Engine:OnCallConnected=>' +
+ '已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
+ res
+ )
})
-
+ CallLib.onRemoteUserInvited((res)=>{
+ console.log("Engine:OnRemoteUserInvited=>"+"通话中的某一个参与者,邀请好友加入通话 ,远端Id为=>", res.data.userId);
+ uni.$emit('OnCallConnected');
+ })
+
CallLib.onRemoteUserJoined(res => {
- console.log(
- 'Engine:OnRemoteUserJoined=>' +
- '主叫端拨出电话,被叫端收到请求后,加入通话,被叫端Id为=>',
- res.data.userId
- )
+ console.log(
+ 'Engine:OnRemoteUserJoined=>' +
+ '主叫端拨出电话,被叫端收到请求后,加入通话,被叫端Id为=>',
+ res.data.userId
+ )
+ uni.$emit('OnCallConnected');
})
-
+
CallLib.onCallDisconnected(res => {
- console.log(
- 'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
- res.data.reason
- )
+ console.log(
+ 'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
+ res.data.reason
+ )
+ uni.$emit('OnCallDisconnected');
})
}
@@ -264,6 +285,7 @@ export const useUserStore = defineStore('user', () => {
// #ifdef APP-PLUS
removeFriendList()
removeGroupList()
+ removeAllListeners()
await useLoginState().logout()
// #endif
// #ifdef H5
@@ -278,6 +300,31 @@ export const useUserStore = defineStore('user', () => {
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 () => {