Merge pull request 'zouyf_dev' (#361) from zouyf_dev into main
Reviewed-on: #361
This commit is contained in:
commit
812e799e2a
|
@ -157,6 +157,7 @@ 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 登录初始化
|
||||||
|
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
@ -204,9 +205,10 @@ const classWorkAnalysisScore = reactive({
|
||||||
// form.name = newValue.label
|
// form.name = newValue.label
|
||||||
// }
|
// }
|
||||||
// )
|
// )
|
||||||
const openDialog = (data) => {
|
const openDialog = (data, isInit=true) => {
|
||||||
console.log(data, '点击的item完成情况')
|
console.log(data, '点击的item完成情况')
|
||||||
|
|
||||||
|
if (isInit) {
|
||||||
classWorkAnalysis.title = data.uniquekey ? data.uniquekey + '--' : ''
|
classWorkAnalysis.title = data.uniquekey ? data.uniquekey + '--' : ''
|
||||||
classWorkAnalysis.worktype = data.worktype
|
classWorkAnalysis.worktype = data.worktype
|
||||||
classWorkAnalysis.workclass = data.workclass
|
classWorkAnalysis.workclass = data.workclass
|
||||||
|
@ -233,6 +235,8 @@ const openDialog = (data) => {
|
||||||
? JSON.parse(`[${data.classworkdatastudentids}]`)
|
? JSON.parse(`[${data.classworkdatastudentids}]`)
|
||||||
: []
|
: []
|
||||||
classWorkActiveData.studentList = studentArr
|
classWorkActiveData.studentList = studentArr
|
||||||
|
}
|
||||||
|
|
||||||
/** 学生完成情况分析--获取作业学生list数据 */
|
/** 学生完成情况分析--获取作业学生list数据 */
|
||||||
getClassWorkStudentList(data.id)
|
getClassWorkStudentList(data.id)
|
||||||
|
|
||||||
|
@ -638,6 +642,32 @@ const closeDialog = () => {
|
||||||
emit('cle-click')
|
emit('cle-click')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// im监听消息回调
|
||||||
|
const msgHandle = (msg) => {
|
||||||
|
const { type, data } = msg
|
||||||
|
switch(type) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const reloadTimer = ref(0); // 开启定时查询,作业id是否刷新了,刷新了就重新获取
|
const reloadTimer = ref(0); // 开启定时查询,作业id是否刷新了,刷新了就重新获取
|
||||||
const cutid = ref(0); // 当前初始化的作业id
|
const cutid = ref(0); // 当前初始化的作业id
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -649,6 +679,13 @@ onMounted(() => {
|
||||||
// 开始定时查询
|
// 开始定时查询
|
||||||
cutid.value = data.id;
|
cutid.value = data.id;
|
||||||
isReloadTimer();
|
isReloadTimer();
|
||||||
|
|
||||||
|
// im监听消息
|
||||||
|
if (!Chat.imChat) {
|
||||||
|
Chat.init(true, true, msgHandle);
|
||||||
|
} else {
|
||||||
|
Chat.listenMsg(msgHandle);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
const isReloadTimer = () =>{
|
const isReloadTimer = () =>{
|
||||||
clearInterval(reloadTimer.value) // 关闭定时器
|
clearInterval(reloadTimer.value) // 关闭定时器
|
||||||
|
|
Loading…
Reference in New Issue