This commit is contained in:
yj 2024-08-13 17:49:30 +08:00
parent 7e9ad23c49
commit 810c68bc96
3 changed files with 11 additions and 8 deletions

View File

@ -9,7 +9,7 @@ import Meeting from '@/page/Meeting/index'
import NotFound from '@/page/NotFound/index'
import { storage } from '@/utils'
import { message, Spin } from "antd";
import { onOtherSignalr, onReconnected, onStart, startSignalr } from "@/utils/package/signalr";
import { onOtherSignalr, onReconnected, onStart, onStop, startSignalr } from "@/utils/package/signalr";
import JoinMeetingModal from "@/components/JoinMeetingModal";
import UpdateModal from "@/components/UpdateModal";
import * as CryptoJS from 'crypto-js';
@ -121,7 +121,8 @@ const App: React.FC = () => {
joinMeetingModalRef.current.changeModal(item)
break;
case 'ForceLogout':
await leaveChannel()
message.error(item.message)
await leaveChannel(true)
toSrc('/login')
break;
}
@ -131,6 +132,7 @@ const App: React.FC = () => {
useEffect(() => {
try {
if (location.hash.indexOf('/login') !== -1) {
onStop()
window.electron.setMainWindowSize({
width: 752,
height: 520,
@ -219,12 +221,14 @@ const App: React.FC = () => {
}
};
const leaveChannel = async (): Promise<void> => {
const leaveChannel = async (bool?: boolean): Promise<void> => {
if (location.hash.indexOf('/meeting') === 1) {
const data = JSON.parse(localStorage.stateInfo);
await GetLeave({
roomNum: data.channelId,
})
if (!bool) {
await GetLeave({
roomNum: data.channelId,
})
}
await agora.leaveChannel()
}
};

View File

@ -9,7 +9,6 @@ import {
} from "agora-electron-sdk";
import { GetRoomRtcToken } from "@/api/Home/Index";
import { storage } from '@/utils';
import { onStop } from "./signalr";
const option: any = {
appId: 'dcfc466a6ecb4a1f972630065dfb1e75',
token: '',
@ -137,7 +136,6 @@ const agora = {
stopAllEffect: true,
stopMicrophoneRecording: true,
})
onStop()
agora.stopScreenCapture()
agora.release()
},

View File

@ -163,6 +163,7 @@ export const onInvoke = async (str: string, data: any) => {
export const onStop = async () => {
if (connection) {
connection.stop()
connection = ""
}
}