This commit is contained in:
zdg 2024-10-31 15:07:16 +08:00
commit eafdb718b6
6 changed files with 72 additions and 41 deletions

View File

@ -71,6 +71,16 @@ export function updateClassworkeval(data) {
})
}
// 修改classworkeval
export function updateClassworkevalList(data) {
return request({
url: '/education/classworkeval/updateList',
method: 'put',
data: data
})
}
// 修改classworkdata
export function updateClassworkdata(data) {
return request({

View File

@ -147,8 +147,12 @@ const initData = () => {
})
}
else if (o.worktype == '填空题') { //
const regex = /<!--BA-->(.*?)<!--EA-->/g // <!--BA-->xxx<!--EA-->
children = (o.title||'').match(regex).map((v,i) => {
let title = o.title.replace(/_{3,}/g, '_____'); //3-10线5
let regex = /<!--BA-->(.*?)<!--EA-->/g // <!--BA-->xxx<!--EA-->
if (title.indexOf('_____') != -1) {
regex = /_{5}/g // <!--BA-->xxx<!--EA-->
}
children = (title||'').match(regex).map((v,i) => {
const def = `填空项 ${i+1}`
//const code = '(&emsp;)'
const code = '(略)', txt=v

View File

@ -27,7 +27,9 @@ const tableData = ref([])
const konwledge = ref([])
const hasStudents = ref([])
//
const allScore = ref([])
const allScore = ref(0)
//
const avatarScore = ref()
//
const getKonwledge = () => {
const getScoreRate = []
@ -41,7 +43,7 @@ const getKonwledge = () => {
if(!ledges.includes(title.id)){
ledges.push(title.id)
// 0
konwledge.value.push({title:title.title,allPoint:allScore.value,id:title.id})
konwledge.value.push({title:title.title,allPoint:allScore.value,id:title.id,point:avatarScore.value})
}
//
if(useOverview.allData[0].hasAnswers.includes(item.studentid))
@ -51,29 +53,12 @@ const getKonwledge = () => {
//
konwledge.value.forEach(item => {
let sunRate = 0
let num = 0
if(getScoreRate.length === 0) return
getScoreRate.forEach(item2 => {
if(item.id === item2.id){
sunRate += extractedNumber(item2.rate)
num ++
}
})
const scoreRate = sunRate / num
tableData.value.push({
scoingRate:scoreRate.toFixed(2),
scoingRate:(item.point / item.allPoint * 100).toFixed(2),
...item,
point:(item.allPoint * scoreRate / 100).toFixed(2)
})
})
}
//
const extractedNumber = (score) => {
const match = score.match(/\d+/);
return match ? parseInt(match[0], 10) : null;
}
//tableList
watch(() => useOverview.tableList,() => {
@ -93,6 +78,15 @@ watch(() => useOverview.tableList,() => {
allScore.value = useOverview.allData.reduce((acc, cur) => {
return acc + Number(cur.score)
},0)
//
const studentList = useOverview.tableList.filter(item => useOverview.allData[0].hasAnswers.includes(item.studentid))
avatarScore.value = studentList.reduce((acc, cur) => {
return acc + Number(cur.getScore)
},0) / studentList.length
console.log(avatarScore.value,'useOverview.tableList');
//
getKonwledge()
})
</script>

View File

@ -427,7 +427,7 @@ import useUserStore from '@/store/modules/user'
import { ref, reactive } from 'vue'
// import { Plus } from '@element-plus/icons-vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import { updateClassworkeval, updateClassworkdata, getClassworkdata } from '@/api/classTask'
import { updateClassworkeval, updateClassworkdata, getClassworkdata, updateClassworkevalList } from '@/api/classTask'
import { getTimeDate } from '@/utils/date'
import ReFilePreview from '@/components/refile-preview/index.vue'
import { quizStrToList } from '@/utils/comm';
@ -898,6 +898,21 @@ const onSubmit = () => {
// }
})
})
// let queryList = [];
// classWorkFormScore.teacherRating && classWorkFormScore.teacherRating.map((item, index) => {
// const queryParams = {
// id: item.id,
// teacherRating: item.score, //
// rating: classWorkFormScore.rating, //
// teacherremark: classWorkFormScore.teacherremark, //
// timestamp: getTimeDate() //
// }
// //console.log(queryParams);
// queryList.push(queryParams);
// })
// //console.log(queryList);
// updateClassworkevalList(queryList).then((res) => {
// })
ElMessage({
type: 'success',
message: '提交成功!'

View File

@ -224,8 +224,13 @@ const initData = () => {
})
}
else if (o.worktype == '填空题') { //
const regex = /<!--BA-->(.*?)<!--EA-->/g // <!--BA-->xxx<!--EA-->
children = (o.title||'').match(regex).map((v,i) => {
//console.log('->', o.title);
let title = o.title.replace(/_{3,}/g, '_____'); //3-10线5
let regex = /<!--BA-->(.*?)<!--EA-->/g // <!--BA-->xxx<!--EA-->
if (title.indexOf('_____') != -1) {
regex = /_{5}/g // <!--BA-->xxx<!--EA-->
}
children = (title||'').match(regex).map((v,i) => {
const def = `填空项 ${i+1}`
//const code = '(&emsp;)'
const code = '(略)', txt=v

View File

@ -82,25 +82,25 @@
<span style="color: #2196f3">{{scope.row.getScore || 0}}</span>
</template>
</el-table-column>
<el-table-column label="批阅状态" prop="teacherRating" align="center" width="120" sortable>
<el-table-column label="批阅状态" prop="rating" align="center" width="120" sortable>
<template #default="scope">
<template v-if="scope.row.teacherRating == 0">
<template v-if="scope.row.rating == 0">
<span v-if="tableRadio.value==1" style="color: #2196f3">待批阅</span>
</template>
<!-- 1- 2-优减 3- 4-良减 5- -->
<template v-if="scope.row.teacherRating == 1"
<template v-if="scope.row.rating == 1"
><el-tag type="danger">完美</el-tag></template
>
<template v-if="scope.row.teacherRating == 2"
<template v-if="scope.row.rating == 2"
><el-tag type="danger">优秀</el-tag></template
>
<template v-if="scope.row.teacherRating == 3"
<template v-if="scope.row.rating == 3"
><el-tag type="warning">良好</el-tag></template
>
<template v-if="scope.row.teacherRating == 4"
<template v-if="scope.row.rating == 4"
><el-tag type="info">及格</el-tag></template
>
<template v-if="scope.row.teacherRating == 5"
<template v-if="scope.row.rating == 5"
><el-tag type="info">不及格</el-tag></template
>
</template>
@ -345,7 +345,7 @@ const getClassWorkStudentList = (rowId) => {
}
// 0
response.rows[i].teacherRating = 0
response.rows[i].rating = 0
//
if (
@ -371,21 +371,23 @@ const getClassWorkStudentList = (rowId) => {
score += evalarray[e].score;
evalarray[e].teacherRating = evalarray[e].score
}
}
}
const allScore = evalarray.reduce((acc, cur) => acc + cur.score, 0)
const allTeacherRating = evalarray.reduce((acc, cur) => acc + cur.teacherRating, 0) //
//console.log(evalarray, 'evalarray------------------------------------')
if (feedcount > 0) {
// : /*100
response.rows[i].scoingRate = ((score / allScore) * 100).toFixed(0) + '%'
response.rows[i].getScore = score
response.rows[i].scoingRate = ((score / allTeacherRating) * 100).toFixed(0) + '%'
response.rows[i].getScore = allTeacherRating
} else {
response.rows[i].scoingRate = '0%'
response.rows[i].getScore = 0
}
// :
if (evalarray[0].rating != '') {
response.rows[i].teacherRating = evalarray[0].rating
response.rows[i].rating = evalarray[0].rating
}
} else {
response.rows[i].scoingRate = '0%'
@ -420,7 +422,7 @@ const teacherCriticism = ()=>{
tableRadio.list = tableRadio.list.map((item) => {
return {
...item,
teacherRating : item.teacherRating || checkWorkType(item)
rating : item.rating || checkWorkType(item)
}
})
}
@ -675,10 +677,11 @@ const handleClassOverviewOpen = (type) =>{
}
}
})
const allScore = allTopic.reduce((acc, cur) => {
return acc + cur.score;
const allTeacherRating = allTopic.reduce((acc, cur) => {
return acc + cur.teacherRating;
},0)
rightAnswer > 0?item.scoingRate = (score/allScore * 100).toFixed(0):item.scoingRate = ''
rightAnswer > 0?item.scoingRate = (score/allTeacherRating * 100).toFixed(0):item.scoingRate = ''
item.getScore = score
}else{
item.scoingRate = ''