This commit is contained in:
yj 2024-11-26 13:37:54 +08:00
parent 7209fa2cd0
commit 5ca4929a45
2 changed files with 2 additions and 18 deletions

View File

@ -23,18 +23,18 @@ Page({
// } // }
// }) // })
onStop()
const that = this; const that = this;
wx.getStorage({ wx.getStorage({
key: 'isConnected', key: 'isConnected',
success(res: any) { success(res: any) {
if (res.data) { if (res.data) {
this.setData({ that.setData({
netWorkErrorDialog: true, netWorkErrorDialog: true,
}) })
} }
}, },
}) })
onStop()
wx.getStorage({ wx.getStorage({
key: 'historicalList', key: 'historicalList',
success(res: any) { success(res: any) {

View File

@ -13,17 +13,9 @@ export const startSignalr = async (callBack: Function) => {
}) })
.build(); .build();
connection.start().then(() => { connection.start().then(() => {
wx.setStorage({
key: "reconnect",
data: true
})
callBack() callBack()
}) })
connection.onclose(() => { connection.onclose(() => {
wx.setStorage({
key: "reconnect",
data: false
})
startConnection() startConnection()
}); });
} }
@ -32,10 +24,6 @@ export const startSignalr = async (callBack: Function) => {
const routes = getCurrentPages() const routes = getCurrentPages()
if (connection.state !== signalR.HubConnectionState.Connected && routes[routes.length - 1].route === 'pages/meeting/index') { if (connection.state !== signalR.HubConnectionState.Connected && routes[routes.length - 1].route === 'pages/meeting/index') {
connection.start().then(() => { connection.start().then(() => {
wx.setStorage({
key: "reconnect",
data: true
})
}).catch(err => { }).catch(err => {
setTimeout(startConnection, 3000); setTimeout(startConnection, 3000);
}); });
@ -203,10 +191,6 @@ export const onSignalr = (callBack: Function) => {
} }
} }
export const onStop = async () => { export const onStop = async () => {
wx.setStorage({
key: "reconnect",
data: false
})
agora.destroy(); agora.destroy();
if (connection) { if (connection) {
connection.stop() connection.stop()