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