diff --git a/pages/form/index.ts b/pages/form/index.ts index 9ad8cd8..e6234ba 100644 --- a/pages/form/index.ts +++ b/pages/form/index.ts @@ -23,18 +23,18 @@ Page({ // } // }) - onStop() const that = this; wx.getStorage({ key: 'isConnected', success(res: any) { if (res.data) { - this.setData({ + that.setData({ netWorkErrorDialog: true, }) } }, }) + onStop() wx.getStorage({ key: 'historicalList', success(res: any) { diff --git a/utils/singlr.ts b/utils/singlr.ts index ebe6ef0..473cef6 100644 --- a/utils/singlr.ts +++ b/utils/singlr.ts @@ -13,17 +13,9 @@ export const startSignalr = async (callBack: Function) => { }) .build(); connection.start().then(() => { - wx.setStorage({ - key: "reconnect", - data: true - }) callBack() }) connection.onclose(() => { - wx.setStorage({ - key: "reconnect", - data: false - }) startConnection() }); } @@ -32,10 +24,6 @@ export const startSignalr = async (callBack: Function) => { const routes = getCurrentPages() if (connection.state !== signalR.HubConnectionState.Connected && routes[routes.length - 1].route === 'pages/meeting/index') { connection.start().then(() => { - wx.setStorage({ - key: "reconnect", - data: true - }) }).catch(err => { setTimeout(startConnection, 3000); }); @@ -203,10 +191,6 @@ export const onSignalr = (callBack: Function) => { } } export const onStop = async () => { - wx.setStorage({ - key: "reconnect", - data: false - }) agora.destroy(); if (connection) { connection.stop()