Merge pull request 'baigl' (#221) from baigl into main
Reviewed-on: #221
This commit is contained in:
commit
89ae43a458
|
@ -220,7 +220,7 @@ const getStudentClassWorkData = () => {
|
|||
}).then((res) => {
|
||||
for (var t = 0; t < classWorkList.value.length; t++) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
if (res.rows[i].classworkid == classWorkList.value[t].id && res.rows[i].resultcount > 0) {
|
||||
if (res.rows[i].classworkid == classWorkList.value[t].id && res.rows[i].finishtimelength != '0') {
|
||||
console.log('==================')
|
||||
// 有几个学生完成/正在完成学习任务
|
||||
// 至少resultcount不是0
|
||||
|
|
|
@ -79,60 +79,17 @@
|
|||
<template #footer>
|
||||
<el-row>
|
||||
<el-col :span="6" style="padding: 10px">
|
||||
<span
|
||||
>参考答案:
|
||||
<span>参考答案:
|
||||
<span v-if="quItem.workanswerFormat != ''">
|
||||
<sapn
|
||||
style="
|
||||
background-color: #0ed116;
|
||||
color: white;
|
||||
padding: 0 5px;
|
||||
border-radius: 5px;
|
||||
"
|
||||
>{{ quItem.workanswerFormat.replace(/<[^>]+>/g, '') }}</sapn
|
||||
>
|
||||
<sapn style="background-color: #0ed116; color: white; padding: 0 5px; border-radius: 5px;">{{ formatWorkAnswer(quItem) }}</sapn>
|
||||
</span>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="6" style="padding: 10px">
|
||||
<!-- <span>学生答案:{{ stuItem.feedcontent }}</span> -->
|
||||
<span
|
||||
>学生答案:
|
||||
<span v-if="quItem.workdesc == ''|| quItem.workdesc == '[]' ">
|
||||
<!-- quItem.workdesc 没值,说明是非选择题 -->
|
||||
<span
|
||||
v-if="stuItem.feedcontent != ''"
|
||||
style="
|
||||
background-color: red;
|
||||
color: white;
|
||||
padding: 0 5px;
|
||||
border-radius: 5px;
|
||||
"
|
||||
>
|
||||
{{ stuItem.feedcontent.replace('#', '、') }}
|
||||
</span>
|
||||
</span>
|
||||
<span v-else>
|
||||
<!-- 选择题类型:学生答题转换为 ABCD格式 -->
|
||||
<span
|
||||
v-if="stuItem.feedcontent != ''"
|
||||
style="
|
||||
background-color: red;
|
||||
color: white;
|
||||
padding: 0 5px;
|
||||
border-radius: 5px;
|
||||
"
|
||||
>
|
||||
{{
|
||||
JSON.parse(quItem.workdesc)
|
||||
.map((item, index) => {
|
||||
if (item == stuItem.feedcontent) {
|
||||
return String.fromCharCode(65 + Number(index))
|
||||
}
|
||||
})
|
||||
.filter(Boolean)[0]
|
||||
}}
|
||||
</span>
|
||||
<span>学生答案:
|
||||
<span v-if="stuItem.feedcontent !=''" style="background-color: red; color: white; padding: 0 5px; border-radius: 5px;">
|
||||
{{ formatFeedContent(stuItem, quItem) }}
|
||||
</span>
|
||||
</span>
|
||||
</el-col>
|
||||
|
@ -499,6 +456,7 @@ import { ElMessageBox, ElMessage } from 'element-plus'
|
|||
import { updateClassworkeval, updateClassworkdata } from '@/api/classTask'
|
||||
import { getTimeDate } from '@/utils/date'
|
||||
import ReFilePreview from '@/components/refile-preview/index.vue'
|
||||
import { quizStrToList } from '@/utils/comm';
|
||||
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
@ -842,6 +800,47 @@ const acceptParams = (params) => {
|
|||
analysisScoreOpen.value = true
|
||||
}
|
||||
|
||||
const formatWorkAnswer = (quItem) => {
|
||||
let format = '';
|
||||
if (!Array.isArray(quItem.workanswerFormat)) {
|
||||
format = quItem.workanswerFormat.replace(/<[^>]+>/g, '')
|
||||
} else {
|
||||
format = quItem.workanswerFormat.map(item => item.replace(/<[^>]+>/g, '')).join('、');
|
||||
}
|
||||
return format;
|
||||
}
|
||||
// 根据题型处理学生答案
|
||||
const formatFeedContent = (stuItem, quItem) => {
|
||||
let format = '';
|
||||
|
||||
if (quItem.workdesc == '' || quItem.workdesc == '[]') {
|
||||
// 非单选题和多选题
|
||||
const arr = stuItem.feedcontent.split('#');
|
||||
return arr.map(item => {
|
||||
if (item == '') {
|
||||
item = '空';
|
||||
}
|
||||
return item;
|
||||
}).join('、');
|
||||
}else {
|
||||
const list = quizStrToList(quItem.workdesc);
|
||||
format = list.map((item,index) =>{
|
||||
if (quItem.worktype == '单选题') {
|
||||
const workdesc = item.replace(/<[^>]*>/g,'');
|
||||
const feedcontent = stuItem.feedcontent.replace(/<[^>]*>/g,'');
|
||||
if(workdesc == feedcontent){
|
||||
return (String.fromCharCode(65+Number(index)))
|
||||
}
|
||||
} else if (quItem.worktype == '多选题') {
|
||||
const arr = stuItem.feedcontent.split(',');
|
||||
return arr.map(item => String.fromCharCode(65+Number(item))).join('');
|
||||
}
|
||||
}).filter(Boolean)[0];
|
||||
}
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
// 提交批改评分
|
||||
const onClassWorkFormScoreSave = () => {
|
||||
console.log(classWorkFormScore)
|
||||
|
|
|
@ -383,7 +383,7 @@ const getClassWorkStudentList = (rowId) => {
|
|||
// 默认获取已交的学生列表
|
||||
tableRadio.list =
|
||||
classWorkAnalysis.classworkdata &&
|
||||
classWorkAnalysis.classworkdata.filter((item) => item.resultcount > 0)
|
||||
classWorkAnalysis.classworkdata.filter((item) => item.finishtimelength != '0')
|
||||
tableRadio.value = '1'
|
||||
tableRadio.num0 = classWorkAnalysis.classworkdata.length - tableRadio.list.length
|
||||
tableRadio.num1 = tableRadio.list.length
|
||||
|
@ -506,12 +506,12 @@ const tableRadioChange = (e) => {
|
|||
console.log(e,'??????')
|
||||
console.log("学生列表:", classWorkAnalysis.classworkdata)
|
||||
if(e=='1'){
|
||||
tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.resultcount > 0)
|
||||
tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.finishtimelength != '0')
|
||||
tableRadio.value = '1';
|
||||
tableRadio.num0 = classWorkAnalysis.classworkdata.length - tableRadio.list.length;
|
||||
tableRadio.num1 = tableRadio.list.length;
|
||||
}else if(e=='0'){
|
||||
tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.resultcount == 0)
|
||||
tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.finishtimelength == '0')
|
||||
tableRadio.value = '0';
|
||||
tableRadio.num0 = tableRadio.list.length;
|
||||
tableRadio.num1 = classWorkAnalysis.classworkdata.length - tableRadio.list.length;
|
||||
|
|
Loading…
Reference in New Issue