From c5d3a21299ff569f269ba2a268d6f68312f28ddf Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Mon, 25 Nov 2024 10:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E7=BD=91=E7=BB=9C=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/form/index.ts | 69 +++++++++++++++++++++++++----------------- pages/form/index.wxml | 1 + pages/meeting/index.ts | 27 ++++++++++++++--- 3 files changed, 65 insertions(+), 32 deletions(-) diff --git a/pages/form/index.ts b/pages/form/index.ts index ffee288..b23aeb1 100644 --- a/pages/form/index.ts +++ b/pages/form/index.ts @@ -11,6 +11,7 @@ Page({ }, isRecord: false, isCamera: false, + netWorkErrorDialog: false, historicalList: [], }, onShow() { @@ -31,33 +32,41 @@ Page({ }, }) }, - onLoad() { - wx.authorize({ - scope: 'scope.record', - success: () => { - this.setData({ - isRecord: true, - }) - }, - fail: () => { - this.setData({ - isRecord: false, - }) - } - }); - wx.authorize({ - scope: 'scope.camera', - success: () => { - this.setData({ - isCamera: true, - }) - }, - fail: () => { - this.setData({ - isCamera: false, - }) - } - }); + onLoad(option) { + if (option.redirect) { + this.setData({ + netWorkErrorDialog: true, + isRecord: true, + isCamera: true, + }) + } else { + wx.authorize({ + scope: 'scope.record', + success: () => { + this.setData({ + isRecord: true, + }) + }, + fail: () => { + this.setData({ + isRecord: false, + }) + } + }); + wx.authorize({ + scope: 'scope.camera', + success: () => { + this.setData({ + isCamera: true, + }) + }, + fail: () => { + this.setData({ + isCamera: false, + }) + } + }); + } }, async getRoomRtcToken(roomNum: string, callBack: Function): Promise { Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a'), GetAgoraConf()]).then(res => { @@ -70,7 +79,13 @@ Page({ } }) }, + closeDialog() { + this.setData({ + netWorkErrorDialog: false + }) + }, joinMeeting() { + this.closeDialog() const navigateToMeeting = async (deviceId: string): Promise => { await PostAnonLogin({ deviceId, diff --git a/pages/form/index.wxml b/pages/form/index.wxml index fa6cf6e..a2eff9a 100644 --- a/pages/form/index.wxml +++ b/pages/form/index.wxml @@ -18,4 +18,5 @@ + \ No newline at end of file diff --git a/pages/meeting/index.ts b/pages/meeting/index.ts index a36b1ef..156082f 100644 --- a/pages/meeting/index.ts +++ b/pages/meeting/index.ts @@ -125,10 +125,12 @@ Page({ }, 'currentUid': function (currentUid) { this.data.roomUserList.forEach(item => { - if (item.uid == currentUid) { - agora.setRemoteVideoStreamType(Number(item.uid), 0) - } else { - agora.setRemoteVideoStreamType(Number(item.uid), 1) + if (item.src) { + if (item.uid == currentUid) { + agora.setRemoteVideoStreamType(Number(item.uid), 0) + } else { + agora.setRemoteVideoStreamType(Number(item.uid), 1) + } } }); }, @@ -174,6 +176,12 @@ Page({ } }) }, + onReady() { + wx.onNetworkStatusChange(this.listener) + }, + onUnload() { + wx.offNetworkStatusChange(this.listener) + }, startSignalr() { onSignalr(async (item) => { const userInfo: any = await getStorage('user') @@ -771,5 +779,14 @@ Page({ top: 10000000000000 }) }) - } + }, + async listener(res) { + if (res.isConnected && (res.networkType !== 'none' || res.networkType !== 'unknown')) { + + } else { + wx.navigateTo({ + url: `/pages/form/index?redirect=true` + }) + } + }, }) \ No newline at end of file