This commit is contained in:
yj 2025-02-27 15:51:47 +08:00
parent d6718ae65b
commit 877754ac06
3 changed files with 93 additions and 30 deletions

View File

@ -310,7 +310,7 @@
.user-popup {
width: 30vw;
height: 100vh;
height: 88vh;
background-color: #16191E;
padding: 10rpx 0;
box-sizing: border-box;
@ -318,12 +318,18 @@
flex-direction: column;
&-title {
color: white;
text-align: center;
color: gray;
font-size: 16rpx;
flex-shrink: 0;
border-bottom: 1px rgb(59, 59, 59) solid;
padding-bottom: 10rpx;
display: flex;
align-items: center;
justify-content: space-around;
&-active {
color: white;
}
}
&-view {
@ -333,6 +339,7 @@
flex-grow: 1;
&-view {
color: white;
display: flex;
align-items: center;
justify-content: space-between;
@ -344,7 +351,6 @@
flex-grow: 1;
&-text {
color: white;
font-size: 14rpx;
margin: 0 2rpx;
white-space: nowrap;

View File

@ -73,6 +73,7 @@ Page({
},
],
channelId: '',
tabBarIndex: 1,
roomInfo: '',
roomUserList: [],
audioList: [],
@ -106,7 +107,10 @@ Page({
isReconnec: false,
isAutoApplySpeakDialog: false,
showScroll: false,
reconnecNumber: 0
reconnecNumber: 0,
setting: {
voiceStimulation: true, //语音激励
}
},
watch: {
'roomUserList.**': function (roomUserList) {
@ -269,6 +273,17 @@ Page({
},
onReady() {
wx.onNetworkStatusChange(this.listener)
const setting: any = getStorage('setting')
if (setting) {
this.setData({
setting
})
} else {
wx.setStorage({
key: "setting",
data: this.data.setting
})
}
},
async onShow() {
wx.setKeepScreenOn({
@ -285,22 +300,24 @@ Page({
this.reconnecFun()
}
isSpeakTime = setInterval(() => {
function getMaxObject(arr) {
let maxObject = arr[0];
for (let i = 1; i < arr.length; i++) {
if (arr[i].volumeNumber > maxObject.volumeNumber) {
maxObject = arr[i];
if (this.data.setting.voiceStimulation) {
function getMaxObject(arr) {
let maxObject = arr[0];
for (let i = 1; i < arr.length; i++) {
if (arr[i].volumeNumber > maxObject.volumeNumber) {
maxObject = arr[i];
}
}
return maxObject;
}
const isShare = this.data.roomUserList.find(item => item.shareSrc)
const item = getMaxObject(this.data.audioList)
const user = this.data.roomUserList.find(row => item.uid === row.uid)
if (this.data.currentUid !== item.uid && !isShare && (user && user.isRoom) && item.volumeNumber > 0 && item.uid !== this.data.user.uid) {
this.setData({
currentUid: item.uid
})
}
return maxObject;
}
const isShare = this.data.roomUserList.find(item => item.shareSrc)
const item = getMaxObject(this.data.audioList)
const user = this.data.roomUserList.find(row => item.uid === row.uid)
if (this.data.currentUid !== item.uid && !isShare && (user && user.isRoom) && item.volumeNumber > 0) {
this.setData({
currentUid: item.uid
})
}
}, 3000)
},
@ -335,6 +352,8 @@ Page({
},
async startReconnec() {
if (getSignIr() === signalR.HubConnectionState.Connected) {
clearTimeout(reconnectTime)
reconnectTime = ''
await GetRoomRtcToken(this.data.channelId).then(res => {
if (res.code === 200) {
agora.reconnecSetOption(res.data, async (bool) => {
@ -350,8 +369,6 @@ Page({
duration: 3000,
content: '重连成功',
});
clearTimeout(reconnectTime)
reconnectTime = ''
this.setData({
isReconnec: false
})
@ -716,12 +733,45 @@ Page({
item.isAdmin = role.ID.includes(item.roleId) || item.isRoomManager
item.avatarName = item.userName?.slice(-2)
})
this.setData({
roomUserList: res.data
})
if (this.data.roomUserList.length) {
let arr: any = []
const { roomUserList } = this.data;
res.data.forEach((item: any) => {
let userItem = roomUserList.find((row: any) => row.uid == item.uid);
if (userItem) {
userItem.enableCamera = item.enableCamera;
userItem.enableMicr = item.enableMicr;
userItem.isRoomManager = item.isRoomManager;
userItem.isAdmin = role.ID.includes(item.roleId) || item.isRoomManager;
} else {
arr.push(item)
}
});
this.setData({
roomUserList: [...roomUserList, ...arr]
})
} else {
this.setData({
roomUserList: res.data
})
}
}
})
},
// 切换tab
setTabBarIndex(e) {
this.setData({
tabBarIndex: Number(e.currentTarget.dataset.tabbarindex)
})
},
// 修改缓存设置
changeSetting(e) {
this.data.setting[e.currentTarget.dataset.str] = e.detail.value
wx.setStorage({
key: "setting",
data: this.data.setting
})
},
// 成员显示用户名称
showMultiText(e) {
Toast({

View File

@ -18,8 +18,8 @@
<view class="meeting-content-video-canvas" wx:if="{{currentUser.shareSrc}}">
<live-player id="player" src="{{currentUser.shareSrc}}" mode="RTC" autoplay="true" object-fit="contain" />
</view>
<view class="meeting-content-video-canvas" wx:else>
<live-player id="player" src="{{currentUser.src}}" mode="RTC" autoplay="true" object-fit="contain" muted="{{!currentUser.enableMicr}}" />
<view class="meeting-content-video-canvas" wx:elif='{{currentUser.enableCamera}}'>
<live-player id="player" src="{{currentUser.src}}" mode="RTC" autoplay="true" object-fit="contain" muted="{{currentUser.uid === user.uid ? true : !currentUser.enableMicr}}" />
</view>
<view class="meeting-content-video-user">
<view class="meeting-content-video-user-view" wx:if="{{currentUser.roleId === '1' || currentUser.roleId === '3'}}" style=" background:#FDC229">
@ -39,7 +39,7 @@
</view>
<view class="meeting-content-smallvideo-box-view-canvas" wx:if="{{item.src}}">
<live-pusher wx:if="{{user.uid === item.uid}}" url="{{item.src}}" mode="RTC" object-fit="contain" background-mute enable-mic="{{footerList[1].active}}" enable-camera max-bitrate="500" min-bitrate="200" autopush enable-agc enable-ans device-position="front" class="meeting-content-smallvideo-box-view-canvas-play" data-uid="{{item.uid}}" bindaudiovolumenotify="playerAudioVolumenotify" beauty='{{9}}' whiteness='{{9}}' />
<live-player src="{{item.src}}" class="meeting-content-smallvideo-box-view-canvas-play" mode="RTC" autoplay="true" muted="{{!item.enableMicr}}" object-fit="contain" data-uid="{{item.uid}}" bindaudiovolumenotify="playerAudioVolumenotify" wx:else />
<live-player src="{{item.src}}" class="meeting-content-smallvideo-box-view-canvas-play" mode="RTC" autoplay="true" muted="{{item.uid === user.uid ? true : !item.enableMicr}}" object-fit="contain" data-uid="{{item.uid}}" bindaudiovolumenotify="playerAudioVolumenotify" wx:else />
</view>
<view class="meeting-content-smallvideo-box-view-user">
<view class="meeting-content-smallvideo-box-view-user-view" wx:if="{{item.roleId === '1' || item.roleId === '3'}}" style=" background:#FDC229">
@ -91,12 +91,13 @@
<t-message id="t-message" />
<t-dialog visible="{{applySpeakDialog}}" content="该操作需向管理员申请发言权限" confirm-btn="{{ { content: '确定', variant: 'base', theme: 'primary' } }}" cancel-btn="取消" data-type="applySpeakDialog" bind:confirm="closeDialog" bind:cancel="closeDialog" style="transform: scale(0.5) translate3d(-50%, -50%, 0);" close-btn="{{false}}" />
<t-dialog visible="{{leaveDialog}}" content="确定离开房间吗?" confirm-btn="{{ { content: '确定', variant: 'base', theme: 'primary' } }}" cancel-btn="取消" data-type="leaveDialog" bind:confirm="closeDialog" bind:cancel="closeDialog" style="transform: scale(0.5) translate3d(-50%, -50%, 0);" close-btn="{{false}}" />
<t-popup visible="{{userPopupVisible}}" bind:visible-change="onVisibleChange" placement="right">
<t-popup visible="{{userPopupVisible}}" bind:visible-change="onVisibleChange" placement="right" style="bottom: 0;top:unset;height: 88vh;">
<view class="user-popup">
<view class="user-popup-title">
成员
<view class="{{ tabBarIndex === 1 ? ' user-popup-title-active' : '' }}" bind:tap="setTabBarIndex" data-tabBarIndex='1'>成员</view>
<view class="{{ tabBarIndex === 2 ? ' user-popup-title-active' : '' }}" bind:tap="setTabBarIndex" data-tabBarIndex='2'>设置</view>
</view>
<scroll-view scroll-y class="user-popup-view" enhanced>
<scroll-view scroll-y class="user-popup-view" enhanced wx:if="{{tabBarIndex === 1}}">
<view class="user-popup-view-view" wx:for="{{roomUserList}}" data-item="{{item}}" wx:key="index" wx:if="{{item.isRoom}}">
<view class="user-popup-view-view-avatar" bind:tap="showMultiText" data-item="{{item}}">
<t-avatar size="36rpx">{{item.avatarName}}</t-avatar>
@ -109,6 +110,12 @@
</view>
</view>
</scroll-view>
<scroll-view scroll-y class="user-popup-view" enhanced wx:else>
<view class="user-popup-view-view">
<text>语音激励</text>
<switch checked="{{setting.voiceStimulation}}" bindchange="changeSetting" data-str='voiceStimulation' />
</view>
</scroll-view>
</view>
</t-popup>
<t-popup visible="{{chatPopupVisible}}" bind:visible-change="onVisibleChange" placement="right">