This commit is contained in:
zdg 2024-08-16 16:41:05 +08:00
parent 75caf13d8b
commit e3e704d95d
2 changed files with 9 additions and 5 deletions

View File

@ -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)

View File

@ -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) // -穿