From ec8f7b5727bdba9f1c34f64fc33b57e5a8b93606 Mon Sep 17 00:00:00 2001
From: zhuhao <979263092@qq.com>
Date: Tue, 15 Oct 2024 18:39:50 +0800
Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=B8=8A=E8=AF=BEPPT?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/renderer/src/layout/components/Header.vue | 27 ++++++++++---------
src/renderer/src/utils/chat.js | 7 +++--
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/renderer/src/layout/components/Header.vue b/src/renderer/src/layout/components/Header.vue
index 26ff23e..6b3e875 100644
--- a/src/renderer/src/layout/components/Header.vue
+++ b/src/renderer/src/layout/components/Header.vue
@@ -10,12 +10,12 @@
-
-
+
+
-
+
{{ menu.name }}
@@ -80,8 +80,8 @@ import { updateUserInfo } from '@/api/system/user'
import logoIco from '@/assets/images/logo.png'
import { listEvaluation } from '@/api/classManage/index'
import { sessionStore } from '@/utils/store'
-import Chat from '@/utils/chat' // im 登录初始化
-if (!Chat.imChat) Chat.init()
+// import Chat from '@/utils/chat' // im 登录初始化
+// if (!Chat.imChat) Chat.init()
let homeTitle = ref(import.meta.env.VITE_APP_TITLE)
const { ipcRenderer } = window.electron || {}
@@ -145,7 +145,7 @@ function handleCommand(command) {
break
case 'logout':
logout()
- Chat?.logout() // im 退出登录
+ // Chat?.logout() // im 退出登录
break
default:
break
@@ -161,7 +161,9 @@ function logout() {
cancelButtonText: '取消',
type: 'warning'
})
- .then(() => {
+ .then(async () => {
+ const Chat = (await import('@/utils/chat')).default
+ if (!!Chat.imChat) Chat.logout()
userStore
.logOut()
.then(() => {
@@ -172,8 +174,7 @@ function logout() {
// router.replace('/login')
ipcRenderer && ipcRenderer.send('openLoginWindow')
})
- })
- .catch(() => { })
+ }).catch(()=>{})
}
const emits = defineEmits(['setLayout'])
@@ -183,10 +184,10 @@ function setLayout() {
// 切换学科
const changeSubject = async (command) =>{
let sessionSubject = {
- bookList: null,
- curBook: null,
- curNode: null,
- defaultExpandedKeys: [],
+ bookList: null,
+ curBook: null,
+ curNode: null,
+ defaultExpandedKeys: [],
subjectTree: []
}
sessionStore.set( 'subject', sessionSubject)
diff --git a/src/renderer/src/utils/chat.js b/src/renderer/src/utils/chat.js
index 44d962f..b3b06a8 100644
--- a/src/renderer/src/utils/chat.js
+++ b/src/renderer/src/utils/chat.js
@@ -20,9 +20,9 @@ export class Chat {
}
/**
* 初始化 获取IM签名
- * @param {*} isInit : 是否初始化IM
+ * @param {*} isInit : 是否初始化IM
* @param {*} isLogin : 是否登录IM
- * @param {*} callback: 监听消息回调函数
+ * @param {*} callback: 监听消息回调函数
* @returns Promise
*/
async init(isInit = true, isLogin = true, callback) {
@@ -69,7 +69,6 @@ export class Chat {
async logout() {
if (!this.imChat) return
await this.imChat?.logout()
- imChat = null
this.imChat = null
}
// 发群消息
@@ -95,4 +94,4 @@ export class Chat {
}
}
-export default new Chat()
\ No newline at end of file
+export default new Chat()