zdg #149

Merged
zhengdegang merged 12 commits from zdg into main 2024-08-21 09:21:08 +08:00
7 changed files with 22 additions and 26 deletions
Showing only changes of commit a2e72b855b - Show all commits

View File

@ -160,10 +160,12 @@ export function deleteSmartReserv(id) {
}) })
} }
export function startClass(id, ex3) { export function startClass(id, ex3) {
const params = {id}
!!ex3 && (params.ex3 = ex3)
return request({ return request({
url: '/smarttalk/classReserv/startClass', url: '/smarttalk/classReserv/startClass',
method: 'get', method: 'get',
params: {id, ex3} params
}) })
} }
export function endClass(id) { export function endClass(id) {

View File

@ -382,12 +382,12 @@ const TIMResult= {
* | 名称 | 含义 | number | * | 名称 | 含义 | number |
* | ---- | ---- | ---- | * | ---- | ---- | ---- |
* | kTIMLog_Off | 关闭日志输出 | 0 | * | kTIMLog_Off | 关闭日志输出 | 0 |
* | kTIMLog_Test | 失败IM SDK未初始化 | 1 | * | kTIMLog_Test | 全量日志 | 1 |
* | kTIMLog_Verbose | 失败IM SDK未初始化 | 2 | * | kTIMLog_Verbose| 开发调试过程中一些详细信息日志 | 2 |
* | kTIMLog_Debug | 接口调用失败错误的Json格式或Json Key | 3 | * | kTIMLog_Debug | 调试日志 | 3 |
* | kTIMLog_Info | 接口调用失败参数错误 | 4 | * | kTIMLog_Info | 信息日志 | 4 |
* | kTIMLog_Warn | 接口调用失败无效的会话 | 5 | * | kTIMLog_Warn | 警告日志 | 5 |
* | kTIMLog_Error | 接口调用失败无效的群组 | 6 | * | kTIMLog_Error | 错误日志 | 6 |
* | kTIMLog_Assert | 断言日志 | 7 | * | kTIMLog_Assert | 断言日志 | 7 |
*/ */
const TIMLogLevel= { const TIMLogLevel= {

View File

@ -25,7 +25,7 @@ export class ImChat {
} }
defOption = { // 默认配置 defOption = { // 默认配置
// 日志等级-全量日志 // 日志等级-全量日志
log_level: TYPES.TIMLogLevel.kTIMLog_Test, log_level: TYPES.TIMLogLevel.kTIMLog_Off,
// 群组类型-会议群Meeting成员上限 6000 人 // 群组类型-会议群Meeting成员上限 6000 人
group_type: TYPES.TIMGroupType.kTIMGroup_ChatRoom, group_type: TYPES.TIMGroupType.kTIMGroup_ChatRoom,
} }
@ -34,20 +34,17 @@ export class ImChat {
constructor(SDKAppID, userSig, userID, isInit) { constructor(SDKAppID, userSig, userID, isInit) {
this.SDKAppID = SDKAppID this.SDKAppID = SDKAppID
this.userSig = userSig this.userSig = userSig
// const sig = 'eJwtjN0KgjAYQN9l16Vzcz8I3RhE9J*JV94IW-ZV6nASWfTurfTynAPnjdLNyXvoFkWIeBhN-gxK1x2cYdCMTQnlYmxW3QpjQKEo4BhjGgrKh6KfBlrtPGOMuDTYDqqfE26BWUjEeIHSrW1cL-SulHd5KI7zxDbpdh1cX0nuX7JK7HtroNerZhnnPpYz9PkCe5Mx1w__'
// this.userSig = sig
this.userID = userID this.userID = userID
window.test = this // window.test = this
// this.timGroupId = '@TGS#3CYWMK2ON' // 测试使用
if (isInit) return this.init() if (isInit) return this.init()
} }
// 设置配置 // 设置配置
async setConfig() { async setConfig() {
await this.timChat.TIMSetConfig({ // TIMSetConfigParam const res=await this.timChat.TIMSetConfig({ // TIMSetConfigParam
json_config: { // JSONCongfig json_config: { // JSONCongfig
set_config_log_level: this.defOption.log_level, set_config_log_level: TYPES.TIMLogLevel.kTIMLog_Test,
set_config_callback_log_level: this.defOption.log_level, set_config_callback_log_level: TYPES.TIMLogLevel.kTIMLog_Error,
// set_config_is_log_output_console: true, set_config_is_log_output_console: true,
// set_config_user_config: { // 用户配置 // set_config_user_config: { // 用户配置
// user_config_is_read_receipt: true, // true表示要收已读回执事件 // user_config_is_read_receipt: true, // true表示要收已读回执事件
// user_config_is_sync_report: true, // true表示服务端要删掉已读状态 // user_config_is_sync_report: true, // true表示服务端要删掉已读状态
@ -63,7 +60,6 @@ export class ImChat {
// 日志监听 // 日志监听
this.timChat.TIMSetLogCallback({ this.timChat.TIMSetLogCallback({
callback: data => { callback: data => {
// console.log('[im-chat]', data[1])
this.setConsole('%cchat-log ', data[1]) this.setConsole('%cchat-log ', data[1])
}, },
user_data: '' user_data: ''

View File

@ -190,7 +190,6 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) {
// 内部监听器-是否打印 // 内部监听器-是否打印
if (!!isConsole) { if (!!isConsole) {
win.webContents.on('console-message', (e,leve,m,lin,s) => { win.webContents.on('console-message', (e,leve,m,lin,s) => {
console.log(m)
if(m.startsWith('%c')){ // 特殊打印 if(m.startsWith('%c')){ // 特殊打印
const arr = m.match(/(%c[^ ]+)(?:\s+(.*;))(.*)/) const arr = m.match(/(%c[^ ]+)(?:\s+(.*;))(.*)/)
console.log(arr[1],arr[2],arr[3]) console.log(arr[1],arr[2],arr[3])

View File

@ -501,7 +501,7 @@ export default {
}, },
// - // -
async openLesson() { async openLesson() {
await startClass(this.curClassReserv.id) // await startClass(this.curClassReserv.id)
createWindow('tool-sphere', { createWindow('tool-sphere', {
url: url:
'/tool/sphere?entpcourseid=' + '/tool/sphere?entpcourseid=' +

View File

@ -31,13 +31,13 @@ const initImChat = async (timGroupId) => {
imChatObj.imChat = new ImChat(sdkAppId, sign, timuserid) imChatObj.imChat = new ImChat(sdkAppId, sign, timuserid)
// im-chat // im-chat
await imChatObj.imChat.init() await imChatObj.imChat.init()
// im-chat
await imChatObj.imChat.login()
// im-chat // im-chat
imChatObj.imChat.watch((res) => { imChatObj.imChat.watch((res) => {
imChatObj.imChat.setConsole('%cchat-msg', res) imChatObj.imChat.setConsole('%cchat-msg', res)
msgHandle(res) // msgHandle(res) //
}) })
// im-chat(-)
await imChatObj.imChat.login()
// //
if (!timGroupId||props.isGroup) { // if (!timGroupId||props.isGroup) { //
await createGroup(groupName) await createGroup(groupName)

View File

@ -80,7 +80,6 @@ const btnList = [ // 工具栏按钮列表
onMounted(async() => { onMounted(async() => {
getClassInfo() // ex3 getClassInfo() // ex3
setTimeout(() => { setTimeout(() => {
// classManageApi.startClass(classObj.id) // -
resetStatus() // - resetStatus() // -
}, 200); }, 200);
}) })
@ -91,8 +90,8 @@ const getClassInfo = async () => {
const { data } = await classManageApi.getClassInfo(classObj.id) const { data } = await classManageApi.getClassInfo(classObj.id)
classObj.data = data classObj.data = data
// id // id
let timGroupId = data?.ex3 && data?.ex3 != 'undefined' ? data.ex3: '' let timGroupId = data?.ex3 || ''
console.log('timGroupId:', timGroupId) console.log('获取群ID:', timGroupId)
const chat = await imChatRef.value?.initImChat(timGroupId) // im-chat const chat = await imChatRef.value?.initImChat(timGroupId) // im-chat
if (!timGroupId) timGroupId = chat.timGroupId if (!timGroupId) timGroupId = chat.timGroupId
classManageApi.startClass(classObj.id, timGroupId) // classManageApi.startClass(classObj.id, timGroupId) //