diff --git a/pages/meeting/index.ts b/pages/meeting/index.ts index 2cee59c..4fdc156 100644 --- a/pages/meeting/index.ts +++ b/pages/meeting/index.ts @@ -106,7 +106,12 @@ Page({ } }) }) - this.scroll() + const item = roomUserList.find(row => row.uid == this.data.currentUid || row.screenShareId == this.data.currentUid) + if (item) { + this.setData({ + currentUser: item, + }) + } }, 'footerList.**': function (footerList) { const footerListTemplate = [...footerList]; @@ -135,6 +140,12 @@ Page({ } } }); + const item = this.data.roomUserList.find(row => row.uid == currentUid || row.screenShareId == currentUid) + if (item) { + this.setData({ + currentUser: item, + }) + } }, }, async onLoad(option) { @@ -368,7 +379,6 @@ Page({ } this.setData({ roomUserList: roomUserListTemp, - currentUser: item, }) }, streamRemoved: (uid) => { @@ -379,7 +389,6 @@ Page({ item.shareSrc = '' this.setData({ roomUserList: roomUserListTemp, - currentUser: item, }) } }); @@ -403,10 +412,8 @@ Page({ async getShowUser(): Promise { await GetShowUser(this.data.channelId).then(async (res) => { if (res.code === 200 && res.data) { - const currentUser = this.data.roomUserList.find(row => row.uid == res.data || row.screenShareId == res.data) this.setData({ - currentUid: currentUser.uid, - currentUser, + currentUid: res.data, }) } }) @@ -501,11 +508,6 @@ Page({ }) break; } - if (item.user && (item.user.uid === this.data.currentUid)) { - this.setData({ - currentUser: roomUserList.find(row => row.uid == this.data.currentUid || row.screenShareId == this.data.currentUid) - }) - } this.changeAgoraDevice() }, async changeFooterList(e): Promise { @@ -697,7 +699,6 @@ Page({ clickChangeVideo(e) { const { item } = e.currentTarget.dataset; this.setData({ - currentUser: item, currentUid: item.uid }) }, @@ -817,24 +818,9 @@ Page({ }) } }, - scroll(e) { - const query = wx.createSelectorQuery().in(this); - query.select('#meeting-content-smallvideo').boundingClientRect() - query.selectAll('.meeting-content-smallvideo-box').boundingClientRect() - query.exec((res) => { - const listItemRects = res[1]; - listItemRects.forEach(rect => { - if (rect.dataset.item.src && rect.dataset.item.enableCamera) { - if (rect.top < res[0].height && rect.top + rect.height > 0) { - agora.unmute(Number(rect.dataset.item.uid), 'video') - } else { - if (rect.dataset.item.uid != this.data.currentUid) { - agora.mute(Number(rect.dataset.item.uid), 'video') - } - } - } - }); - }) + scroll() { + // agora.unmute(Number(rect.dataset.item.uid), 'video') + // agora.mute(Number(rect.dataset.item.uid), 'video') }, scrollUp() { const query = wx.createSelectorQuery()