This commit is contained in:
parent
04a03b0c43
commit
a2e72b855b
|
@ -160,10 +160,12 @@ export function deleteSmartReserv(id) {
|
|||
})
|
||||
}
|
||||
export function startClass(id, ex3) {
|
||||
const params = {id}
|
||||
!!ex3 && (params.ex3 = ex3)
|
||||
return request({
|
||||
url: '/smarttalk/classReserv/startClass',
|
||||
method: 'get',
|
||||
params: {id, ex3}
|
||||
params
|
||||
})
|
||||
}
|
||||
export function endClass(id) {
|
||||
|
|
|
@ -382,12 +382,12 @@ const TIMResult= {
|
|||
* | 名称 | 含义 | 值(number) |
|
||||
* | ---- | ---- | ---- |
|
||||
* | kTIMLog_Off | 关闭日志输出 | 0 |
|
||||
* | kTIMLog_Test | 失败,IM SDK未初始化 | 1 |
|
||||
* | kTIMLog_Verbose | 失败,IM SDK未初始化 | 2 |
|
||||
* | kTIMLog_Debug | 接口调用失败,错误的Json格式或Json Key | 3 |
|
||||
* | kTIMLog_Info | 接口调用失败,参数错误 | 4 |
|
||||
* | kTIMLog_Warn | 接口调用失败,无效的会话 | 5 |
|
||||
* | kTIMLog_Error | 接口调用失败,无效的群组 | 6 |
|
||||
* | kTIMLog_Test | 全量日志 | 1 |
|
||||
* | kTIMLog_Verbose| 开发调试过程中一些详细信息日志 | 2 |
|
||||
* | kTIMLog_Debug | 调试日志 | 3 |
|
||||
* | kTIMLog_Info | 信息日志 | 4 |
|
||||
* | kTIMLog_Warn | 警告日志 | 5 |
|
||||
* | kTIMLog_Error | 错误日志 | 6 |
|
||||
* | kTIMLog_Assert | 断言日志 | 7 |
|
||||
*/
|
||||
const TIMLogLevel= {
|
||||
|
|
|
@ -25,7 +25,7 @@ export class ImChat {
|
|||
}
|
||||
defOption = { // 默认配置
|
||||
// 日志等级-全量日志
|
||||
log_level: TYPES.TIMLogLevel.kTIMLog_Test,
|
||||
log_level: TYPES.TIMLogLevel.kTIMLog_Off,
|
||||
// 群组类型-会议群(Meeting),成员上限 6000 人
|
||||
group_type: TYPES.TIMGroupType.kTIMGroup_ChatRoom,
|
||||
}
|
||||
|
@ -34,20 +34,17 @@ export class ImChat {
|
|||
constructor(SDKAppID, userSig, userID, isInit) {
|
||||
this.SDKAppID = SDKAppID
|
||||
this.userSig = userSig
|
||||
// const sig = 'eJwtjN0KgjAYQN9l16Vzcz8I3RhE9J*JV94IW-ZV6nASWfTurfTynAPnjdLNyXvoFkWIeBhN-gxK1x2cYdCMTQnlYmxW3QpjQKEo4BhjGgrKh6KfBlrtPGOMuDTYDqqfE26BWUjEeIHSrW1cL-SulHd5KI7zxDbpdh1cX0nuX7JK7HtroNerZhnnPpYz9PkCe5Mx1w__'
|
||||
// this.userSig = sig
|
||||
this.userID = userID
|
||||
window.test = this
|
||||
// this.timGroupId = '@TGS#3CYWMK2ON' // 测试使用
|
||||
// window.test = this
|
||||
if (isInit) return this.init()
|
||||
}
|
||||
// 设置配置
|
||||
async setConfig() {
|
||||
await this.timChat.TIMSetConfig({ // TIMSetConfigParam
|
||||
const res=await this.timChat.TIMSetConfig({ // TIMSetConfigParam
|
||||
json_config: { // JSONCongfig
|
||||
set_config_log_level: this.defOption.log_level,
|
||||
set_config_callback_log_level: this.defOption.log_level,
|
||||
// set_config_is_log_output_console: true,
|
||||
set_config_log_level: TYPES.TIMLogLevel.kTIMLog_Test,
|
||||
set_config_callback_log_level: TYPES.TIMLogLevel.kTIMLog_Error,
|
||||
set_config_is_log_output_console: true,
|
||||
// set_config_user_config: { // 用户配置
|
||||
// user_config_is_read_receipt: true, // true表示要收已读回执事件
|
||||
// user_config_is_sync_report: true, // true表示服务端要删掉已读状态
|
||||
|
@ -63,7 +60,6 @@ export class ImChat {
|
|||
// 日志监听
|
||||
this.timChat.TIMSetLogCallback({
|
||||
callback: data => {
|
||||
// console.log('[im-chat]:', data[1])
|
||||
this.setConsole('%cchat-log ', data[1])
|
||||
},
|
||||
user_data: ''
|
||||
|
|
|
@ -190,7 +190,6 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) {
|
|||
// 内部监听器-是否打印
|
||||
if (!!isConsole) {
|
||||
win.webContents.on('console-message', (e,leve,m,lin,s) => {
|
||||
console.log(m)
|
||||
if(m.startsWith('%c')){ // 特殊打印
|
||||
const arr = m.match(/(%c[^ ]+)(?:\s+(.*;))(.*)/)
|
||||
console.log(arr[1],arr[2],arr[3])
|
||||
|
|
|
@ -501,7 +501,7 @@ export default {
|
|||
},
|
||||
// 上课-工具类悬浮
|
||||
async openLesson() {
|
||||
await startClass(this.curClassReserv.id)
|
||||
// await startClass(this.curClassReserv.id)
|
||||
createWindow('tool-sphere', {
|
||||
url:
|
||||
'/tool/sphere?entpcourseid=' +
|
||||
|
|
|
@ -31,13 +31,13 @@ const initImChat = async (timGroupId) => {
|
|||
imChatObj.imChat = new ImChat(sdkAppId, sign, timuserid)
|
||||
// 初始化 im-chat
|
||||
await imChatObj.imChat.init()
|
||||
// 登录 im-chat
|
||||
await imChatObj.imChat.login()
|
||||
// 监听 im-chat 消息
|
||||
imChatObj.imChat.watch((res) => {
|
||||
imChatObj.imChat.setConsole('%cchat-msg', res)
|
||||
msgHandle(res) // 消息处理
|
||||
})
|
||||
// 登录 im-chat(为了不漏消息,需要在登录之前-监听)
|
||||
await imChatObj.imChat.login()
|
||||
// 创建群
|
||||
if (!timGroupId||props.isGroup) { // 创建群
|
||||
await createGroup(groupName)
|
||||
|
|
|
@ -80,7 +80,6 @@ const btnList = [ // 工具栏按钮列表
|
|||
onMounted(async() => {
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
setTimeout(() => {
|
||||
// classManageApi.startClass(classObj.id) // 开始上课-临时
|
||||
resetStatus() // 开启重置状态-监听
|
||||
}, 200);
|
||||
})
|
||||
|
@ -91,8 +90,8 @@ const getClassInfo = async () => {
|
|||
const { data } = await classManageApi.getClassInfo(classObj.id)
|
||||
classObj.data = data
|
||||
// 群id
|
||||
let timGroupId = data?.ex3 && data?.ex3 != 'undefined' ? data.ex3: ''
|
||||
console.log('timGroupId:', timGroupId)
|
||||
let timGroupId = data?.ex3 || ''
|
||||
console.log('获取群ID:', timGroupId)
|
||||
const chat = await imChatRef.value?.initImChat(timGroupId) // 初始化im-chat
|
||||
if (!timGroupId) timGroupId = chat.timGroupId
|
||||
classManageApi.startClass(classObj.id, timGroupId) // 开始上课
|
||||
|
|
Loading…
Reference in New Issue