diff --git a/src/renderer/src/api/classTask/index.js b/src/renderer/src/api/classTask/index.js
index bf03614..a01867e 100644
--- a/src/renderer/src/api/classTask/index.js
+++ b/src/renderer/src/api/classTask/index.js
@@ -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({
diff --git a/src/renderer/src/views/classTask/container/classOverview.vue b/src/renderer/src/views/classTask/container/classOverview.vue
index 8ce866b..c3992f3 100644
--- a/src/renderer/src/views/classTask/container/classOverview.vue
+++ b/src/renderer/src/views/classTask/container/classOverview.vue
@@ -147,8 +147,12 @@ const initData = () => {
})
}
else if (o.worktype == '填空题') { // 填空题
- const regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容
- children = (o.title||'').match(regex).map((v,i) => {
+ let title = o.title.replace(/_{3,}/g, '_____'); //将3-10的下划线统一格式为5个
+ let regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容
+ if (title.indexOf('_____') != -1) {
+ regex = /_{5}/g // 定义正则表达式,匹配 xxx 格式的内容
+ }
+ children = (title||'').match(regex).map((v,i) => {
const def = `填空项 ${i+1}`
//const code = '( )'
const code = '(略)', txt=v
diff --git a/src/renderer/src/views/classTask/container/classOverview/knowledge.vue b/src/renderer/src/views/classTask/container/classOverview/knowledge.vue
index 0ed7dd4..02ec2a9 100644
--- a/src/renderer/src/views/classTask/container/classOverview/knowledge.vue
+++ b/src/renderer/src/views/classTask/container/classOverview/knowledge.vue
@@ -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()
})
diff --git a/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue b/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue
index 044f98e..e00d892 100644
--- a/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue
+++ b/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue
@@ -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: '提交成功!'
diff --git a/src/renderer/src/views/classTask/container/quizStats.vue b/src/renderer/src/views/classTask/container/quizStats.vue
index cd824c9..da72dcc 100644
--- a/src/renderer/src/views/classTask/container/quizStats.vue
+++ b/src/renderer/src/views/classTask/container/quizStats.vue
@@ -224,8 +224,13 @@ const initData = () => {
})
}
else if (o.worktype == '填空题') { // 填空题
- const regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容
- children = (o.title||'').match(regex).map((v,i) => {
+ //console.log('填空题->', o.title);
+ let title = o.title.replace(/_{3,}/g, '_____'); //将3-10的下划线统一格式为5个
+ let regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容
+ if (title.indexOf('_____') != -1) {
+ regex = /_{5}/g // 定义正则表达式,匹配 xxx 格式的内容
+ }
+ children = (title||'').match(regex).map((v,i) => {
const def = `填空项 ${i+1}`
//const code = '( )'
const code = '(略)', txt=v
diff --git a/src/renderer/src/views/classTask/teachClassTask.vue b/src/renderer/src/views/classTask/teachClassTask.vue
index b58394b..2ae3647 100644
--- a/src/renderer/src/views/classTask/teachClassTask.vue
+++ b/src/renderer/src/views/classTask/teachClassTask.vue
@@ -82,25 +82,25 @@
{{scope.row.getScore || 0}}
-
+
-
+
待批阅
- 完美
- 优秀
- 良好
- 及格
- 不及格
@@ -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 = ''