From 067c9a1042f6eb50af90e4b36d3b92d28c78ac2c Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Thu, 13 Feb 2025 10:53:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=87=8D=E8=BF=9E=E6=9C=BA?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/meeting/index.scss | 1 + pages/meeting/index.ts | 17 ++++++++++------- utils/agora.ts | 6 +++++- utils/request.js | 3 ++- utils/singlr.ts | 1 + 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/pages/meeting/index.scss b/pages/meeting/index.scss index 908d0bd..83e8d7b 100644 --- a/pages/meeting/index.scss +++ b/pages/meeting/index.scss @@ -77,6 +77,7 @@ overflow: hidden; &-content { + height: 0; flex-grow: 1; display: flex; position: relative; diff --git a/pages/meeting/index.ts b/pages/meeting/index.ts index 91dc449..a29939e 100644 --- a/pages/meeting/index.ts +++ b/pages/meeting/index.ts @@ -216,6 +216,7 @@ Page({ if (item && !item.isRoomManager) { wx.showLoading({ title: '重连中', + mask: true }) agora.destroy(() => { reconnectTime = setInterval(() => { @@ -250,18 +251,20 @@ Page({ offSignalr() await GetRoomRtcToken(this.data.channelId).then(res => { if (res.code === 200) { - agora.reconnecSetOption(res.data, async () => { - await this.joinChannel() - this.startClientEvent() - this.startSignalr() - await this.getRoomUser() - await this.getShowUser() + agora.reconnecSetOption(res.data, async (bool) => { + if (bool) { + await this.joinChannel() + this.startClientEvent() + this.startSignalr() + await this.getRoomUser() + await this.getShowUser() + } wx.hideLoading() Message.success({ context: this, offset: [20, 32], duration: 3000, - content: '重连成功', + content: bool ? '重连成功' : '重连失败,请退出房间重试!', }); }) } else { diff --git a/utils/agora.ts b/utils/agora.ts index 4a8e688..ed24fe8 100644 --- a/utils/agora.ts +++ b/utils/agora.ts @@ -13,7 +13,9 @@ export const agora = { init: async (callback?) => { client = new AgoraMiniappSDK.Client(); await client.init(option.appId, () => { - callback?.() + callback?.(true) + }, () => { + callback?.(false) }); }, // 销毁 @@ -24,6 +26,8 @@ export const agora = { callback?.() client = ''; }) + } else { + callback?.() } }, // 设置角色 diff --git a/utils/request.js b/utils/request.js index b2450d6..ad6c1f9 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,5 +1,6 @@ -const apiBase = "https://meeting-api.23544.com/pc" // const apiBase = "http://192.168.2.9:5192" +const apiBase = "https://meeting-api.23544.com/pc" +// const apiBase = "https://meeting-api.23544.com/test29" import { Message } from 'tdesign-miniprogram'; export const Request = (params) => { return new Promise((resolve, reject) => { diff --git a/utils/singlr.ts b/utils/singlr.ts index 0983b2e..5f74299 100644 --- a/utils/singlr.ts +++ b/utils/singlr.ts @@ -1,6 +1,7 @@ let connection = '' as any; // let url = 'http://192.168.2.9:5192' let url = 'https://meeting-api.23544.com/pc' +// let url = 'https://meeting-api.23544.com/test29' import * as signalR from "signalr-for-wx"; import { agora } from "./agora"; export const startSignalr = async (callBack: Function) => {