Merge branch 'main' into lyc-dev
This commit is contained in:
commit
21215150bb
|
@ -63,7 +63,7 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, computed, watch, reactive } from 'vue'
|
||||
import { listByDeadDate, listClassworkdataByDeadDate } from '@/api/classTask'
|
||||
import { listByDeadDate, listClassworkdataByDeadDate, listClassworkdata } from '@/api/classTask'
|
||||
|
||||
import TaskItem from '@/views/classTask/container/task-item.vue'
|
||||
import ItemDialog from '@/views/classTask/container/item-dialog.vue'
|
||||
|
@ -109,13 +109,13 @@ const changeEndDate = (val) => {
|
|||
}
|
||||
|
||||
// 获取数据
|
||||
const getData = () => {
|
||||
const getData = async () => {
|
||||
classWorkList.value = []
|
||||
loading.value = true
|
||||
// 1、班级列表
|
||||
getClassList()
|
||||
// 2、班级作业
|
||||
getClassWorkList()
|
||||
await getClassWorkList()
|
||||
// 3、班级学生作业 包含多个班级
|
||||
getStudentClassWorkData()
|
||||
loading.value = false
|
||||
|
@ -133,19 +133,21 @@ const getClassList = () => {
|
|||
/**
|
||||
* 2、获取班级作业
|
||||
*/
|
||||
const getClassWorkList = () => {
|
||||
const getClassWorkList = async () => {
|
||||
if(classTaskStore.classListIds.length>0){
|
||||
// 班级作业数据,包含多个班级 homeworklist
|
||||
listByDeadDate({
|
||||
const response = await listByDeadDate({
|
||||
classidarray: classTaskStore.classListIds.join(','),
|
||||
edituserid: userStore.userId, // 老师的id
|
||||
edustage: userStore.edustage, // 学段
|
||||
edusubject: userStore.edusubject,//学科
|
||||
deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期
|
||||
status: '1', // 作业状态:1-已发布
|
||||
// orderby: 'concat(deaddate,uniquekey) DESC',
|
||||
orderby: 'uniquekey DESC',
|
||||
orderby: 'deaddate DESC',
|
||||
pageSize: 100,
|
||||
}).then((response) => {
|
||||
})
|
||||
|
||||
for (var i = 0; i < response.rows.length; i++) {
|
||||
// 初始化部分新增字段值
|
||||
response.rows[i].workdatalist = []
|
||||
|
@ -191,7 +193,6 @@ const getClassWorkList = () => {
|
|||
response.rows[i].workdatacount = stuList.length
|
||||
}
|
||||
}
|
||||
|
||||
// 显示分配人数(workdatacount)>0 的
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
classWorkList.value = response.rows && response.rows.filter((item) => item.workdatacount > 0)
|
||||
|
@ -202,7 +203,6 @@ const getClassWorkList = () => {
|
|||
total.value = 0
|
||||
}
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,14 +211,19 @@ const getClassWorkList = () => {
|
|||
*/
|
||||
const getStudentClassWorkData = () => {
|
||||
if(classTaskStore.classListIds.length>0){
|
||||
listClassworkdataByDeadDate({
|
||||
classids: classTaskStore.classListIds.join(','),
|
||||
edustage: userStore.edustage,// 学段
|
||||
edusubject: userStore.edusubject,//学科
|
||||
deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期
|
||||
status: '1', // 作业状态:1-已发布
|
||||
orderby: "uniquekey DESC",// TODO: 这里是否加 deaddate 的排序,后续看
|
||||
pageSize: 1000
|
||||
// listClassworkdataByDeadDate({
|
||||
// edituserid: userStore.userId, // 老师的id
|
||||
// classids: classTaskStore.classListIds.join(','),
|
||||
// edusubject: userStore.edusubject,//学科
|
||||
// deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期
|
||||
// //status: '1', // 作业状态:1-已发布
|
||||
// orderby: "deaddate DESC",// TODO: 这里是否加 deaddate 的排序,后续看
|
||||
// pageSize: 1000,
|
||||
// })
|
||||
const ids = classWorkList.value.map((item) => item.id).join(',');
|
||||
listClassworkdata({
|
||||
classworkids: ids,
|
||||
pageSize: 1000,
|
||||
}).then((res) => {
|
||||
for (var t = 0; t < classWorkList.value.length; t++) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
|
@ -288,7 +293,7 @@ const getStudentClassWorkData = () => {
|
|||
|
||||
// 计算参与学习任务的平均用时
|
||||
if (classWorkList.value[t].workdatafeedbackcount > 0) {
|
||||
classWorkList.value[t].averagetime = (classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount).toFixed(0)
|
||||
classWorkList.value[t].averagetime = Math.ceil(classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount / 60).toFixed(0)
|
||||
} else {
|
||||
classWorkList.value[t].averagetime = 0
|
||||
}
|
||||
|
@ -370,12 +375,13 @@ const getStudentVisible = async () => {
|
|||
// 班级作业数据,多个班级
|
||||
const response = await listByDeadDate({
|
||||
classidarray: classTaskStore.classListIds.join(','),
|
||||
edituserid: userStore.userId, // 老师的id
|
||||
edustage: userStore.edustage,// 学段
|
||||
edusubject: userStore.edusubject,//学科
|
||||
deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期
|
||||
status: '1', // 作业状态:1-已发布
|
||||
// orderby: 'concat(deaddate,uniquekey) DESC',
|
||||
orderby: 'uniquekey DESC',
|
||||
orderby: 'deaddate DESC',
|
||||
pageSize: 100
|
||||
})
|
||||
const curWorkList = response.rows
|
||||
|
@ -400,7 +406,7 @@ const getStudentVisible = async () => {
|
|||
)
|
||||
// 计算参与学习任务的平均用时
|
||||
if (classWorkList.value[t].workdatafeedbackcount > 0) {
|
||||
classWorkList.value[t].averagetime = (classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount).toFixed(0)
|
||||
classWorkList.value[t].averagetime = Math.ceil(classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount / 60).toFixed(0)
|
||||
} else {
|
||||
classWorkList.value[t].averagetime = 0
|
||||
}
|
||||
|
|
|
@ -539,6 +539,10 @@ const workHandle = (type) => {
|
|||
classWorkAnalysis.view = type
|
||||
const isClose = type != 'quizStats' && !! classWorkActiveData.timerId
|
||||
const isOpen = type == 'quizStats' && !classWorkActiveData.timerId
|
||||
// 每次进来都重新调用一次
|
||||
if(type == 'quizStats') {
|
||||
getWorkFeedList();
|
||||
}
|
||||
if (isClose) clearInterval(classWorkActiveData.timerId) // 关闭定时器
|
||||
if (isOpen) {
|
||||
// 轮询 更新学生作答数据
|
||||
|
|
|
@ -17,7 +17,13 @@
|
|||
<div class="respond">
|
||||
<div class="c-label">
|
||||
<b t1>作答情况</b>
|
||||
<template v-if="item.type=='单选题'||item.type == '多选题'||item.type == '判断题'">
|
||||
<span>(已经完成 <el-text type="danger">{{item.accSum}}</el-text> 人-</span>
|
||||
<span>回答正确 <el-text type="danger">{{item.rightSum}}</el-text> 人)</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>(已经完成 <el-text type="danger">{{item.accSum}}</el-text> 人)</span>
|
||||
</template>
|
||||
</div>
|
||||
<div class="c-childen">
|
||||
<template v-for="(it, ind) in item.children">
|
||||
|
@ -111,6 +117,14 @@ colorArr = [
|
|||
onMounted(() => {})
|
||||
|
||||
// === 方法(methods) ===
|
||||
|
||||
const isSame = (a,b) => {
|
||||
if (a.length != b.length) return false
|
||||
return !a.some(v => !b.includes(v))
|
||||
}
|
||||
|
||||
|
||||
// 初始-数据处理
|
||||
// 初始-数据处理
|
||||
const initData = () => {
|
||||
// console.log('xxx', props)
|
||||
|
@ -124,43 +138,128 @@ const initData = () => {
|
|||
const workdesc = o.workdesc || ''
|
||||
let accSum = 0 // 该题总人数
|
||||
let activeIds = [] // 已做答学生
|
||||
let rightIds = [] // 正确学生
|
||||
const quizFeedList = activeWorkFeedList.filter(f => f.entpcourseworkid == o.id) // 做该题的列表
|
||||
let children = []
|
||||
if (['单选题','多选题'].includes(o.worktype)) { // '单选题','多选题'
|
||||
const list = workdesc.includes('#&') ? workdesc.split('#&') : isJson(workdesc)?JSON.parse(workdesc):[]
|
||||
const allStudents = [];
|
||||
if (o.worktype == '单选题') { // '单选题','多选题'
|
||||
const list = workdesc.includes('#&') ? workdesc.split('#&') : isJson(workdesc)?JSON.parse(workdesc):[];
|
||||
children = list.map((v,i) => {
|
||||
const code = toCode(i) // 转换 A-Z
|
||||
const isOk = (isJson(workdesc)?JSON.parse(o.workanswer):o.workanswer||'').includes(i+'') // 是否(包含)正确答案
|
||||
// 改选项的学生id
|
||||
const studentIds = quizFeedList.filter(f => f.feedcontent==v&&f.finishtimelength!='0').map(f => f.studentid)||[];
|
||||
accSum += studentIds.length;
|
||||
if (isOk) {
|
||||
activeIds.push(...studentIds)
|
||||
}
|
||||
return { def: v, code, isOk, studentIds }
|
||||
})
|
||||
}
|
||||
else if (o.worktype == '多选题') {
|
||||
// 多选题的正确率单独处理
|
||||
rightIds = quizFeedList.filter(f => {
|
||||
const workanswer = (isJson(o.workanswer)) ? JSON.parse(o.workanswer) : o.workanswer || [];
|
||||
const res = isSame((f.feedcontent||'').split(','), workanswer);
|
||||
return f.entpcourseworkid == o.id && f.finishtimelength!='0' && res;
|
||||
});
|
||||
|
||||
const list = workdesc.includes('#&') ? workdesc.split('#&') : isJson(workdesc)?JSON.parse(workdesc):[];
|
||||
children = list.map((v,i) => {
|
||||
const isOne = o.worktype == '单选题'
|
||||
const code = toCode(i) // 转换 A-Z
|
||||
// const isOk = isOne ? i == o.workanswer : o.workanswer.includes(i) // 是否(包含)正确答案
|
||||
const isOk = (isJson(workdesc)?JSON.parse(o.workanswer):o.workanswer||'').includes(i+'') // 是否(包含)正确答案
|
||||
// 改选项的学生id
|
||||
const studentIds = quizFeedList.filter(f => isOne ? f.feedcontent==v : f.feedcontent.includes(i)).map(f => f.studentid)||[]
|
||||
accSum += studentIds.length
|
||||
if(isOk) isOne ? activeIds.push(...studentIds) : activeIds=[...new Set(activeIds.concat(studentIds))] // 多选去重
|
||||
const studentIds = quizFeedList.filter(f => f.feedcontent.includes(i)&&f.finishtimelength!='0').map(f => f.studentid)||[];
|
||||
accSum += studentIds.length;
|
||||
if (studentIds.length>0) {
|
||||
allStudents.push(...studentIds);
|
||||
}
|
||||
if(isOk) {
|
||||
activeIds=[...new Set(activeIds.concat(studentIds))] // 多选去重
|
||||
}
|
||||
return { def: v, code, isOk, studentIds }
|
||||
})
|
||||
} else if (o.worktype == '填空题') { // 填空题
|
||||
}
|
||||
else if (o.worktype == '填空题') { // 填空题
|
||||
const regex = /<!--BA-->(.*?)<!--EA-->/g // 定义正则表达式,匹配 <!--BA-->xxx<!--EA--> 格式的内容
|
||||
children = (o.title||'').match(regex).map((v,i) => {
|
||||
const def = `填空项 ${i+1}`
|
||||
const code = '( )', txt=v
|
||||
//const code = '( )'
|
||||
const code = '(略)', txt=v
|
||||
// 改选项的学生id
|
||||
const studentIds = quizFeedList.filter(f => !!(f.feedcontent||'').replace(/#$/,'').split('#')[i]).map(f => f.studentid)||[]
|
||||
const studentIds = quizFeedList.filter(f => !!(f.feedcontent||'').replace(/#$/,'').split('#')[i] && f.finishtimelength!='0').map(f => f.studentid)||[]
|
||||
activeIds=[...new Set(activeIds.concat(studentIds))] // 多选去重
|
||||
accSum = activeIds.length
|
||||
return { def, code, txt, isOk:true, studentIds }
|
||||
})
|
||||
} else if (o.worktype == '论述题') { // 论述题
|
||||
const code = '( )', def = '论述内容'
|
||||
const studentIds = quizFeedList.filter(f => !!(f.feedcontent||'').replace(/#$/,'')).map(f => f.studentid)||[]
|
||||
} else if (o.worktype == '判断题') { // 判断题
|
||||
const list = ['正确', '错误'];
|
||||
children = list.map((v,i) => {
|
||||
const workanswer = o.workanswer
|
||||
.replace('×', '0')
|
||||
.replace('√', '1')
|
||||
.replace('错误', '0')
|
||||
.replace('正确', '1')
|
||||
.replace('正确。', '1')
|
||||
.replace('F', '0')
|
||||
.replace('T', '1')
|
||||
.replace('错', '0')
|
||||
.replace('对', '1');
|
||||
const workanswerFormat = isJson(workanswer) ? JSON.parse(workanswer) : workanswer||''
|
||||
const code = v=='正确' ? '1' : '0'
|
||||
let isOk = (workanswerFormat).includes(code)
|
||||
// warn: 看是否需要转为回答正常的显示, 当前为学生实际回答字面的正确和错误
|
||||
// if (workanswerFormat == '0') {
|
||||
// isOk = !isOk;
|
||||
// }
|
||||
// 改选项的学生id
|
||||
const studentIds = quizFeedList.filter(f => {
|
||||
const feedcontent = f.feedcontent
|
||||
.replace('×', '0')
|
||||
.replace('√', '1')
|
||||
.replace('错误', '0')
|
||||
.replace('正确', '1')
|
||||
.replace('正确。', '1')
|
||||
.replace('F', '0')
|
||||
.replace('T', '1')
|
||||
.replace('错', '0')
|
||||
.replace('对', '1');
|
||||
if(feedcontent == code&&f.finishtimelength!='0'){
|
||||
return f
|
||||
}
|
||||
}).map(f => f.studentid)||[];
|
||||
accSum += studentIds.length;
|
||||
if(isOk) activeIds.push(...studentIds)
|
||||
return { def: v, code: v, isOk, studentIds }
|
||||
})
|
||||
} else { // 论述题
|
||||
// code = '( )'
|
||||
const code = '(略)', def = '解答内容'
|
||||
const studentIds = quizFeedList.filter(f => !!(f.feedcontent||'').replace(/#$/,'')&&f.finishtimelength!='0').map(f => f.studentid)||[]
|
||||
activeIds=[...new Set(activeIds.concat(studentIds))] // 多选去重
|
||||
accSum = activeIds.length
|
||||
children = [{ def, code, isOk:true, studentIds }]
|
||||
}
|
||||
|
||||
const studentSum = studentList.value.length || 0 // 当前推送答题人数
|
||||
const points = percent((activeIds.length / (studentSum||1)).toFixed(2)) // 计算得分率
|
||||
let points = percent((activeIds.length / (studentSum||1)).toFixed(2)) // 计算得分率
|
||||
let rightSum = activeIds.length; // 回答正确人数
|
||||
|
||||
// 多选题单独处理
|
||||
if (o.worktype == '多选题') {
|
||||
// 单独重新处理人数问题
|
||||
const uniqueTmpStuents = [...new Set(allStudents)];
|
||||
accSum = uniqueTmpStuents.length;
|
||||
// 单独处理得分率
|
||||
points = percent((rightIds.length / (studentSum||1)).toFixed(2)) // 计算得分率
|
||||
// 回答正确人数
|
||||
rightSum = rightIds.length;
|
||||
}
|
||||
|
||||
// def: 原始题数据 type 类型 active: 选中 points: 得分率, accSum 题解答人数
|
||||
return { def: o, id: o.id, type: o.worktype, active: [], points, accSum, children }
|
||||
return { def: o, id: o.id, type: o.worktype, active: [], points, accSum, rightSum, children }
|
||||
})
|
||||
console.log('获取数据: ', data)
|
||||
dataList.value = data
|
||||
|
@ -170,7 +269,7 @@ const ratio_1 = (row, sum = 1) => percent(((row.studentIds.length||0) / (sum||1)
|
|||
// 获取-该题-完成进度
|
||||
const ratio_2 = row => percent(((row.accSum||0) / (studentList.value.length||1)).toFixed(2))
|
||||
// 获取-该题进度-txt
|
||||
const getRatioTxt = row => row.type.includes('选题') ? '得分率' : '完成度'
|
||||
const getRatioTxt = row => ['单选题', '多选题', '判断题'].includes(row.type) ? '得分率' : '完成度'
|
||||
// 获取-进度条状态-左侧
|
||||
const getStatus = row => row.isOk ? 'success' : 'exception'
|
||||
// 获取-学生姓名(id)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<div class="class-reserv-item-tool">
|
||||
<span>
|
||||
<!-- {{ item.averagetime?item.averagetime:0 }} -->
|
||||
<span v-if=" item.averagetime<60 ">
|
||||
<!-- <span v-if=" item.averagetime<60 ">
|
||||
<span style="color: #007fff; font-weight: 900; font-size: 15px">{{ item.averagetime }}</span>分钟
|
||||
</span>
|
||||
<span v-if=" item.averagetime==60 ">
|
||||
|
@ -39,7 +39,8 @@
|
|||
<span v-if=" item.averagetime>60 ">
|
||||
<span style="color: #007fff; font-weight: 900; font-size: 15px">{{ Math.floor(item.averagetime / 60)}}</span>小时
|
||||
<span style="color: #007fff; font-weight: 900; font-size: 15px">{{ Math.floor(item.averagetime % 60)}}</span>分钟
|
||||
</span>
|
||||
</span> -->
|
||||
<span style="color: #007fff; font-weight: 900; font-size: 15px">{{ item.averagetime }}</span>分钟
|
||||
</span>
|
||||
<span>平均用时</span>
|
||||
</div>
|
||||
|
|
|
@ -50,7 +50,8 @@ const getHomework = async () => {
|
|||
try {
|
||||
const { rows } = await homeworklist({ edituserid: user.userId, edustage, edusubject, deaddate: getTomorrow(), status: '1', orderby: 'uniquekey DESC', pageSize: 500 })
|
||||
// 只展示进行中的
|
||||
homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate)
|
||||
// homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate)
|
||||
homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getTomorrow() <= item.deaddate) //大于今天的才算进行中
|
||||
homeworkList.value.forEach((item) => {
|
||||
item.workdatacount = JSON.parse('[' + item.classworkdatastudentids + ']').length
|
||||
// 如果是习题训练任务,则检查一共有多少道
|
||||
|
|
Loading…
Reference in New Issue