zdg #146
|
@ -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)
|
||||
|
|
|
@ -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) // 开启窗口鼠标-穿透
|
||||
|
|
Loading…
Reference in New Issue