Merge remote-tracking branch 'origin/test-audio'

This commit is contained in:
bobobobo
2026-02-05 00:36:36 +08:00
parent 23d079761e
commit b11d051dd8
15 changed files with 2169 additions and 563 deletions

6
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

85
.idea/workspace.xml generated Normal file
View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="fcbd9e13-46ae-4871-b6a6-f9012cc02ac4" name="更改" comment="1">
<change beforePath="$PROJECT_DIR$/App.vue" beforeDir="false" afterPath="$PROJECT_DIR$/App.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/TUIKit/components/TUIChat/message-input-toolbar/call-view/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/TUIKit/components/TUIChat/message-input-toolbar/call-view/index.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/manifest.json" beforeDir="false" afterPath="$PROJECT_DIR$/manifest.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages.json" beforeDir="false" afterPath="$PROJECT_DIR$/pages.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/stores/user.js" beforeDir="false" afterPath="$PROJECT_DIR$/stores/user.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uni_modules/RongCloud-CallWrapper/lib/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/uni_modules/RongCloud-CallWrapper/lib/index.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="PUSH_TAGS">
<GitPushTagMode>
<option name="argument" value="--tags" />
<option name="title" value="All" />
</GitPushTagMode>
</option>
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="master" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="39CgkMFHilJz3KjB9U6uRRYi97V" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"ts.external.directory.path": "D:\\Software\\developTool\\IntelliJ IDEA 2023.1\\plugins\\javascript-impl\\jsLanguageServicesImpl\\external",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="默认任务">
<changelist id="fcbd9e13-46ae-4871-b6a6-f9012cc02ac4" name="更改" comment="" />
<created>1770205618468</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1770205618468</updated>
<workItem from="1770205619734" duration="172000" />
<workItem from="1770207280751" duration="89000" />
<workItem from="1770218245313" duration="141000" />
<workItem from="1770218395615" duration="626000" />
</task>
<task id="LOCAL-00001" summary="1">
<created>1770218264881</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1770218264881</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="1" />
<option name="LAST_COMMIT_MESSAGE" value="1" />
</component>
</project>

View File

@@ -11,8 +11,6 @@
TUIChatKit.init()
const { token, tencentUserSig } = useAuthUser()
const { loginTencentIM } = useUserStore()
/** 静默登录逻辑 */

View File

@@ -1,125 +1,125 @@
<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 isType = computed(() => props.type === '0')
const evaluateIcon = isType.value ? custom : videoIcon
const evaluateIcon = isType.value ? custom : videoIcon
const emits = defineEmits(['onDialogPopupShowOrHide'])
const emits = defineEmits(['onDialogPopupShowOrHide'])
const container = ref()
const closeDialog = () => {
container?.value?.toggleDialogDisplay(false)
}
const container = ref()
const closeDialog = () => {
container?.value?.toggleDialogDisplay(false)
}
const onDialogShow = () => {
console.log('弹出窗口')
console.log(props.currentConversation)
emits('onDialogPopupShowOrHide', true)
}
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 onDialogClose = () => {
console.log('关闭窗口')
emits('onDialogPopupShowOrHide', 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);
}
}
CallLib.onCallReceived(res => {
console.log(res)
console.log(
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
res.data.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'
});
}
CallLib.onCallConnected(res => {
console.log(res)
console.log(
'Engine:OnCallConnected=>' +
'已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
res
)
})
CallLib.onRemoteUserJoined(res => {
console.log(
'Engine:OnRemoteUserJoined=>' +
'主叫端拨出电话被叫端收到请求后加入通话被叫端Id为=>',
res.data.userId
)
})
const onDialogClose = () => {
console.log('关闭窗口')
emits('onDialogPopupShowOrHide', false)
}
CallLib.onCallDisconnected(res => {
console.log(
'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
res.data.reason
)
})
const onDial = () => {
const data = props.currentConversation.userProfile
// data.userID
CallLib.enableMicrophone(true)
CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
}
const onDial = () => {
const data = props.currentConversation.userProfile
// data.userID
CallLib.enableMicrophone(true)
CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
}
</script>
<template>
<ToolbarItemContainer
ref="container"
needBottomPopup
:iconFile="evaluateIcon"
:iconWidth="isUniFrameWork ? '34px' : '20px'"
:iconHeight="isUniFrameWork ? '34px' : '20px'"
:title="isType ? '语音通话' : '视频通话'"
@onDialogShow="onDialogShow"
@onDialogClose="onDialogClose"
>
<view class="box-index">
<view class="top-icon">
<uni-icons
type="back"
color="#ffffff"
size="42rpx"
@click.stop="closeDialog"
></uni-icons>
</view>
<ToolbarItemContainer ref="container" needBottomPopup :iconFile="evaluateIcon"
:iconWidth="isUniFrameWork ? '34px' : '20px'" :iconHeight="isUniFrameWork ? '34px' : '20px'"
:title="isType ? '语音通话' : '视频通话'" @onDialogShow="onDialogShow" @onDialogClose="onDialogClose">
<view class="box-index">
<view class="top-icon">
<uni-icons type="back" color="#ffffff" size="42rpx" @click.stop="closeDialog"></uni-icons>
</view>
<button @click.stop="onDial">拨打</button>
<button @click.stop="onDial">拨打</button>
<button
@click.stop="
<button @click.stop="
() => {
CallLib.enableMicrophone(true)
CallLib.accept()
}
"
>
接听
</button>
</view>
</ToolbarItemContainer>
">
接听
</button>
</view>
</ToolbarItemContainer>
</template>
<style scoped lang="scss" src="./style/index.scss"></style>
<style scoped lang="scss" src="./style/index.scss"></style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

BIN
assets/phone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@@ -0,0 +1,272 @@
/**
* 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
*/
var isIos
// #ifdef APP-PLUS
isIos = (plus.os.name == "iOS")
// #endif
// 判断推送权限是否开启
function judgeIosPermissionPush() {
var result = false;
var UIApplication = plus.ios.import("UIApplication");
var app = UIApplication.sharedApplication();
var enabledTypes = 0;
if (app.currentUserNotificationSettings) {
var settings = app.currentUserNotificationSettings();
enabledTypes = settings.plusGetAttribute("types");
console.log("enabledTypes1:" + enabledTypes);
if (enabledTypes == 0) {
console.log("推送权限没有开启");
} else {
result = true;
console.log("已经开启推送功能!")
}
plus.ios.deleteObject(settings);
} else {
enabledTypes = app.enabledRemoteNotificationTypes();
if (enabledTypes == 0) {
console.log("推送权限没有开启!");
} else {
result = true;
console.log("已经开启推送功能!")
}
console.log("enabledTypes2:" + enabledTypes);
}
plus.ios.deleteObject(app);
plus.ios.deleteObject(UIApplication);
return result;
}
// 判断定位权限是否开启
function judgeIosPermissionLocation() {
var result = false;
var cllocationManger = plus.ios.import("CLLocationManager");
var status = cllocationManger.authorizationStatus();
result = (status != 2)
console.log("定位权限开启:" + result);
// 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
/* var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
console.log("enable:" + enable);
console.log("status:" + status);
if (enable && status != 2) {
result = true;
console.log("手机定位服务已开启且已授予定位权限");
} else {
console.log("手机系统的定位没有打开或未给予定位权限");
} */
plus.ios.deleteObject(cllocationManger);
return result;
}
// 判断麦克风权限是否开启
function judgeIosPermissionRecord() {
var result = false;
var avaudiosession = plus.ios.import("AVAudioSession");
var avaudio = avaudiosession.sharedInstance();
var permissionStatus = avaudio.recordPermission();
console.log("permissionStatus:" + permissionStatus);
if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
console.log("麦克风权限没有开启");
} else {
result = true;
console.log("麦克风权限已经开启");
}
plus.ios.deleteObject(avaudiosession);
return result;
}
// 判断相机权限是否开启
function judgeIosPermissionCamera() {
var result = false;
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
console.log("authStatus:" + authStatus);
if (authStatus == 3) {
result = true;
console.log("相机权限已经开启");
} else {
console.log("相机权限没有开启");
}
plus.ios.deleteObject(AVCaptureDevice);
return result;
}
// 判断相册权限是否开启
function judgeIosPermissionPhotoLibrary() {
var result = false;
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
var authStatus = PHPhotoLibrary.authorizationStatus();
console.log("authStatus:" + authStatus);
if (authStatus == 3) {
result = true;
console.log("相册权限已经开启");
} else {
console.log("相册权限没有开启");
}
plus.ios.deleteObject(PHPhotoLibrary);
return result;
}
// 判断通讯录权限是否开启
function judgeIosPermissionContact() {
var result = false;
var CNContactStore = plus.ios.import("CNContactStore");
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
if (cnAuthStatus == 3) {
result = true;
console.log("通讯录权限已经开启");
} else {
console.log("通讯录权限没有开启");
}
plus.ios.deleteObject(CNContactStore);
return result;
}
// 判断日历权限是否开启
function judgeIosPermissionCalendar() {
var result = false;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
if (ekAuthStatus == 3) {
result = true;
console.log("日历权限已经开启");
} else {
console.log("日历权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
// 判断备忘录权限是否开启
function judgeIosPermissionMemo() {
var result = false;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
if (ekAuthStatus == 3) {
result = true;
console.log("备忘录权限已经开启");
} else {
console.log("备忘录权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
// Android权限查询
function requestAndroidPermission(permissionID) {
return new Promise((resolve, reject) => {
plus.android.requestPermissions(
[permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
function(resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission);
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
resolve(result);
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
// if (result != 1) {
// gotoAppPermissionSetting()
// }
},
function(error) {
console.log('申请权限错误:' + error.code + " = " + error.message);
resolve({
code: error.code,
message: error.message
});
}
);
});
}
// 使用一个方法,根据参数判断权限
function judgeIosPermission(permissionID) {
if (permissionID == "location") {
return judgeIosPermissionLocation()
} else if (permissionID == "camera") {
return judgeIosPermissionCamera()
} else if (permissionID == "photoLibrary") {
return judgeIosPermissionPhotoLibrary()
} else if (permissionID == "record") {
return judgeIosPermissionRecord()
} else if (permissionID == "push") {
return judgeIosPermissionPush()
} else if (permissionID == "contact") {
return judgeIosPermissionContact()
} else if (permissionID == "calendar") {
return judgeIosPermissionCalendar()
} else if (permissionID == "memo") {
return judgeIosPermissionMemo()
}
return false;
}
// 跳转到**应用**的权限页面
function gotoAppPermissionSetting() {
if (isIos) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
// console.log(plus.device.vendor);
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
// 检查系统的设备服务是否开启
// var checkSystemEnableLocation = async function () {
function checkSystemEnableLocation() {
if (isIos) {
var result = false;
var cllocationManger = plus.ios.import("CLLocationManager");
var result = cllocationManger.locationServicesEnabled();
console.log("系统定位开启:" + result);
plus.ios.deleteObject(cllocationManger);
return result;
} else {
var context = plus.android.importClass("android.content.Context");
var locationManager = plus.android.importClass("android.location.LocationManager");
var main = plus.android.runtimeMainActivity();
var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
console.log("系统定位开启:" + result);
return result
}
}
export default {
judgeIosPermission: judgeIosPermission,
requestAndroidPermission: requestAndroidPermission,
checkSystemEnableLocation: checkSystemEnableLocation,
gotoAppPermissionSetting: gotoAppPermissionSetting
}

View File

@@ -1,6 +1,6 @@
{
"name" : "密谈IM",
"appid" : "__UNI__D40A151",
"appid" : "__UNI__BE00EFC",
"description" : "",
"versionName" : "1.1.2",
"versionCode" : 111,
@@ -139,6 +139,20 @@
"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

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

712
pages/room/room.nvue Normal file
View File

@@ -0,0 +1,712 @@
<template>
<view class="content">
<!-- 单人视频 -->
<view v-if="users.length<=2">
<RongCloud-Call-RCUniCallView class="bigVideoView"
:style="{width:windowWidth+'px',height:windowHeight+'px'}" ref="bigVideoView">
</RongCloud-Call-RCUniCallView>
<RongCloud-Call-RCUniCallView class="smallVideoView" :style="{width:200+'upx',height:200+'upx'}"
ref="smallVideoView">
</RongCloud-Call-RCUniCallView>
</view>
<!-- 多人视频 -->
<view v-else>
<RongCloud-Call-RCUniCallView class="bigVideoView" :style="{width:windowWidth+'px',height:300+'px'}"
ref="bigVideoView">
</RongCloud-Call-RCUniCallView>
<view class="smallViews">
<RongCloud-Call-RCUniCallView v-for="(item,index) in viewArr" :key="item.userId" class="smallView"
:ref="item.userId">
</RongCloud-Call-RCUniCallView>
</view>
</view>
<view class="nav">
<text class="nav-com" v-if="callWay === 1" @click="isMark=true">
邀请
</text>
<text class="nav-com" @click="closeCameraCur">
{{curCamera?'关闭':'开启'}}摄像头
</text>
<text class="nav-com" @click="switchCamera">
切换摄像头
</text>
<text class="nav-com" @click="microphone">
{{isMicrophone?'关闭':'开启'}}麦克风
</text>
<text class="nav-com" @click="enableSpeaker">
{{isEnableSpeaker?'关闭':'开启'}}扬声器
</text>
<text class="nav-com" v-if="mediaTypeCur === 'video'" @click.stop="isBeauty=!isBeauty">
美颜
</text>
</view>
<view class="container" :style="{width:windowWidth+'px'}">
<text class="hangup" @click="hangup">挂断 </text>
<text v-if="mediaTypeCur === 'video' " class="hangup" @click="changeMediaType">切换语音 </text>
</view>
<view class="box-mark" v-if="isMark" :style="{width:windowWidth+'px',height:windowHeight+'px'}" @click.stop="">
<view class="box-cen">
<text class="box-des">被邀请者ID:</text>
<view class="box-bot">
<input v-model="inviteUsersIds" ref="inviteInput" class="box-input" type="text"
placeholder="请输入被邀请者ID">
<text class="box-tit">必填需加入群后方可收到邀请多个userId用英文半角逗号分开</text>
</view>
<view class="box-btns">
<button class="box-btn" type="default" @click="inviteUsers(false)">取消</button>
<button class="box-btn" type="default" @click="inviteUsers(true)">确定</button>
</view>
</view>
</view>
<view class="beauty" v-if="isBeauty" :style="{width:windowWidth+'px'}" @click.stop="">
<view class="beauty-btn">
<view class="change-btn">
<text class="ch-tit">美颜</text><text class="switch-btn"
@click="switchChange">{{isChecked?'开启':'关闭'}}</text>
</view>
<view class="close-btn">
<text class="close-tit" @click="isBeauty=false">X</text>
</view>
</view>
<view class="beauty-view">
<view v-if="curIndex === '0'" class="beauty-tab filte-view">
<view class="tab-item" v-for="(item) in filteArr" :key="item.id" @click="cutFilte(item.id)"
:class="{current: item.id === curFilte}">
<text>{{item.name}}</text>
</view>
</view>
<!-- 美白 -->
<view v-if="curIndex === '1'" class="white-view com-view">
<slider :value="whiteVal" min="0" max="9" @change="whiteChange" show-value />
</view>
<!-- 红润 -->
<view v-if="curIndex === '2'" class="ruddy-view com-view">
<slider :value="ruddyVal" min="0" max="9" @change="ruddyChange" show-value />
</view>
<!-- 磨皮 -->
<view v-if="curIndex === '3'" class="buffing-view com-view">
<slider :value="buffingVal" min="0" max="9" @change="buffingChange" show-value />
</view>
<!-- 亮度 -->
<view v-if="curIndex === '4'" class="brightness-view com-view">
<slider :value="brightnessVal" min="0" max="9" @change="brightnessChange" show-value />
</view>
</view>
<view class="beauty-tab">
<view class="tab-item" v-for="(item) in tabArr" :key="item.id" @click="curIndex = item.id"
:class="{current: item.id === curIndex}">
<text>{{item.text}}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import * as call from "@/uni_modules/RongCloud-CallWrapper/lib/index"
// import * as im from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
// import RCBeautyEngine from "@/uni_modules/RongCloud-BeautyWrapper/lib/RCBeautyEngine"
export default {
data() {
return {
mediaType: "video",
callType: "out",
callWay: 0, //呼叫方式 0 单聊 1 群聊
targetId: "",
bottomHeight: 0,
isConnected: false,
isSelf: false,
viewArr: [],
callSelect: 'single',
groupId: '',
userIds: [],
windowWidth: '',
windowHeight: '',
isMicrophone: true,
isEnableSpeaker: true,
curCamera: true,
backCamera: true,
isMe: true,
users: [],
currentCallSession: {},
isMark: false,
inviteUsersIds: '',
mediaTypeCur: 'audio',
isBeauty: false,
tabArr: [{
id: '0',
text: '滤镜'
},
{
id: '1',
text: '美白'
},
{
id: '2',
text: '红润'
},
{
id: '3',
text: '磨皮'
},
{
id: '4',
text: '亮度'
},
],
filteArr: [{
id: 0,
name: '原画'
},
{
id: 1,
name: '唯美'
},
{
id: 2,
name: '清新'
},
{
id: 3,
name: '浪漫'
}
],
curIndex: '0',
curFilte: 0,
whiteVal: 0,
ruddyVal: 0,
buffingVal: 0,
brightnessVal: 5,
isChecked: false
}
},
onLoad: function() {
console.log("来room页面了");
var _this = this;
uni.getStorage({
key: "room-parameters",
success: (res) => {
this.mediaType = res.data.mediaType;
this.callType = res.data.callType ? res.data.callType : 'in';
this.groupId = res.data.groupId ? res.data.groupId : '';
this.userIds = res.data.userIds ? res.data.userIds : '';
if (this.callType === 'out') {
console.log('呼出out')
this.targetId = res.data.targetId;
this.startCall();
} else {
console.log('呼入接受')
this.accept();
}
}
});
uni.getSystemInfo({
success: function(res) {
_this.windowWidth = res.windowWidth;
_this.windowHeight = res.windowHeight;
}
})
uni.$on('OnCallConnected', this.onCallConnected)
uni.$on('OnCallDisconnected', this.onCallDisconnected)
// this.initBeautyOpton();
},
beforeDestroy() {
uni.$off('OnCallDisconnected');
uni.$off('OnCallConnected');
},
onUnload() {
call.hangup();
},
onHide() {
const session = call.getCurrentCallSession();
if (session) {
call.hangup();
}
},
methods: {
changeMediaType() {
this.mediaTypeCur = 'audio';
call.changeMediaType(0);
},
inviteUsers(flag) {
if (flag) {
if (this.inviteUsersIds === '') {
uni.showToast({
title: "请输入被邀请者ID",
icon: "error",
duration: 2000
})
return;
}
let userIdsArr = this.inviteUsersIds.split(',');
call.inviteUsers(userIdsArr, []);
}
this.$refs.inviteInput.blur();
this.isMark = false;
},
switchVideo() {
this.isMe = !this.isMe;
let session = call.getCurrentCallSession();
if (this.isMe) {
switch (uni.getSystemInfoSync().platform) {
case 'android':
call.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0, false);
call.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true);
break;
case 'ios':
call.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0);
call.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0);
break;
default:
console.log('运行在开发者工具上')
break;
}
} else {
switch (uni.getSystemInfoSync().platform) {
case 'android':
call.setVideoView(session.mine.userId, this.$refs.bigVideoView.ref, 0, false);
call.setVideoView(session.targetId, this.$refs.smallVideoView.ref, 0, true);
break;
case 'ios':
call.setVideoView(session.mine.userId, this.$refs.bigVideoView.ref, 0);
call.setVideoView(session.targetId, this.$refs.smallVideoView.ref, 0);
break;
default:
console.log('运行在开发者工具上')
break;
}
}
},
closeCameraCur() {
this.curCamera = !this.curCamera;
let camera = call.currentCamera();
call.enableCamera(this.curCamera, camera)
},
closeCameraBack() {
this.backCamera = !this.backCamera;
call.enableCamera(this.backCamera, 1)
},
switchCamera() {
call.switchCamera();
},
microphone() {
this.isMicrophone = !this.isMicrophone;
call.enableMicrophone(this.isMicrophone);
},
enableSpeaker() {
this.isEnableSpeaker = !this.isEnableSpeaker;
call.enableSpeaker(this.isEnableSpeaker);
},
hangup() {
this.isSelf = true;
// RCBeautyEngine.resetBeauty();
call.hangup();
uni.navigateBack({
delta: 1
})
},
accept() {
call.accept();
},
startCall() {
const type = this.mediaType === 'audio' ? 0 : 1;
this.mediaTypeCur = this.mediaType;
if (this.targetId.length > 0) {
call.enableSpeaker(true);
call.startSingleCall(this.targetId, type, null);
this.currentCallSession = call.getCurrentCallSession();
this.users = this.currentCallSession.users ? this.currentCallSession.users : [];
} else {
call.startGroupCall(this.groupId, this.userIds, [], type, '');
this.users = this.userIds;
console.log(this.users);
this.currentCallSession = call.getCurrentCallSession();
this.users = this.currentCallSession.users ? this.currentCallSession.users : [];
}
let _this = this;
// im.getCurrentUserId(function(result){
// _this.systemInfoSync(result.userId,_this.$refs.bigVideoView.ref,false);
// })
if (this.currentCallSession) {
this.systemInfoSync(this.currentCallSession.mine.userId, this.$refs.bigVideoView.ref, false);
}
},
onCallConnected() {
let context = this;
console.log('oncallconnected接收了');
this.mediaTypeCur = this.mediaType;
call.enableSpeaker(true);
this.currentCallSession = call.getCurrentCallSession();
this.callWay = this.currentCallSession.callType;
this.users = this.currentCallSession.users ? this.currentCallSession.users : [];
let isHasMine = this.users.findIndex((item) => {
return item.userId === this.currentCallSession.mine.userId;
});
if (isHasMine === -1) {
this.users.push(this.currentCallSession.mine);
}
if (this.currentCallSession && this.currentCallSession.users.length > 0) {
//视频是两个的时候
if (this.currentCallSession.users.length <= 2) {
setTimeout(() => {
this.systemInfoSync(this.currentCallSession.mine.userId, this.$refs.smallVideoView.ref,
true);
this.viewArr = this.currentCallSession.users.filter((item) => {
return item.userId !== this.currentCallSession.mine.userId;
});
this.viewArr.forEach((itm) => {
this.targetId = itm.userId;
this.systemInfoSync(itm.userId, this.$refs.bigVideoView.ref, false);
});
}, 100);
} else {
// 视频超过三个
this.$nextTick(() => {
this.systemInfoSync(this.currentCallSession.mine.userId, this.$refs.bigVideoView.ref,
false);
this.viewArr = this.currentCallSession.users.filter((item) => {
return item.userId !== this.currentCallSession.mine.userId;
});
setTimeout(() => {
this.viewArr.forEach((itm) => {
this.systemInfoSync(itm.userId, this.$refs[itm.userId][0].ref,
false);
});
}, 100)
})
}
}
},
systemInfoSync(userId, ref, isZOrderOnTop) {
switch (uni.getSystemInfoSync().platform) {
case 'android':
call.setVideoView(userId, ref, 0, isZOrderOnTop);
break;
case 'ios':
call.setVideoView(userId, ref, 0);
break;
default:
console.log('运行在开发者工具上')
break;
}
},
onCallDisconnected() {
this.isMe = true;
if (!this.isSelf) {
uni.navigateBack({
delta: 1
})
}
},
switchChange() {
this.isChecked = !this.isChecked;
if (!this.isChecked) {
this.reset();
} else {
this.setBeautyOption();
}
},
//设置美颜
setBeautyOption() {
let option = {
whitenessLevel: this.whiteVal,
ruddyLevel: this.ruddyVal,
smoothLevel: this.buffingVal,
brightLevel: this.brightnessVal
}
if (this.isChecked) { //开启
console.log('设置美颜')
// RCBeautyEngine.setBeautyOptions(this.isChecked, option);
}
},
//切换滤镜
cutFilte(id) {
//切换滤镜打开美颜
if (!this.isChecked) {
this.isChecked = true;
}
let option = {
whitenessLevel: this.whiteVal,
ruddyLevel: this.ruddyVal,
smoothLevel: this.buffingVal,
brightLevel: this.brightnessVal
}
//打开滤镜
this.curFilte = id;
// this.isChecked ? RCBeautyEngine.setBeautyOptions(this.isChecked, option) : '';
// RCBeautyEngine.setBeautyFilter(this.curFilte);
},
//美白
whiteChange(e) {
console.log('美白', e.detail.value);
//打开美颜
if (!this.isChecked) {
this.isChecked = true;
}
this.whiteVal = e.detail.value;
this.setBeautyOption();
},
//红润
ruddyChange(e) {
console.log('红润', e.detail.value);
//打开美颜
if (!this.isChecked) {
this.isChecked = true;
}
this.ruddyVal = e.detail.value;
this.setBeautyOption();
},
//磨皮
buffingChange(e) {
console.log('磨皮', e.detail.value);
//打开美颜
if (!this.isChecked) {
this.isChecked = true;
}
this.buffingVal = e.detail.value;
this.setBeautyOption();
},
//亮度
brightnessChange(e) {
console.log('亮度', e.detail.value);
//打开美颜
if (!this.isChecked) {
this.isChecked = true;
}
this.brightnessVal = e.detail.value;
this.setBeautyOption();
},
//重置
reset() {
// RCBeautyEngine.resetBeauty();
// this.initBeautyOpton();
},
// initBeautyOpton() {
// //初始化滤镜
// this.curFilte = RCBeautyEngine.getCurrentBeautyFilter();
// //初始化美颜参数
// let beautyOption = RCBeautyEngine.getCurrentBeautyOptions();
// this.whiteVal = beautyOption.whitenessLevel;
// this.ruddyVal = beautyOption.ruddyLevel;
// this.buffingVal = beautyOption.smoothLevel;
// this.brightnessVal = beautyOption.brightLevel;
// }
}
}
</script>
<style scoped>
.content {
flex: 1;
flex-direction: column;
position: relative;
}
.bigVideoView {
background: #000;
}
.smallVideoView {
position: absolute;
right: 0;
top: 50upx;
width: 200upx;
height: 200upx;
}
.smallViews {
flex-wrap: wrap;
flex-direction: row;
background: #ccc;
}
.smallView {
width: 200upx;
height: 200upx;
margin-right: 20upx;
background: pink;
}
.container {
position: absolute;
bottom: 20upx;
height: 100upx;
flex-direction: row;
justify-content: center;
}
.nav {
position: fixed;
bottom: 200upx;
right: 0;
}
.camera {
background: #ccc;
}
.nav-com {
margin-top: 10upx;
color: #fff;
background: rgba(0, 0, 0, 0.5);
justify-content: center;
align-items: center;
}
.hangup {
width: 200upx;
height: 100upx;
color: #fff;
text-align: center;
line-height: 100upx;
background: red;
margin-right: 50upx;
border-radius: 50upx;
}
.box-mark {
position: fixed;
left: 0;
top: 0;
background: rgba(0, 0, 0, .5);
z-index: 9999;
justify-content: center;
align-items: center;
color: #fff;
}
.box-cen {
padding: 30upx;
width: 500upx;
height: 500upx;
background: #222831;
}
.box-des {
color: #fff;
}
.box-input {
margin-top: 30upx;
color: #fff;
border: 1upx solid #fff;
}
.box-tit {
margin-top: 30upx;
color: #fff;
}
.box-btn {
margin-top: 30upx;
}
.box-btns {
flex-direction: row;
justify-content: space-between;
padding: 0 30upx;
}
.box-btn {
padding: 0 20upx;
}
.beauty {
height: 500upx;
position: fixed;
bottom: 0;
background: #000;
}
.beauty-btn {
height: 100upx;
padding-right: 20upx;
flex-direction: row;
justify-content: space-between;
}
.change-btn {
padding-top: 20upx;
flex-direction: row;
}
.switch-btn {
border: 1upx;
border-color: #fff;
padding: 20upx;
background: blue;
color: #fff;
margin-left: 20upx;
margin-top: -10upx;
}
.ch-tit {
margin-top: 8upx;
color: #fff;
}
.ch-res {
margin-top: -10upx;
margin-left: 20upx;
color: #fff;
padding: 20upx;
border-radius: 10upx;
justify-content: center;
align-items: center;
background: #4e6ef2;
}
.close-btn {
padding-top: 20upx;
}
.close-tit {
color: #fff;
}
.beauty-view {
flex: 1;
background: #ccc;
}
.com-view {
padding-top: 40upx;
background: #ccc;
padding-left: 30upx;
padding-right: 30upx;
}
.beauty-tab {
border-top: 1px;
border-top-color: #000000;
padding: 0 20upx;
flex: 1;
background: #fff;
flex-direction: row;
justify-content: space-between;
padding-top: 40upx;
}
.filte-view {}
.tab-item {
width: 100upx;
height: 100upx;
border: 1px;
border-color: #000000;
justify-content: center;
align-items: center;
}
.current {
background: yellow;
}
.white-view {}
</style>

View File

@@ -1,230 +1,334 @@
import { defineStore } from 'pinia'
import {
getToken,
getUserInfoData,
setUserInfoData,
removeUserInfoData,
getSig,
setSig,
removeSig,
getFontSize,
setFontSize,
removeFontSize
defineStore
} from 'pinia'
import {
getToken,
getUserInfoData,
setUserInfoData,
removeUserInfoData,
getSig,
setSig,
removeSig,
getFontSize,
setFontSize,
removeFontSize
} from '@/utils/storage'
// #ifdef APP-PLUS
import { useLoginState } from '@/uni_modules/tuikit-atomic-x/state/LoginState'
import {
useLoginState
} from '@/uni_modules/tuikit-atomic-x/state/LoginState'
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'
// #endif
// #ifdef H5
import { useLoginState } from 'tuikit-atomicx-vue3'
import {
useLoginState
} from 'tuikit-atomicx-vue3'
// #endif
import { useTokenStore } from './token'
import { getUserData, userLogout, updateUserData } from '@/api'
import { ref } from 'vue'
import { useUI } from '@/utils/use-ui'
import { reLaunch } from '@/utils/router'
import { getTencentUserSig } from '@/api'
import { TUILogin } from '@tencentcloud/tui-core-lite'
import { TUIChatEngine } from '@tencentcloud/chat-uikit-engine-lite'
import { getUserIntegral } from '@/api/my-index'
import { removeFriendList, removeGroupList } from '../utils/storage'
import { getRongYunLoginInfo } from '../api'
import {
useTokenStore
} from './token'
import {
getUserData,
userLogout,
updateUserData
} from '@/api'
import {
ref
} from 'vue'
import {
useUI
} from '@/utils/use-ui'
import {
reLaunch
} from '@/utils/router'
import {
getTencentUserSig
} from '@/api'
import {
TUILogin
} from '@tencentcloud/tui-core-lite'
import {
TUIChatEngine
} from '@tencentcloud/chat-uikit-engine-lite'
import {
getUserIntegral
} from '@/api/my-index'
import {
removeFriendList,
removeGroupList
} from '../utils/storage'
import {
getRongYunLoginInfo
} from '../api'
export const useUserStore = defineStore('user', () => {
const { clearToken } = useTokenStore()
const { showDialog, showToast } = useUI()
const {
clearToken
} = useTokenStore()
const {
showDialog,
showToast
} = useUI()
const userInfo = ref(
getUserInfoData() ? JSON?.parse(getUserInfoData()) : {}
)
/** 用户字体大小 */
const fontSizeData = ref(getFontSize())
const userInfo = ref(
getUserInfoData() ? JSON?.parse(getUserInfoData()) : {}
)
/** 用户字体大小 */
const fontSizeData = ref(getFontSize())
/** 腾讯 IM 存储数据 */
const tencentUserSig = ref(getSig() ? JSON?.parse(getSig()) : {})
/** 腾讯 IM 存储数据 */
const tencentUserSig = ref(getSig() ? JSON?.parse(getSig()) : {})
/** 用户积分数 */
const integralData = ref(0)
/** 用户积分数 */
const integralData = ref(0)
const imEngine = ref(null)
/**
* 获取用户信息(可从缓存或接口)
*/
const fetchUserInfo = async () => {
// 尝试从本地缓存读取
const cachedToken = getToken()
const cachedUserInfo = getUserInfoData()
const cachedSig = getSig()
/**
* 获取用户信息(可从缓存或接口)
*/
const fetchUserInfo = async () => {
// 尝试从本地缓存读取
const cachedToken = getToken()
const cachedUserInfo = getUserInfoData()
const cachedSig = getSig()
if (cachedToken && cachedUserInfo) {
userInfo.value = JSON.parse(cachedUserInfo)
tencentUserSig.value = JSON.parse(cachedSig)
loginTencentIM()
return
}
await getIntegral()
const res = await getUserData()
await setUserInfo(res.data)
loginTencentIM()
return
}
if (cachedToken && cachedUserInfo) {
userInfo.value = JSON.parse(cachedUserInfo)
tencentUserSig.value = JSON.parse(cachedSig)
loginTencentIM()
return
}
await getIntegral()
const res = await getUserData()
await setUserInfo(res.data)
loginTencentIM()
return
}
/**
* 设置用户信息
*/
const setUserInfo = async data => {
const res = await getTencentUserSig()
const ryData = await getRongYunLoginInfo()
const IM_DATA = {
...res.data,
...ryData.data
}
tencentUserSig.value = IM_DATA
userInfo.value = data
setUserInfoData(data)
setSig(IM_DATA)
}
/**
* 设置用户信息
*/
const setUserInfo = async data => {
const res = await getTencentUserSig()
const ryData = await getRongYunLoginInfo()
const IM_DATA = {
...res.data,
...ryData.data
}
tencentUserSig.value = IM_DATA
userInfo.value = data
setUserInfoData(data)
setSig(IM_DATA)
}
/** 获取用户积分 */
const getIntegral = async () => {
const res = await getUserIntegral()
integralData.value = res.data.availablePoints
}
/** 获取用户积分 */
const getIntegral = async () => {
const res = await getUserIntegral()
integralData.value = res.data.availablePoints
}
/**
* 登录腾讯 IM
*/
const loginTencentIM = async () => {
await refreshUserInfo()
await TUILogin.login({
SDKAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig,
framework: `vue3`
})
/**
* 登录腾讯 IM
*/
const loginTencentIM = async () => {
await refreshUserInfo()
await TUILogin.login({
SDKAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig,
framework: `vue3`
})
await TUIChatEngine.login({
SDKAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig,
useUploadPlugin: true // 使用文件上传插件
})
// #ifdef H5
await useLoginState().login({
SDKAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig
})
// #endif
await TUIChatEngine.login({
SDKAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig,
useUploadPlugin: true // 使用文件上传插件
})
// #ifdef H5
await useLoginState().login({
SDKAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig
})
// #endif
// #ifdef APP-PLUS
await useLoginState().login({
sdkAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig
})
console.log(tencentUserSig.value.appKey, '====')
await RCIMIWEngine.create(tencentUserSig.value.appKey, {
kickReconnectDevice: true,
logLevel: 'debug'
}).then(
res => {
//本地代码保存引擎
console.log(res, '====')
}
).catch(err => {
console.log(err, '====')
})
// #endif
}
// #ifdef APP-PLUS
await useLoginState().login({
sdkAppID: tencentUserSig.value.sdkappID,
userID: tencentUserSig.value.userId,
userSig: tencentUserSig.value.userSig
})
console.log(tencentUserSig.value.appKey, '====')
connectIM()
// #endif
}
/**
* 清除用户信息(退出登录)
*/
const clearUserInfo = async () => {
const show = await showDialog('提示', '确定要退出登录吗?')
if (show) {
await logout()
}
}
//连接融云IM
async function connectIM() {
const options = {
naviServer: ''
}
imEngine.value = await RCIMIWEngine.create(tencentUserSig.value.appKey, options)
imEngine.value.setOnConnectedListener((res) => {
if (res.code != 0) {
uni.hideLoading();
uni.showToast({
title: 'OnCon:' + res.code,
icon: 'error'
})
return
}
//连接成功
CallLib.init({});
onAllListeners()
console.log('call.init')
// this.libPage = true;
// this.loginUserId = res.userId;
uni.hideLoading();
uni.showToast({
title: res.userId
});
if (uni.getSystemInfoSync().platform === 'android') {
permision.requestAndroidPermission('android.permission.CAMERA');
permision.requestAndroidPermission('android.permission.RECORD_AUDIO');
}
});
let code = await imEngine.value.connect(tencentUserSig.value.ryToken, 10)
if (code != 0) {
uni.hideLoading();
uni.showToast({
title: 'connect:' + code,
icon: 'error'
})
}
}
function onAllListeners(){
CallLib.onCallReceived(res => {
console.log(res)
console.log(
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
res.data.targetId
)
})
CallLib.onCallConnected(res => {
console.log(res)
console.log(
'Engine:OnCallConnected=>' +
'已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
res
)
})
CallLib.onRemoteUserJoined(res => {
console.log(
'Engine:OnRemoteUserJoined=>' +
'主叫端拨出电话被叫端收到请求后加入通话被叫端Id为=>',
res.data.userId
)
})
CallLib.onCallDisconnected(res => {
console.log(
'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
res.data.reason
)
})
}
/**
* 退出登录(不带提示
*/
const logout = async () => {
if (!userInfo.value) return
try {
userInfo.value = null
/**
* 清除用户信息(退出登录)
*/
const clearUserInfo = async () => {
const show = await showDialog('提示', '确定要退出登录吗?')
if (show) {
await logout()
}
}
await userLogout()
await TUILogin.logout()
await TUIChatEngine.logout()
// #ifdef APP-PLUS
removeFriendList()
removeGroupList()
await useLoginState().logout()
// #endif
// #ifdef H5
await useLoginState().logout()
// #endif
clearAllUserInfo()
await showToast('退出登录成功', 'success')
reLaunch('/pages/login/login')
} catch (error) {
clearAllUserInfo()
await showToast('退出登录成功', 'success')
reLaunch('/pages/login/login')
}
}
/**
* 退出登录(不带提示)
*/
const logout = async () => {
if (!userInfo.value) return
try {
userInfo.value = null
/** 清空所有用户缓存 */
const clearAllUserInfo = async () => {
userInfo.value = null
tencentUserSig.value = null
fontSizeData.value = 26
clearToken()
removeUserInfoData()
removeSig()
removeFontSize()
}
await userLogout()
await TUILogin.logout()
await TUIChatEngine.logout()
// #ifdef APP-PLUS
removeFriendList()
removeGroupList()
await useLoginState().logout()
// #endif
// #ifdef H5
await useLoginState().logout()
// #endif
clearAllUserInfo()
await showToast('退出登录成功', 'success')
reLaunch('/pages/login/login')
} catch (error) {
clearAllUserInfo()
await showToast('退出登录成功', 'success')
reLaunch('/pages/login/login')
}
}
/** 刷新用户信息(如用户信息被修改) */
const refreshUserInfo = async () => {
const res = await getUserData()
await getIntegral()
await setUserInfoData(res.data)
userInfo.value = res.data
}
/** 清空所有用户缓存 */
const clearAllUserInfo = async () => {
userInfo.value = null
tencentUserSig.value = null
fontSizeData.value = 26
clearToken()
removeUserInfoData()
removeSig()
removeFontSize()
}
/**
* 更新部分用户信息(例如昵称、头像)
*/
const updateUserInfo = async partialData => {
if (!userInfo.value) return
await updateUserData(partialData)
await refreshUserInfo()
}
/** 刷新用户信息(如用户信息被修改) */
const refreshUserInfo = async () => {
const res = await getUserData()
await getIntegral()
await setUserInfoData(res.data)
userInfo.value = res.data
}
/** 更新字体大小 */
const updateFontSize = async fontSize => {
fontSizeData.value = fontSize
setFontSize(fontSize)
}
/**
* 更新部分用户信息(例如昵称、头像)
*/
const updateUserInfo = async partialData => {
if (!userInfo.value) return
await updateUserData(partialData)
await refreshUserInfo()
}
return {
userInfo,
integralData,
tencentUserSig,
fontSizeData,
getIntegral,
clearAllUserInfo,
updateFontSize,
logout,
refreshUserInfo,
fetchUserInfo,
loginTencentIM,
setUserInfo,
clearUserInfo,
updateUserInfo
}
})
/** 更新字体大小 */
const updateFontSize = async fontSize => {
fontSizeData.value = fontSize
setFontSize(fontSize)
}
return {
userInfo,
integralData,
tencentUserSig,
fontSizeData,
getIntegral,
clearAllUserInfo,
updateFontSize,
logout,
refreshUserInfo,
fetchUserInfo,
loginTencentIM,
setUserInfo,
clearUserInfo,
updateUserInfo
}
})

View File

@@ -4,9 +4,6 @@
* Tue Dec 02 2025 16:50:41 GMT+0800 (China Standard Time)
* ©2020 RongCloud, Inc. All rights reserved.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
class Logger {
tag;
@@ -18,417 +15,391 @@ class Logger {
log(str) {
console.log(`[${this.tag}] ${new Date().toISOString()} ${str}`);
}
}
const logger = new Logger('RCUNICallLib');
exports.RCCallIWCamera = void 0;
// 枚举定义
export const RCCallIWCamera = {
NONE: 0,
FRONT: 1,
BACK: 2
};
(function (RCCallIWCamera) {
RCCallIWCamera[RCCallIWCamera["NONE"] = 0] = "NONE";
RCCallIWCamera[RCCallIWCamera["FRONT"] = 1] = "FRONT";
RCCallIWCamera[RCCallIWCamera["BACK"] = 2] = "BACK";
})(exports.RCCallIWCamera || (exports.RCCallIWCamera = {}));
export const RCCallIWMediaType = {
AUDIO: 0,
AUDIO_VIDEO: 1
};
exports.RCCallIWMediaType = void 0;
export const RCUNICallErrorCode = {
SUCCESS: 0,
ENGINE_NOT_FOUND: 1,
NETWORK_UNAVAILABLE: 2,
ONE_CALL_EXISTED: 3,
OPERATION_UNAVAILABLE: 4,
INVALID_PARAM: 5,
NETWORK_UNSTABLE: 6,
MEDIA_REQUEST_FAILED: 7,
MEDIA_SERVER_NOT_READY: 8,
MEDIA_SERVER_NOT_INITIALIZED: 9,
MEDIA_REQUEST_TIMEOUT: 10,
MEDIA_UNKOWN_ERROR: 11,
MEDIA_KICKED_BY_SERVER_ERROR: 12,
MEDIA_SERVER_CLOSED_ERROR: 13,
MEDIA_SERVER_PUBLISH_ERROR: 14,
MEDIA_SERVER_SUBSCRIBE_ERROR: 15,
MEDIA_JOIN_ROOM_REFUSE_ERROR: 16
};
(function (RCCallIWMediaType) {
RCCallIWMediaType[RCCallIWMediaType["AUDIO"] = 0] = "AUDIO";
RCCallIWMediaType[RCCallIWMediaType["AUDIO_VIDEO"] = 1] = "AUDIO_VIDEO";
})(exports.RCCallIWMediaType || (exports.RCCallIWMediaType = {}));
export const RCCallIWCallDisconnectedReason = {
CANCEL: 0,
REJECT: 1,
HANGUP: 2,
BUSY_LINE: 3,
NO_RESPONSE: 4,
ENGINE_UNSUPPORTED: 5,
NETWORK_ERROR: 6,
RESOURCE_GET_ERROR: 7,
RESOURCE_PUBLISH_ERROR: 8,
RESOURCE_SUBSCRIBE_ERROR: 9,
REMOTE_CANCEL: 10,
REMOTE_REJECT: 11,
REMOTE_HANGUP: 12,
REMOTE_BUSY_LINE: 13,
REMOTE_NO_RESPONSE: 14,
REMOTE_ENGINE_UNSUPPORTED: 15,
REMOTE_NETWORK_ERROR: 16,
REMOTE_RESOURCE_GET_ERROR: 17,
REMOTE_RESOURCE_PUBLISH_ERROR: 18,
REMOTE_RESOURCE_SUBSCRIBE_ERROR: 19,
KICKED_BY_OTHER_CALL: 20,
IN_OTHER_CALL: 21,
KICKED_BY_SERVER: 22,
REMOTE_KICKED_BY_OTHER_CALL: 23,
REMOTE_IN_OTHER_CALL: 24,
REMOTE_KICKED_BY_SERVER: 25,
ACCEPT_BY_OTHER_CLIENT: 26,
HANGUP_BY_OTHER_CLIENT: 27,
REJECTED_BY_BLACKLIST: 28,
SERVICE_NOT_OPENED: 29,
DROP_TO_OBSERVER: 30,
INIT_VIDEO_ERROR: 31,
OTHER_DEVICE_HAD_ACCEPTED: 32,
SERVICE_DISCONNECTED: 33
};
exports.RCUNICallErrorCode = void 0;
export const RCCallIWAudioCodecType = {
PCMU: 0,
OPUS: 111
};
(function (RCUNICallErrorCode) {
RCUNICallErrorCode[RCUNICallErrorCode["SUCCESS"] = 0] = "SUCCESS";
RCUNICallErrorCode[RCUNICallErrorCode["ENGINE_NOT_FOUND"] = 1] = "ENGINE_NOT_FOUND";
RCUNICallErrorCode[RCUNICallErrorCode["NETWORK_UNAVAILABLE"] = 2] = "NETWORK_UNAVAILABLE";
RCUNICallErrorCode[RCUNICallErrorCode["ONE_CALL_EXISTED"] = 3] = "ONE_CALL_EXISTED";
RCUNICallErrorCode[RCUNICallErrorCode["OPERATION_UNAVAILABLE"] = 4] = "OPERATION_UNAVAILABLE";
RCUNICallErrorCode[RCUNICallErrorCode["INVALID_PARAM"] = 5] = "INVALID_PARAM";
RCUNICallErrorCode[RCUNICallErrorCode["NETWORK_UNSTABLE"] = 6] = "NETWORK_UNSTABLE";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_REQUEST_FAILED"] = 7] = "MEDIA_REQUEST_FAILED";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_NOT_READY"] = 8] = "MEDIA_SERVER_NOT_READY";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_NOT_INITIALIZED"] = 9] = "MEDIA_SERVER_NOT_INITIALIZED";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_REQUEST_TIMEOUT"] = 10] = "MEDIA_REQUEST_TIMEOUT";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_UNKOWN_ERROR"] = 11] = "MEDIA_UNKOWN_ERROR";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_KICKED_BY_SERVER_ERROR"] = 12] = "MEDIA_KICKED_BY_SERVER_ERROR";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_CLOSED_ERROR"] = 13] = "MEDIA_SERVER_CLOSED_ERROR";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_PUBLISH_ERROR"] = 14] = "MEDIA_SERVER_PUBLISH_ERROR";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_SUBSCRIBE_ERROR"] = 15] = "MEDIA_SERVER_SUBSCRIBE_ERROR";
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_JOIN_ROOM_REFUSE_ERROR"] = 16] = "MEDIA_JOIN_ROOM_REFUSE_ERROR";
})(exports.RCUNICallErrorCode || (exports.RCUNICallErrorCode = {}));
export const RCCallIWAudioSource = {
DEFAULT: 0,
MIC: 1,
VOICE_UPLINK: 2,
VOICE_DOWNLINK: 3,
VOICE_CALL: 4,
CAMCORDER: 5,
VOICE_RECOGNITION: 6,
VOICE_COMMUNICATION: 7
};
exports.RCCallIWCallDisconnectedReason = void 0;
export const RCCallIWVideoProfile = {
PROFILE_144_256: 0,
PROFILE_240_240: 1,
PROFILE_240_320: 2,
PROFILE_360_480: 3,
PROFILE_360_640: 4,
PROFILE_480_640: 5,
PROFILE_480_720: 6,
PROFILE_720_1280: 7,
PROFILE_1080_1920: 8,
PROFILE_144_256_HIGH: 9,
PROFILE_240_240_HIGH: 10,
PROFILE_240_320_HIGH: 11,
PROFILE_360_480_HIGH: 12,
PROFILE_360_640_HIGH: 13,
PROFILE_480_640_HIGH: 14,
PROFILE_480_720_HIGH: 15,
PROFILE_720_1280_HIGH: 16,
PROFILE_1080_1920_HIGH: 17
};
(function (RCCallIWCallDisconnectedReason) {
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["CANCEL"] = 0] = "CANCEL";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REJECT"] = 1] = "REJECT";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["HANGUP"] = 2] = "HANGUP";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["BUSY_LINE"] = 3] = "BUSY_LINE";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["NO_RESPONSE"] = 4] = "NO_RESPONSE";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["ENGINE_UNSUPPORTED"] = 5] = "ENGINE_UNSUPPORTED";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["NETWORK_ERROR"] = 6] = "NETWORK_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["RESOURCE_GET_ERROR"] = 7] = "RESOURCE_GET_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["RESOURCE_PUBLISH_ERROR"] = 8] = "RESOURCE_PUBLISH_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["RESOURCE_SUBSCRIBE_ERROR"] = 9] = "RESOURCE_SUBSCRIBE_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_CANCEL"] = 10] = "REMOTE_CANCEL";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_REJECT"] = 11] = "REMOTE_REJECT";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_HANGUP"] = 12] = "REMOTE_HANGUP";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_BUSY_LINE"] = 13] = "REMOTE_BUSY_LINE";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_NO_RESPONSE"] = 14] = "REMOTE_NO_RESPONSE";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_ENGINE_UNSUPPORTED"] = 15] = "REMOTE_ENGINE_UNSUPPORTED";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_NETWORK_ERROR"] = 16] = "REMOTE_NETWORK_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_RESOURCE_GET_ERROR"] = 17] = "REMOTE_RESOURCE_GET_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_RESOURCE_PUBLISH_ERROR"] = 18] = "REMOTE_RESOURCE_PUBLISH_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_RESOURCE_SUBSCRIBE_ERROR"] = 19] = "REMOTE_RESOURCE_SUBSCRIBE_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["KICKED_BY_OTHER_CALL"] = 20] = "KICKED_BY_OTHER_CALL";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["IN_OTHER_CALL"] = 21] = "IN_OTHER_CALL";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["KICKED_BY_SERVER"] = 22] = "KICKED_BY_SERVER";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_KICKED_BY_OTHER_CALL"] = 23] = "REMOTE_KICKED_BY_OTHER_CALL";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_IN_OTHER_CALL"] = 24] = "REMOTE_IN_OTHER_CALL";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_KICKED_BY_SERVER"] = 25] = "REMOTE_KICKED_BY_SERVER";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["ACCEPT_BY_OTHER_CLIENT"] = 26] = "ACCEPT_BY_OTHER_CLIENT";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["HANGUP_BY_OTHER_CLIENT"] = 27] = "HANGUP_BY_OTHER_CLIENT";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REJECTED_BY_BLACKLIST"] = 28] = "REJECTED_BY_BLACKLIST";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["SERVICE_NOT_OPENED"] = 29] = "SERVICE_NOT_OPENED";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["DROP_TO_OBSERVER"] = 30] = "DROP_TO_OBSERVER";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["INIT_VIDEO_ERROR"] = 31] = "INIT_VIDEO_ERROR";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["OTHER_DEVICE_HAD_ACCEPTED"] = 32] = "OTHER_DEVICE_HAD_ACCEPTED";
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["SERVICE_DISCONNECTED"] = 33] = "SERVICE_DISCONNECTED";
})(exports.RCCallIWCallDisconnectedReason || (exports.RCCallIWCallDisconnectedReason = {}));
export const RCCallIWCameraOrientation = {
PORTRAIT: 0,
PORTRAIT_UPSIDE_DOWN: 1,
LANDSCAPE_RIGHT: 2,
LANDSCAPE_LEFT: 3
};
exports.RCCallIWAudioCodecType = void 0;
export const RCCallIWVideoBitrateMode = {
CQ: 0,
VBR: 1,
CBR: 2
};
(function (RCCallIWAudioCodecType) {
RCCallIWAudioCodecType[RCCallIWAudioCodecType["PCMU"] = 0] = "PCMU";
RCCallIWAudioCodecType[RCCallIWAudioCodecType["OPUS"] = 111] = "OPUS";
})(exports.RCCallIWAudioCodecType || (exports.RCCallIWAudioCodecType = {}));
export const RCCallIWNetworkQuality = {
UNKNOWN: 0,
EXCELLENT: 1,
GOOD: 2,
POOR: 3,
BAD: 4,
TERRIBLE: 5
};
exports.RCCallIWAudioSource = void 0;
export const RCCallIWImportanceHW = {
NORMAL: 0,
LOW: 1
};
(function (RCCallIWAudioSource) {
RCCallIWAudioSource[RCCallIWAudioSource["DEFAULT"] = 0] = "DEFAULT";
RCCallIWAudioSource[RCCallIWAudioSource["MIC"] = 1] = "MIC";
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_UPLINK"] = 2] = "VOICE_UPLINK";
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_DOWNLINK"] = 3] = "VOICE_DOWNLINK";
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_CALL"] = 4] = "VOICE_CALL";
RCCallIWAudioSource[RCCallIWAudioSource["CAMCORDER"] = 5] = "CAMCORDER";
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_RECOGNITION"] = 6] = "VOICE_RECOGNITION";
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_COMMUNICATION"] = 7] = "VOICE_COMMUNICATION";
})(exports.RCCallIWAudioSource || (exports.RCCallIWAudioSource = {}));
export const RCCallIWCallType = {
SINGLE: 0,
GROUP: 1
};
exports.RCCallIWVideoProfile = void 0;
(function (RCCallIWVideoProfile) {
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_144_256"] = 0] = "PROFILE_144_256";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_240"] = 1] = "PROFILE_240_240";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_320"] = 2] = "PROFILE_240_320";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_480"] = 3] = "PROFILE_360_480";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_640"] = 4] = "PROFILE_360_640";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_640"] = 5] = "PROFILE_480_640";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_720"] = 6] = "PROFILE_480_720";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_720_1280"] = 7] = "PROFILE_720_1280";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_1080_1920"] = 8] = "PROFILE_1080_1920";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_144_256_HIGH"] = 9] = "PROFILE_144_256_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_240_HIGH"] = 10] = "PROFILE_240_240_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_320_HIGH"] = 11] = "PROFILE_240_320_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_480_HIGH"] = 12] = "PROFILE_360_480_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_640_HIGH"] = 13] = "PROFILE_360_640_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_640_HIGH"] = 14] = "PROFILE_480_640_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_720_HIGH"] = 15] = "PROFILE_480_720_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_720_1280_HIGH"] = 16] = "PROFILE_720_1280_HIGH";
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_1080_1920_HIGH"] = 17] = "PROFILE_1080_1920_HIGH";
})(exports.RCCallIWVideoProfile || (exports.RCCallIWVideoProfile = {}));
exports.RCCallIWCameraOrientation = void 0;
(function (RCCallIWCameraOrientation) {
RCCallIWCameraOrientation[RCCallIWCameraOrientation["PORTRAIT"] = 0] = "PORTRAIT";
RCCallIWCameraOrientation[RCCallIWCameraOrientation["PORTRAIT_UPSIDE_DOWN"] = 1] = "PORTRAIT_UPSIDE_DOWN";
RCCallIWCameraOrientation[RCCallIWCameraOrientation["LANDSCAPE_RIGHT"] = 2] = "LANDSCAPE_RIGHT";
RCCallIWCameraOrientation[RCCallIWCameraOrientation["LANDSCAPE_LEFT"] = 3] = "LANDSCAPE_LEFT";
})(exports.RCCallIWCameraOrientation || (exports.RCCallIWCameraOrientation = {}));
exports.RCCallIWVideoBitrateMode = void 0;
(function (RCCallIWVideoBitrateMode) {
RCCallIWVideoBitrateMode[RCCallIWVideoBitrateMode["CQ"] = 0] = "CQ";
RCCallIWVideoBitrateMode[RCCallIWVideoBitrateMode["VBR"] = 1] = "VBR";
RCCallIWVideoBitrateMode[RCCallIWVideoBitrateMode["CBR"] = 2] = "CBR";
})(exports.RCCallIWVideoBitrateMode || (exports.RCCallIWVideoBitrateMode = {}));
exports.RCCallIWNetworkQuality = void 0;
(function (RCCallIWNetworkQuality) {
RCCallIWNetworkQuality[RCCallIWNetworkQuality["UNKNOWN"] = 0] = "UNKNOWN";
RCCallIWNetworkQuality[RCCallIWNetworkQuality["EXCELLENT"] = 1] = "EXCELLENT";
RCCallIWNetworkQuality[RCCallIWNetworkQuality["GOOD"] = 2] = "GOOD";
RCCallIWNetworkQuality[RCCallIWNetworkQuality["POOR"] = 3] = "POOR";
RCCallIWNetworkQuality[RCCallIWNetworkQuality["BAD"] = 4] = "BAD";
RCCallIWNetworkQuality[RCCallIWNetworkQuality["TERRIBLE"] = 5] = "TERRIBLE";
})(exports.RCCallIWNetworkQuality || (exports.RCCallIWNetworkQuality = {}));
exports.RCCallIWImportanceHW = void 0;
(function (RCCallIWImportanceHW) {
RCCallIWImportanceHW[RCCallIWImportanceHW["NORMAL"] = 0] = "NORMAL";
RCCallIWImportanceHW[RCCallIWImportanceHW["LOW"] = 1] = "LOW";
})(exports.RCCallIWImportanceHW || (exports.RCCallIWImportanceHW = {}));
exports.RCCallIWCallType = void 0;
(function (RCCallIWCallType) {
RCCallIWCallType[RCCallIWCallType["SINGLE"] = 0] = "SINGLE";
RCCallIWCallType[RCCallIWCallType["GROUP"] = 1] = "GROUP";
})(exports.RCCallIWCallType || (exports.RCCallIWCallType = {}));
exports.RCCallIWUserType = void 0;
(function (RCCallIWUserType) {
RCCallIWUserType[RCCallIWUserType["NORMAL"] = 0] = "NORMAL";
RCCallIWUserType[RCCallIWUserType["OBSERVER"] = 1] = "OBSERVER";
})(exports.RCCallIWUserType || (exports.RCCallIWUserType = {}));
export const RCCallIWUserType = {
NORMAL: 0,
OBSERVER: 1
};
const call = uni.requireNativePlugin('RongCloud-Call-RCUniCall');
const Platform = uni.getSystemInfoSync().platform;
function init() {
export function init() {
logger.log(`init Platform->${Platform}`);
call.init({});
}
function unInit() {
export function unInit() {
logger.log(`unInit Platform->${Platform}`);
call.unInit();
}
function onCallReceived(listener) {
export function onCallReceived(listener) {
logger.log(`Engine:OnCallReceived 监听通话呼入 Platform->${Platform}`);
call.addEventListener("Engine:OnCallReceived", listener);
}
function removeCallReceivedListener() {
export function removeCallReceivedListener() {
logger.log(`removeCallReceivedListener`);
call.removeAllEventListeners('Engine:OnCallReceived');
}
function onCallConnected(listener) {
export function onCallConnected(listener) {
logger.log(`Engine:OnCallConnected 已建立通话通话接通 Platform->${Platform}`);
call.addEventListener("Engine:OnCallConnected", listener);
}
function removeCallConnectedListener() {
export function removeCallConnectedListener() {
logger.log(`removeCallConnectedListener`);
call.removeAllEventListeners('Engine:OnCallConnected');
}
function onCallDisconnected(listener) {
export function onCallDisconnected(listener) {
logger.log(`Engine:OnCallDisconnected 监听通话结束 Platform->${Platform}`);
call.addEventListener("Engine:OnCallDisconnected", listener);
}
function removeCallDisconnectedListener() {
export function removeCallDisconnectedListener() {
logger.log(`removeCallDisconnectedListener`);
call.removeAllEventListeners('Engine:OnCallDisconnected');
}
function onRemoteUserInvited(listener) {
export function onRemoteUserInvited(listener) {
logger.log(`Engine:OnRemoteUserInvited 通话中的某一个参与者,邀请好友加入通话 Platform->${Platform}`);
call.addEventListener("Engine:OnRemoteUserInvited", listener);
}
function removeRemoteUserInvited() {
export function removeRemoteUserInvited() {
logger.log(`removeRemoteUserInvited`);
call.removeAllEventListeners('Engine:OnRemoteUserInvited');
}
function onRemoteUserJoined(listener) {
export function onRemoteUserJoined(listener) {
logger.log(`Engine:OnRemoteUserJoined 对端用户加入通话 Platform->${Platform}`);
call.addEventListener("Engine:OnRemoteUserJoined", listener);
}
function removeRemoteUserJoinedListener() {
export function removeRemoteUserJoinedListener() {
logger.log(`removeRemoteUserJoinedListener`);
call.removeAllEventListeners('Engine:OnRemoteUserJoined');
}
function onRemoteUserLeft(listener) {
export function onRemoteUserLeft(listener) {
logger.log(`Engine:OnRemoteUserLeft 对端用户挂断(群聊触发) Platform->${Platform}`);
call.addEventListener("Engine:OnRemoteUserLeft", listener);
}
function removeRemoteUserLeftListener() {
export function removeRemoteUserLeftListener() {
logger.log(`removeRemoteUserLeftListener`);
call.removeAllEventListeners('Engine:OnRemoteUserLeft');
}
function onCallOutgoing(listener) {
export function onCallOutgoing(listener) {
logger.log(`Engine:OnCallOutgoing 电话已拨出,通知当前 call 的详细信息 Platform->${Platform}`);
call.addEventListener("Engine:OnCallOutgoing", listener);
}
function removeCallOutgoingListener() {
export function removeCallOutgoingListener() {
logger.log(`removeCallOutgoingListener`);
call.removeAllEventListeners('Engine:OnCallOutgoing');
}
function onRemoteUserRinging(listener) {
export function onRemoteUserRinging(listener) {
logger.log(`Engine:OnRemoteUserRinging 被叫端收到请求,发出振铃响应时监听 Platform->${Platform}`);
call.addEventListener("Engine:OnRemoteUserRinging", listener);
}
function removeRemoteUserRingingListener() {
export function removeRemoteUserRingingListener() {
logger.log(`removeRemoteUserRingingListener`);
call.removeAllEventListeners('Engine:OnRemoteUserRinging');
}
function onError(listener) {
export function onError(listener) {
logger.log(`Engine:OnError 通话出现错误 Platform->${Platform}`);
call.addEventListener("Engine:OnError", listener);
}
function removeErrorListener() {
export function removeErrorListener() {
logger.log(`removeErrorListener`);
call.removeAllEventListeners('Engine:OnError');
}
function onRemoteUserMediaTypeChanged(listener) {
export function onRemoteUserMediaTypeChanged(listener) {
logger.log(`Engine:OnRemoteUserMediaTypeChanged 对端用户切换了媒体类型 Platform->${Platform}`);
call.addEventListener("Engine:OnRemoteUserMediaTypeChanged", listener);
}
function removeRemoteUserMediaTypeChangedListener() {
export function removeRemoteUserMediaTypeChangedListener() {
logger.log(`removeRemoteUserMediaTypeChangedListener`);
call.removeAllEventListeners('Engine:OnRemoteUserMediaTypeChanged');
}
function onRemoteUserCameraStateChanged(listener) {
export function onRemoteUserCameraStateChanged(listener) {
logger.log(`Engine:OnRemoteUserCameraStateChanged 对端用户关闭了摄像头 Platform->${Platform}`);
call.addEventListener("Engine:OnRemoteUserCameraStateChanged", listener);
}
function removeRemoteUserCameraStateChangedListener() {
export function removeRemoteUserCameraStateChangedListener() {
logger.log(`removeRemoteUserCameraStateChangedListener`);
call.removeAllEventListeners('Engine:OnRemoteUserCameraStateChanged');
}
function onRemoteUserMicrophoneStateChanged(listener) {
export function onRemoteUserMicrophoneStateChanged(listener) {
logger.log(`Engine:OnRemoteUserMicrophoneStateChanged 对端用户开关麦克风 Platform->${Platform}`);
call.addEventListener("Engine:OnRemoteUserMicrophoneStateChanged", listener);
}
function removeRemoteUserMicrophoneStateChangedListener() {
export function removeRemoteUserMicrophoneStateChangedListener() {
logger.log(`removeRemoteUserMicrophoneStateChanged`);
call.removeAllEventListeners('Engine:OnRemoteUserMicrophoneStateChanged');
}
function onNetworkQuality(listener) {
export function onNetworkQuality(listener) {
logger.log(`Engine:OnNetworkQuality Platform->${Platform}`);
call.addEventListener("Engine:OnNetworkQuality", listener);
}
function removeNetworkQualityListener() {
export function removeNetworkQualityListener() {
call.removeAllEventListeners('Engine:OnNetworkQuality');
}
function onEnableCamera(listener) {
export function onEnableCamera(listener) {
logger.log(`Engine:OnEnableCamera Platform->${Platform}`);
call.addEventListener("Engine:OnEnableCamera", listener);
}
function removeEnableCameraListener() {
export function removeEnableCameraListener() {
logger.log(`removeEnableCameraListener`);
call.removeAllEventListeners('Engine:OnEnableCamera');
}
function onSwitchCamera(listener) {
export function onSwitchCamera(listener) {
logger.log(`Engine:OnSwitchCamera Platform->${Platform}`);
call.addEventListener("Engine:OnSwitchCamera", listener);
}
function removeSwitchCameraListener() {
export function removeSwitchCameraListener() {
logger.log(`removeSwitchCameraListener`);
call.removeAllEventListeners('Engine:OnSwitchCamera');
}
function getCurrentCallSession() {
export function getCurrentCallSession() {
logger.log(`getCurrentCallSession Platform->${Platform}`);
return call.getCurrentCallSession();
}
function hangup() {
export function hangup() {
logger.log(`hangup Platform->${Platform}`);
call.hangup();
}
function accept() {
export function accept() {
logger.log(`accept Platform->${Platform}`);
call.accept();
}
function startSingleCall(targetId, type, extra) {
export function startSingleCall(targetId, type, extra) {
logger.log(`startSingleCall targetId->${targetId} type=>${type} extra=>${extra} Platform->${Platform}`);
call.startSingleCall(targetId, type, extra);
}
function startGroupCall(groupId, userIds, observerUserIds, type, extra) {
export function startGroupCall(groupId, userIds, observerUserIds, type, extra) {
logger.log(`startGroupCall groupId->${groupId} userIds=>${userIds} observerUserIds=>${observerUserIds} type=>${type} extra=>${extra} Platform->${Platform}`);
call.startGroupCall(groupId, userIds, observerUserIds, type, extra);
}
function inviteUsers(userIds, observerUserIds) {
export function inviteUsers(userIds, observerUserIds) {
logger.log(`inviteUsers 邀请用户->${userIds} Platform->${Platform}`);
call.inviteUsers(userIds, observerUserIds);
}
function setVideoView(userId, ref, type, isZOrderOnTop = false) {
export function setVideoView(userId, ref, type, isZOrderOnTop = false) {
logger.log(`setVideoView userId->${userId} ref=>${ref} type=>${type} isZOrderOnTop=>${isZOrderOnTop} Platform->${Platform}`);
Platform === 'android' ? call.setVideoView(userId, ref, type, isZOrderOnTop) : call.setVideoView(userId, ref, type);
}
function enableSpeaker(isOpen) {
export function enableSpeaker(isOpen) {
logger.log(`enableSpeaker isOPen->${isOpen} Platform->${Platform}`);
call.enableSpeaker(isOpen);
}
function enableMicrophone(isOpen) {
export function enableMicrophone(isOpen) {
logger.log(`enableMicrophone isOPen->${isOpen} Platform->${Platform}`);
call.enableMicrophone(isOpen);
}
function switchCamera() {
export function switchCamera() {
logger.log(`switchCamera Platform->${Platform}`);
call.switchCamera();
}
function currentCamera() {
export function currentCamera() {
logger.log(`currentCamera Platform->${Platform}`);
return call.currentCamera();
}
function enableCamera(isOpen, camera) {
export function enableCamera(isOpen, camera) {
logger.log(`enableCamera isOpen=>${isOpen} camera=>${camera} Platform->${Platform}`);
call.enableCamera(isOpen, camera);
}
function changeMediaType(type) {
export function changeMediaType(type) {
logger.log(`changeMediaType type=>${type} Platform->${Platform}`);
call.changeMediaType(type);
}
function setAudioConfig(config) {
export function setAudioConfig(config) {
logger.log(`setAudioConfig config=>${config} Platform->${Platform}`);
call.setAudioConfig(config);
}
function setVideoConfig(config) {
export function setVideoConfig(config) {
logger.log(`setVideoConfig config=>${config} Platform->${Platform}`);
call.setVideoConfig(config);
}
function setPushConfig(config, hangupPushConfig) {
export function setPushConfig(config, hangupPushConfig) {
logger.log(`setPushConfig config=>${config} hangupPushConfig=>${hangupPushConfig} Platform->${Platform}`);
call.setPushConfig(config, hangupPushConfig);
}
exports.accept = accept;
exports.changeMediaType = changeMediaType;
exports.currentCamera = currentCamera;
exports.enableCamera = enableCamera;
exports.enableMicrophone = enableMicrophone;
exports.enableSpeaker = enableSpeaker;
exports.getCurrentCallSession = getCurrentCallSession;
exports.hangup = hangup;
exports.init = init;
exports.inviteUsers = inviteUsers;
exports.onCallConnected = onCallConnected;
exports.onCallDisconnected = onCallDisconnected;
exports.onCallOutgoing = onCallOutgoing;
exports.onCallReceived = onCallReceived;
exports.onEnableCamera = onEnableCamera;
exports.onError = onError;
exports.onNetworkQuality = onNetworkQuality;
exports.onRemoteUserCameraStateChanged = onRemoteUserCameraStateChanged;
exports.onRemoteUserInvited = onRemoteUserInvited;
exports.onRemoteUserJoined = onRemoteUserJoined;
exports.onRemoteUserLeft = onRemoteUserLeft;
exports.onRemoteUserMediaTypeChanged = onRemoteUserMediaTypeChanged;
exports.onRemoteUserMicrophoneStateChanged = onRemoteUserMicrophoneStateChanged;
exports.onRemoteUserRinging = onRemoteUserRinging;
exports.onSwitchCamera = onSwitchCamera;
exports.removeCallConnectedListener = removeCallConnectedListener;
exports.removeCallDisconnectedListener = removeCallDisconnectedListener;
exports.removeCallOutgoingListener = removeCallOutgoingListener;
exports.removeCallReceivedListener = removeCallReceivedListener;
exports.removeEnableCameraListener = removeEnableCameraListener;
exports.removeErrorListener = removeErrorListener;
exports.removeNetworkQualityListener = removeNetworkQualityListener;
exports.removeRemoteUserCameraStateChangedListener = removeRemoteUserCameraStateChangedListener;
exports.removeRemoteUserInvited = removeRemoteUserInvited;
exports.removeRemoteUserJoinedListener = removeRemoteUserJoinedListener;
exports.removeRemoteUserLeftListener = removeRemoteUserLeftListener;
exports.removeRemoteUserMediaTypeChangedListener = removeRemoteUserMediaTypeChangedListener;
exports.removeRemoteUserMicrophoneStateChangedListener = removeRemoteUserMicrophoneStateChangedListener;
exports.removeRemoteUserRingingListener = removeRemoteUserRingingListener;
exports.removeSwitchCameraListener = removeSwitchCameraListener;
exports.setAudioConfig = setAudioConfig;
exports.setPushConfig = setPushConfig;
exports.setVideoConfig = setVideoConfig;
exports.setVideoView = setVideoView;
exports.startGroupCall = startGroupCall;
exports.startSingleCall = startSingleCall;
exports.switchCamera = switchCamera;
exports.unInit = unInit;
}

424
utils/code.js Normal file
View File

@@ -0,0 +1,424 @@
//通话异常错误处理
export const errorDeal = function(code){
let tit ='';
switch(code){
case 0:
tit = '成功';
break;
case 1:
tit = '开通的音视频服务没有及时生效或音视频服务已关闭请等待3-5小时后重新安装应用或开启音视频服务再进行测试';
break;
case 2:
tit = '网络不可用';
break;
case 3:
tit = '已经处于通话中了';
break;
case 4:
tit = '无效操作';
break;
case 5:
tit = '参数错误';
break;
case 6:
tit = '网络不稳定';
break;
case 7:
tit = '媒体服务请求失败';
break;
case 8:
tit = '媒体服务初始化失败';
break;
case 9:
tit = '媒体服务未初始化';
break;
case 10:
tit = '媒体服务请求超时';
break;
case 11:
tit = '未知的媒体服务错误';
break;
case 12:
tit = '已被禁止通话';
break;
case 13:
tit = '音视频服务已关闭';
break;
case 14:
tit = '音视频发布资源失败';
break;
case 15:
tit = '音视频订阅资源失败';
break;
case 16:
tit = '其他端已在通话中错误';
break;
default:
tit='';
}
}
//挂断原因错误处理
export const reasonDeal = function(code){
let tit ='';
switch(code){
case 0:
tit = '己方取消已发出的通话请求';
break;
case 1:
tit = '己方拒绝收到的通话请求';
break;
case 2:
tit = '己方挂断';
break;
case 3:
tit = '己方忙碌';
break;
case 4:
tit = '己方未接听';
break;
case 5:
tit = '己方不支持当前引擎';
break;
case 6:
tit = '己方网络出错';
break;
case 7:
tit = '己方获取媒体资源失败';
break;
case 8:
tit = '己方发布资源失败';
break;
case 9:
tit = '己方订阅资源失败';
break;
case 10:
tit = '对方取消已发出的通话请求';
break;
case 11:
tit = '对方拒绝收到的通话请求';
break;
case 12:
tit = '通话过程对方挂断';
break;
case 13:
tit = '对方忙碌';
break;
case 14:
tit = '对方未接听';
break;
case 15:
tit = '对方不支持当前引擎';
break;
case 16:
tit = '对方网络错误';
break;
case 17:
tit = '对方获取媒体资源失败';
break;
case 18:
tit = '对方发布资源失败';
break;
case 19:
tit = '对方订阅资源失败';
break;
case 20:
tit = '己方其他端已加入新通话';
break;
case 21:
tit = '己方其他端已在通话中';
break;
case 22:
tit = '己方已被禁止通话';
break;
case 23:
tit = '对方其他端已加入新通话';
break;
case 24:
tit = '对方其他端已在通话中';
break;
case 25:
tit = '对方已被禁止通话';
break;
case 26:
tit = '己方其他端已接听';
break;
case 27:
tit = '己方其他端已挂断';
break;
case 28:
tit = '己方被对方加入黑名单';
break;
case 29:
tit = '音视频服务已关闭';
break;
case 30:
tit = '己方被降级为观察者';
break;
case 31:
tit = '己方摄像头初始化错误,可能是没有打开使用摄像头权限';
break;
case 32:
tit = '其他端已经接听';
break;
case 33:
tit = 'im ipc服务已断开';
break;
default:
tit='';
}
return tit;
}
//im连接错误处理
export const imCode = function (code){
let tit = '';
switch(code){
case -1000:
tit = ' 开发者接口调用时传入的参数错误';
break;
case -4:
tit = '应用没有调用 connect() 方法,即调用业务';
break;
case -3:
tit = '参数异常, 请确认参数是否填写正确且有效';
break;
case -2:
tit = 'IPC 进程意外终止. 当 libRongIMLib.so 或 libsqlite.so 找不到或出现崩溃时也会触发此错误. 如果是系统进行了资源回收后调用接口会触发此问题SDK 会做好自动重连';
break;
case -1:
tit = '未知错误';
break;
case 0:
tit = '连接成功';
break;
case 1:
tit = '当前设备网络不可用';
break;
case 2:
tit = '当前设备切换到飞行模式';
break;
case 3:
tit = '当前设备切换到 2GGPRS、EDGE低速网络';
break;
case 4:
tit = '当前设备切换到 3G 或 4G 高速网络';
break;
case 5:
tit = '当前设备切换到 WIFI 网络';
break;
case 6:
tit = '当前用户在其他设备上登录,此设备被踢下线';
break;
case 7:
tit = '当前用户在 Web 端登录';
break;
case 8:
tit = '服务器异常';
break;
case 9:
tit = '连接验证异常';
break;
case 11:
tit = '连接失败或未连接';
break;
case 12:
tit = '当前用户已注销';
break;
case 405:
tit = '已被对方加入黑名单,消息发送失败';
break;
case 407:
tit = '未在对方的白名单中,消息发送失败';
break;
case 5004:
tit = '超时';
break;
case 20604:
tit = '发送消息频率过高1 秒钟最多只允许发送 5 条消息详细请联系商务电话13161856839';
break;
case 20605:
tit = '信令被封禁详细请联系商务电话13161856839';
break;
case 20607:
tit = '已被对方加入黑名单,消息发送失败';
break;
case 22406:
tit = '当前用户不在群组中';
break;
case 22408:
tit = '当前用户在群组中已被禁言';
break;
case 23406:
tit = '当前用户不在聊天室中';
break;
case 23408:
tit = '当前用户在聊天室中已被禁言';
break;
case 23409:
tit = '当前用户已被踢出并禁止加入聊天室。被禁止的时间取决于服务端调用踢出接口时传入的时间';
break;
case 23410:
tit = '聊天室不存在';
break;
case 23411:
tit = '聊天室成员超限';
break;
case 23412:
tit = '聊天室接口参数不正确';
break;
case 23414:
tit = '聊天室云存储业务未开通';
break;
case 23424:
tit = '没有权限修改聊天室中已存在的属性值';
break;
case 23425:
tit = '聊天室中属性设置频率超限,单个聊天室每秒上限 100 次';
break;
case 23426:
tit = '聊天室属性存储功能没有开通';
break;
case 23427:
tit = '聊天室属性值不存在';
break;
case 25101:
tit = '撤回参数不正确';
break;
case 25103:
tit = '清除历史消息时,传递的时间戳大于当前系统时间';
break;
case 26001:
tit = 'Push 参数不正确';
break;
case 26002:
tit = '向服务端同步时出现问题,有可能是操作过于频繁所致。请稍后再试';
break;
case 26101:
tit = '没有在融云开发者后台开启小视频服务';
break;
case 30001:
tit = '连接已被释放';
break;
case 30002:
tit = '当前连接不可用';
break;
case 30003:
tit = '客户端发送消息请求,融云服务端响应超时';
break;
case 30004:
tit = '导航 HTTP 发送失败';
break;
case 30005:
tit = '请求连接导航地址失败';
break;
case 30006:
tit = '请求连接导航地址后,接收数据失败';
break;
case 30007:
tit = '导航 HTTP 请求失败';
break;
case 30008:
tit = '导航 HTTP 返回数据格式错误';
break;
case 30009:
tit = '导航数据解析后,其中不存在有效 IP 地址';
break;
case 30010:
tit = '创建 Socket 连接失败,连接相关的错误码SDK 会做好自动重连,开发者无须处理';
break;
case 30011:
tit = 'Socket 断开';
break;
case 30012:
tit = 'PING 失败';
break;
case 30013:
tit = 'PING 超时';
break;
case 30014:
tit = '信令发送失败';
break;
case 30015:
tit = '连接过于频繁';
break;
case 30016:
tit = '消息大小超限,消息体最大 128 KB';
break;
case 31000:
tit = '连接 ACK 超时';
break;
case 31002:
tit = '初始化时填写的 AppKey 不正确';
break;
case 31003:
tit = '服务器当前不可用';
break;
case 31004:
tit = 'Token 无效';
break;
case 31005:
tit = 'AppKey 与Token 不匹配';
break;
case 31006:
tit = '连接重定向. 连接相关的错误码SDK 会做好自动重连,开发者无须处理';
break;
case 31007:
tit = 'ApplicationId 与后台注册信息不一致';
break;
case 31008:
tit = 'AppKey 被封禁或已删除';
break;
case 31009:
tit = '用户被封禁';
break;
case 31010:
tit = '当前用户在其他移动设备上登录,此设备被踢下线';
break;
case 31011:
tit = '用户被封禁';
break;
case 31020:
tit = 'Token过期。一般是因为在开发者后台设置了token 过期时间,需要请求您的服务器重新获取 Token 并再次用新的 Token 建立连接';
break;
case 31023:
tit = '重连过程中当前用户在其它设备上登录';
break;
case 32061:
tit = '连接被拒绝, SDK 会自动重连,开发者无须处理';
break;
case 33001:
tit = '未调用 init 初始化函数';
break;
case 33002:
tit = '数据库错误';
break;
case 33003:
tit = '调用接口时传入的参数不正确';
break;
case 33007:
tit = '未开通历史消息云存储服务';
break;
case 34001:
tit = '连接已经存在,不需要重复连接';
break;
case 34002:
tit = '小视频时间长度超出限制,默认小视频时长上限为 2 分钟';
break;
case 34003:
tit = 'GIF 消息文件大小超出限制, 默认 GIF 文件大小上限是 2 MB';
break;
case 34004:
tit = '聊天室状态未同步完成加入聊天室时立即调用获取聊天室属性接口极限情况下会存在本地数据和服务器未同步完成的情况开发者可以设置聊天室属性回调SDK 同步完成时会在属性回调中通知开发者';
break;
case 34005:
tit = '连接环境不正确';
break;
case 40006:
tit = 'RTC 房间操作时传入参数错误';
break;
default:
tit='';
}
return tit;
}

3
utils/util.js Normal file
View File

@@ -0,0 +1,3 @@
export const formate = function(arr){
return JSON.parse('['+ arr.join(',') + ']');
}