From 043fbf184697d8a9b9926df1543b95e3688db84f Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 28 Feb 2025 14:07:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/meeting/index.ts | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/pages/meeting/index.ts b/pages/meeting/index.ts index 2eb1caf..4c1eaff 100644 --- a/pages/meeting/index.ts +++ b/pages/meeting/index.ts @@ -271,19 +271,9 @@ Page({ } }) }, - async onReady() { + onReady() { wx.onNetworkStatusChange(this.listener) - const setting: any = await getStorage('setting') - if (setting) { - this.setData({ - setting - }) - } else { - wx.setStorage({ - key: "setting", - data: this.data.setting - }) - } + this.setStorageData() }, async onShow() { wx.setKeepScreenOn({ @@ -313,7 +303,7 @@ Page({ 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) { + if (item && (this.data.currentUid !== item.uid && !isShare && (user && user.isRoom) && item.volumeNumber > 0 && item.uid !== this.data.user.uid)) { this.setData({ currentUid: item.uid }) @@ -333,6 +323,21 @@ Page({ wx.offNetworkStatusChange(this.listener) this.clearTimer() }, + // 设置缓存 + async setStorageData() { + const setting: any = await getStorage('setting') + if (setting) { + this.setData({ + setting + }) + } else { + wx.setStorage({ + key: "setting", + data: this.data.setting + }) + } + }, + // 重连 async reconnecFun() { wx.hideLoading() wx.showLoading({ @@ -744,6 +749,7 @@ Page({ this.setData({ tabBarIndex: Number(e.currentTarget.dataset.tabbarindex) }) + this.setStorageData() }, // 修改缓存设置 changeSetting(e) {