zdg #146

Merged
zhengdegang merged 3 commits from zdg into main 2024-08-16 17:08:13 +08:00
2 changed files with 9 additions and 5 deletions
Showing only changes of commit e3e704d95d - Show all commits

View File

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

View File

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