diff --git a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue index 18ac469..896f6cf 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue @@ -208,6 +208,18 @@ const insertImageElement = (files: FileList) => { // }) } +//获取当前的时间 +const getTime=()=>{ + const now = new Date(); + const year = now.getFullYear(); + const month = ('0' + (now.getMonth() + 1)).slice(-2); + const day = ('0' + now.getDate()).slice(-2); + const hours = ('0' + now.getHours()).slice(-2); + const minutes = ('0' + now.getMinutes()).slice(-2); + const seconds = ('0' + now.getSeconds()).slice(-2); + return `${year}-${month}-${day}_${hours}:${minutes}:${seconds}`; +}; + /** * base64转图片File * @param {String} base64 图片base64 @@ -234,9 +246,10 @@ const base64ToFile = (base64: string, fileName = '试题图片') => { // charCodeAt():获取给定索引处字符对应的 UTF-16 代码单元 u8arr[n] = bstr.charCodeAt(n) } + const filename = fileName+getTime() // 利用构造函数创建File文件对象 // new File(bits, name, options) - const file = new File([u8arr], `${fileName}.${suffix}`, { + const file = new File([u8arr], `${filename}.${suffix}`, { type: type }) // 返回file diff --git a/src/renderer/src/views/classTask/teachClassTask.vue b/src/renderer/src/views/classTask/teachClassTask.vue index d0be63a..2ce9561 100644 --- a/src/renderer/src/views/classTask/teachClassTask.vue +++ b/src/renderer/src/views/classTask/teachClassTask.vue @@ -714,37 +714,39 @@ const closeDialog = () => { // im监听消息回调 const msgHandle = (msg) => { - const { type, data } = msg - switch(type) { - case MsgEnum.HEADS.MSG_closed: // 下课: + if (typeof msg === 'object'){ + const { head, content, ...other } = msg + switch(head) { + case MsgEnum.HEADS.MSG_closed: // 下课: + window.close() // 关闭窗口 + break + case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业: + const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); + openDialog(data, false); + break + case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面 window.close() // 关闭窗口 - break - case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业: - const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); - openDialog(data, false); - break - case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面 - window.close() // 关闭窗口 - break - // case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[] - // { - // (data||[]).forEach(o => { - // const msgArr = o?.message_elem_array||[] - // msgArr.forEach(info => { - // const msgType = info?.elem_type // 消息类型 TIMElemType - // const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : '' - // // 处理学生端反馈得消息 - // //console.log('msgData->', msgData); - // if (msgData.msgKey == "finishHomework"){ - // // 刷新 - // const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); - // //console.log('data->', data); - // openDialog(data, false); - // } - // }) - // }) - // } - // break + break + // case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[] + // { + // (data||[]).forEach(o => { + // const msgArr = o?.message_elem_array||[] + // msgArr.forEach(info => { + // const msgType = info?.elem_type // 消息类型 TIMElemType + // const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : '' + // // 处理学生端反馈得消息 + // //console.log('msgData->', msgData); + // if (msgData.msgKey == "finishHomework"){ + // // 刷新 + // const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); + // //console.log('data->', data); + // openDialog(data, false); + // } + // }) + // }) + // } + // break + } } }