diff --git a/src/renderer/src/hooks/useProcessList.js b/src/renderer/src/hooks/useProcessList.js index 1a1ca4f..e7329eb 100644 --- a/src/renderer/src/hooks/useProcessList.js +++ b/src/renderer/src/hooks/useProcessList.js @@ -15,9 +15,10 @@ export const isJson = (str) => { /** * @description processList 格式化试题 - * @param {*} row + * @param {*} row + * @param {*} aloneOption 选择题中选项是否为每行一个 */ -export const processList = (row) => { +export const processList = (row, aloneOption=false) => { for (var i = 0; i < row.length; i++) { if (isJson(row[i].workanalysis)) { //1、先默认格式化 格式化各项内容(待优化, 后续界面显示的为format的值) @@ -55,19 +56,25 @@ export const processList = (row) => { const workDescArr = element.split('#&') let tmp = '' let j = 0 - for (; j < workDescArr.length; j++) { - if (j % 2 == 0) { - tmp += `
` + for(; j${char}.${workDescArr[j]}
`; } - const char = String.fromCharCode(65 + j) - tmp += `
${char}.${workDescArr[j]}
` - if (j % 2 == 1) { - tmp += '' + else { + if(j%2 == 0){ + tmp += `
`; + } + + tmp += `
${char}.${workDescArr[j]}
`; + if(j%2 == 1){ + tmp += '
'; + } } } // j此刻已自增1, 故当选项为单数时, 需要补充结束标签 - if (j % 2 == 1) { - tmp += '' + if(!aloneOption && j%2 == 1){ + tmp += ''; } // workDescArr为 [''] 表示为 判断题或者填空题,这里不需要选项 @@ -136,31 +143,36 @@ export const processList = (row) => { * ] */ let workDescArr = JSON.parse(row[i].workdesc) - let workDescHtml = `
` workDescArr.map((item, index) => { if (item.type == '单选题' || item.type == '多选题') { - workDescHtml += `
${index + 1}. ${item.title}
` + workDescHtml += `
${index + 1}. ${item.title}
` let tmp = '' let j = 0 let optionsArr = item.options - for (; j < optionsArr.length; j++) { - if (j % 2 == 0) { - tmp += `
` + for(; j${char}.${optionsArr[j]}
`; } - const char = String.fromCharCode(65 + j) - tmp += `
${char}.${optionsArr[j]}
` - if (j % 2 == 1) { - tmp += '
' + else { + if(j%2 == 0){ + tmp += `
`; + } + + tmp += `
${char}.${optionsArr[j]}
`; + if(j%2 == 1){ + tmp += '
'; + } } } // j此刻已自增1, 故当选项为单数时, 需要补充结束标签 - if (j % 2 == 1) { - tmp += '' + if(!aloneOption && j%2 == 1){ + tmp += ''; } - workDescHtml += tmp } else if (item.type == '填空题' || item.type == '判断题' || item.type == '主观题') { - workDescHtml += `
${index + 1}. ${item.title}
` + workDescHtml += `
${index + 1}. ${item.title}
` } }) workDescHtml += '' @@ -265,18 +277,24 @@ export const processList = (row) => { // 处理[选项显示] - 拼接ABCD首序号 let tmp = '' let j = 0 - for (; j < workDescArr.length; j++) { - if (j % 2 == 0) { - tmp += `
` + for(; j${char}.${workDescArr[j]}
`; } - const char = String.fromCharCode(65 + j) - tmp += `
${char}.${workDescArr[j]}
` - if (j % 2 == 1) { - tmp += '' + else { + if(j%2 == 0){ + tmp += `
`; + } + + tmp += `
${char}.${workDescArr[j]}
`; + if(j%2 == 1){ + tmp += '
'; + } } } - if (j % 2 == 0) { - tmp += '' + if(!aloneOption && j%2== 0){ + tmp += ''; } row[i].workdescFormat = tmp 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 0c5bdbe..e8d2475 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 @@ -1,7 +1,7 @@ + - - - - + + + + @@ -975,23 +941,23 @@ defineExpose({ } .score-circle { - width: 30px; - height: 30px; - border-radius: 50%; - background-color: pink; - color: red; - display: flex; - justify-content: center; - align-items: center; - font-size: 13px; - margin: 0 10px; + border: 1px solid rgb(131,131,131,.5); + padding: 5px 0; + background-color: #fff; cursor: pointer; - transition: background-color 0.3s; + margin-right: 5px; + width: 60px; + text-align: center; } .score-circle.active { - background-color: red; + background-color: rgb(253, 236, 224); color: white; + border: 1px solid rgb(253, 236, 224); +} +.greenLine{ + border-left: 5px solid rgb(14, 209, 22); + padding-left: 5px } .card-header{ diff --git a/src/renderer/src/views/classTask/container/item-dialog.vue b/src/renderer/src/views/classTask/container/item-dialog.vue index 819082e..7f7423d 100644 --- a/src/renderer/src/views/classTask/container/item-dialog.vue +++ b/src/renderer/src/views/classTask/container/item-dialog.vue @@ -261,6 +261,7 @@ const openDialog = (data) => { } classWorkAnalysis.quizlist = idres.rows classWorkActiveData.quizlist = idres.rows // zdg: 作业概览组件使用 + processList(classWorkActiveData.quizlist); // 统计每个题目的正误率 // 这个学习任务所有题目+所有学生的答题数据 , pageSize: 100 diff --git a/src/renderer/src/views/classTask/container/quizStats.vue b/src/renderer/src/views/classTask/container/quizStats.vue index de5b73b..30631b3 100644 --- a/src/renderer/src/views/classTask/container/quizStats.vue +++ b/src/renderer/src/views/classTask/container/quizStats.vue @@ -1,9 +1,9 @@