From e3e704d95d83241c2cef2274a37e1f642038b747 Mon Sep 17 00:00:00 2001 From: zdg Date: Fri, 16 Aug 2024 16:41:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/plugins/imChat/index.js | 5 ++++- src/renderer/src/views/tool/sphere.vue | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/plugins/imChat/index.js b/src/renderer/src/plugins/imChat/index.js index 4257f69..60d1a92 100644 --- a/src/renderer/src/plugins/imChat/index.js +++ b/src/renderer/src/plugins/imChat/index.js @@ -74,7 +74,9 @@ export class ImChat { try { if(!API) reject('preload api获取失败, 初始化-未完成') this.timChat = await API.getTimRender() - await this.timChat.TIMInit() + await this.timChat.TIMInit({ + // electron_log:true, + }) console.log('[im-chat]:初始化成功') this.status.isConnect = true this.setConfig() // 设置日志级别 @@ -150,6 +152,7 @@ export class ImChat { return this.timChat.TIMLogout().then(res => { console.log('登出成功', res) this.status.isLogin = false + this.timChat.TIMUninit() // 反初始化 return res }).catch(error => { console.log('登出失败', error) diff --git a/src/renderer/src/views/tool/sphere.vue b/src/renderer/src/views/tool/sphere.vue index 7b018d9..b910e37 100644 --- a/src/renderer/src/views/tool/sphere.vue +++ b/src/renderer/src/views/tool/sphere.vue @@ -88,12 +88,13 @@ onMounted(async() => { const getClassInfo = async () => { const { data } = await classManageApi.getClassInfo(classObj.id) classObj.data = data + // console.log('classObj:', classObj) if(!data.ex3 || data.ex3 == 'undefined') { // 无群直接创建 await imChatRef.value.imChatObj.imChat.createGroup(data.className) const timGroupId = imChatRef.value.imChatObj.imChat.timGroupId classManageApi.startClass(classObj.id, timGroupId) // 开始上课 } else { // 已创建群 - // console.log('已创建群: ', data.ex3) + console.log('已创建群: ', data.ex3) imChatRef.value.imChatObj.imChat.timGroupId = data.ex3 // imChatRef.value.imChatObj.imChat.setGroupMsgReceive(data.ex3) } @@ -181,16 +182,16 @@ const sideChange = async o => { }).then(async() => { await imChatRef.value?.imChatObj?.imChat?.sendMsgClosed() // 发送下课消息 // const elMsg = ElMessage.warning({duration:0,message:'正在下课...'}) - const elMsg = ElLoading.service({lock: true, text: '正在下课...', background: 'rgba(0, 0, 0, 0.7)'}) + // const elMsg = ElLoading.service({lock: true, text: '正在下课...', background: 'rgba(0, 0, 0, 0.7)'}) // 延迟2秒后关闭窗口,如果马上解散群,会导致群组不存在 setTimeout(async() => { - elMsg.close() + // elMsg.close() toolStore.isToolWin = false await classManageApi.endClass(route.query.reservId) await imChatRef.value?.deleteGroup() // 解散群 await imChatRef.value?.logout() // 退出im ipcMsgSend('tool-sphere:close') // 关闭窗口 - }, 2000); + }, 200); // isOver.value = false // setIgnore(true) // 开启窗口鼠标-穿透