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) {