This commit is contained in:
parent
75caf13d8b
commit
e3e704d95d
|
@ -74,7 +74,9 @@ export class ImChat {
|
||||||
try {
|
try {
|
||||||
if(!API) reject('preload api获取失败, 初始化-未完成')
|
if(!API) reject('preload api获取失败, 初始化-未完成')
|
||||||
this.timChat = await API.getTimRender()
|
this.timChat = await API.getTimRender()
|
||||||
await this.timChat.TIMInit()
|
await this.timChat.TIMInit({
|
||||||
|
// electron_log:true,
|
||||||
|
})
|
||||||
console.log('[im-chat]:初始化成功')
|
console.log('[im-chat]:初始化成功')
|
||||||
this.status.isConnect = true
|
this.status.isConnect = true
|
||||||
this.setConfig() // 设置日志级别
|
this.setConfig() // 设置日志级别
|
||||||
|
@ -150,6 +152,7 @@ export class ImChat {
|
||||||
return this.timChat.TIMLogout().then(res => {
|
return this.timChat.TIMLogout().then(res => {
|
||||||
console.log('登出成功', res)
|
console.log('登出成功', res)
|
||||||
this.status.isLogin = false
|
this.status.isLogin = false
|
||||||
|
this.timChat.TIMUninit() // 反初始化
|
||||||
return res
|
return res
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log('登出失败', error)
|
console.log('登出失败', error)
|
||||||
|
|
|
@ -88,12 +88,13 @@ onMounted(async() => {
|
||||||
const getClassInfo = async () => {
|
const getClassInfo = async () => {
|
||||||
const { data } = await classManageApi.getClassInfo(classObj.id)
|
const { data } = await classManageApi.getClassInfo(classObj.id)
|
||||||
classObj.data = data
|
classObj.data = data
|
||||||
|
// console.log('classObj:', classObj)
|
||||||
if(!data.ex3 || data.ex3 == 'undefined') { // 无群直接创建
|
if(!data.ex3 || data.ex3 == 'undefined') { // 无群直接创建
|
||||||
await imChatRef.value.imChatObj.imChat.createGroup(data.className)
|
await imChatRef.value.imChatObj.imChat.createGroup(data.className)
|
||||||
const timGroupId = imChatRef.value.imChatObj.imChat.timGroupId
|
const timGroupId = imChatRef.value.imChatObj.imChat.timGroupId
|
||||||
classManageApi.startClass(classObj.id, timGroupId) // 开始上课
|
classManageApi.startClass(classObj.id, timGroupId) // 开始上课
|
||||||
} else { // 已创建群
|
} else { // 已创建群
|
||||||
// console.log('已创建群: ', data.ex3)
|
console.log('已创建群: ', data.ex3)
|
||||||
imChatRef.value.imChatObj.imChat.timGroupId = data.ex3
|
imChatRef.value.imChatObj.imChat.timGroupId = data.ex3
|
||||||
// imChatRef.value.imChatObj.imChat.setGroupMsgReceive(data.ex3)
|
// imChatRef.value.imChatObj.imChat.setGroupMsgReceive(data.ex3)
|
||||||
}
|
}
|
||||||
|
@ -181,16 +182,16 @@ const sideChange = async o => {
|
||||||
}).then(async() => {
|
}).then(async() => {
|
||||||
await imChatRef.value?.imChatObj?.imChat?.sendMsgClosed() // 发送下课消息
|
await imChatRef.value?.imChatObj?.imChat?.sendMsgClosed() // 发送下课消息
|
||||||
// const elMsg = ElMessage.warning({duration:0,message:'正在下课...'})
|
// 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秒后关闭窗口,如果马上解散群,会导致群组不存在
|
// 延迟2秒后关闭窗口,如果马上解散群,会导致群组不存在
|
||||||
setTimeout(async() => {
|
setTimeout(async() => {
|
||||||
elMsg.close()
|
// elMsg.close()
|
||||||
toolStore.isToolWin = false
|
toolStore.isToolWin = false
|
||||||
await classManageApi.endClass(route.query.reservId)
|
await classManageApi.endClass(route.query.reservId)
|
||||||
await imChatRef.value?.deleteGroup() // 解散群
|
await imChatRef.value?.deleteGroup() // 解散群
|
||||||
await imChatRef.value?.logout() // 退出im
|
await imChatRef.value?.logout() // 退出im
|
||||||
ipcMsgSend('tool-sphere:close') // 关闭窗口
|
ipcMsgSend('tool-sphere:close') // 关闭窗口
|
||||||
}, 2000);
|
}, 200);
|
||||||
|
|
||||||
// isOver.value = false
|
// isOver.value = false
|
||||||
// setIgnore(true) // 开启窗口鼠标-穿透
|
// setIgnore(true) // 开启窗口鼠标-穿透
|
||||||
|
|
Loading…
Reference in New Issue