作业弹窗

This commit is contained in:
zhangxuelin 2024-12-12 16:12:32 +08:00
parent 3d8f7c2a3a
commit 590b318757
2 changed files with 50 additions and 27 deletions

View File

@ -82,6 +82,8 @@ export class MsgEnum {
MSG_classcourseopen : 'classcourseopen', MSG_classcourseopen : 'classcourseopen',
/** @desc: 学生的测练结果反馈 */ /** @desc: 学生的测练结果反馈 */
MSG_classquizfeedback : 'classquizfeedback', MSG_classquizfeedback : 'classquizfeedback',
/** @desc: 学生提交作业 */
MSG_finishHomework : 'finishHomework',
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */ /** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
MSG_classtaskfeedback : 'classtaskfeedback', MSG_classtaskfeedback : 'classtaskfeedback',
/** @desc: 老师端学生反馈的消息具体要看其中的feedbackkey类别较繁杂 */ /** @desc: 老师端学生反馈的消息具体要看其中的feedbackkey类别较繁杂 */

View File

@ -162,9 +162,10 @@ import ItemDialogScore from '@/views/classTask/container/classTask/item-dialog-s
import quizStats from '@/views/classTask/container/quizStats.vue' import quizStats from '@/views/classTask/container/quizStats.vue'
import ClassOverview from '@/views/classTask/container/classOverview.vue' import ClassOverview from '@/views/classTask/container/classOverview.vue'
import {sessionStore} from '@/utils/store' import {sessionStore} from '@/utils/store'
import Chat from '@/utils/chat' // im // import Chat from '@/utils/chat' // im
import MsgEnum from '@/plugins/imChat/msgEnum' // im
import ChatWs from '@/plugins/socket' // socket
if (!ChatWs.ws) ChatWs.init()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const emit = defineEmits(['cle-click']) const emit = defineEmits(['cle-click'])
const props = defineProps({ const props = defineProps({
@ -715,25 +716,35 @@ const closeDialog = () => {
const msgHandle = (msg) => { const msgHandle = (msg) => {
const { type, data } = msg const { type, data } = msg
switch(type) { switch(type) {
case 'TIMAddRecvNewMsgCallback': // data=[] case MsgEnum.HEADS.MSG_closed: // :
{ window.close() //
(data||[]).forEach(o => { break
const msgArr = o?.message_elem_array||[] case MsgEnum.HEADS.MSG_finishHomework: // :
msgArr.forEach(info => { const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
const msgType = info?.elem_type // TIMElemType openDialog(data, false);
const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : '' break
// case MsgEnum.HEADS.MSG_slideFlapping: //
//console.log('msgData->', msgData); window.close() //
if (msgData.msgKey == "finishHomework"){ break
// // case 'TIMAddRecvNewMsgCallback': // data=[]
const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); // {
//console.log('data->', data); // (data||[]).forEach(o => {
openDialog(data, false); // 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)||'' : ''
} // //
break // //console.log('msgData->', msgData);
// if (msgData.msgKey == "finishHomework"){
// //
// const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
// //console.log('data->', data);
// openDialog(data, false);
// }
// })
// })
// }
// break
} }
} }
@ -750,11 +761,21 @@ onMounted(() => {
isReloadTimer(); isReloadTimer();
// im // im
if (!Chat.imChat) { if (ChatWs.ws) {
Chat.init(true, true, msgHandle); ChatWs.watch((msg, e) => {
} else { try {
Chat.listenMsg(msgHandle); msgHandle(JSON.parse(msg))
} } catch (error) {
console.error('socket 解析异常 ', error, e)
msgHandle(msg)
}
})
}
// if (!Chat.imChat) {
// Chat.init(true, true, msgHandle);
// } else {
// Chat.listenMsg(msgHandle);
// }
}) })
const isReloadTimer = () =>{ const isReloadTimer = () =>{
clearInterval(reloadTimer.value) // clearInterval(reloadTimer.value) //