全员观看-活跃用户
This commit is contained in:
parent
9c4e9cb918
commit
3b61578baa
|
|
@ -10,6 +10,7 @@ const computedBehavior = require('miniprogram-computed').behavior;
|
|||
let reconnectTime = "" as any;
|
||||
let refreshTime = "" as any;
|
||||
let isAutoApplySpeakTime = "" as any;
|
||||
let isSpeakTime = "" as any;
|
||||
Page({
|
||||
behaviors: [computedBehavior],
|
||||
data: {
|
||||
|
|
@ -114,7 +115,8 @@ Page({
|
|||
userNumer: roomUserList.filter((item: any) => item.isRoom).length,
|
||||
audioList: roomUserList.map(item => {
|
||||
return {
|
||||
volume: 0,
|
||||
volume: item.volume || '0%',
|
||||
volumeNumber: item.volumeNumber || 0,
|
||||
uid: item.uid,
|
||||
}
|
||||
})
|
||||
|
|
@ -282,6 +284,25 @@ Page({
|
|||
} else {
|
||||
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];
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
this.setData({
|
||||
currentUid: item.uid
|
||||
})
|
||||
}
|
||||
}, 3000)
|
||||
},
|
||||
// 隐藏
|
||||
onHide() {
|
||||
|
|
@ -377,6 +398,10 @@ Page({
|
|||
clearTimeout(isAutoApplySpeakTime)
|
||||
isAutoApplySpeakTime = ''
|
||||
}
|
||||
if (isSpeakTime) {
|
||||
clearTimeout(isSpeakTime)
|
||||
isSpeakTime = ''
|
||||
}
|
||||
},
|
||||
// 显示聊天输入框
|
||||
showInputPopup() {
|
||||
|
|
@ -1023,6 +1048,7 @@ Page({
|
|||
const item = audioListTemp.find(row => row.uid == uid)
|
||||
if (item) {
|
||||
item.volume = Math.floor(percentage) + '%'
|
||||
item.volumeNumber = Math.floor(percentage)
|
||||
}
|
||||
this.setData({
|
||||
audioList: audioListTemp,
|
||||
|
|
@ -1032,9 +1058,14 @@ Page({
|
|||
// 切换视频
|
||||
clickChangeVideo(e) {
|
||||
const { item } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
currentUid: item.uid
|
||||
})
|
||||
const isShare = this.data.roomUserList.find(item => item.shareSrc)
|
||||
if (isShare) {
|
||||
this.message(`正在进行屏幕共享,不允许切换画面。`).error()
|
||||
} else {
|
||||
this.setData({
|
||||
currentUid: item.uid
|
||||
})
|
||||
}
|
||||
},
|
||||
// 悬浮提示
|
||||
message(content: string) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue