From ef75fb75705689af73c3342124cd70093cfc8517 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com>
Date: Tue, 22 Oct 2024 14:47:49 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E8=AF=95=E9=A2=98=E6=A0=BC=E5=BC=8F?=
=?UTF-8?q?=E5=8C=96=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/renderer/src/hooks/useProcessList.js | 84 ++++++++++++++----------
1 file changed, 51 insertions(+), 33 deletions(-)
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
--
2.44.0.windows.1
From cca640e945168a27d77ae2e92975aa9684eb26d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com>
Date: Tue, 22 Oct 2024 16:45:55 +0800
Subject: [PATCH 2/3] =?UTF-8?q?[=E9=80=90=E9=A2=98=E8=AE=B2=E8=AF=84]=20-?=
=?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E5=8F=B3=E4=BE=A7=E8=AF=95=E9=A2=98?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../views/classTask/container/item-dialog.vue | 1 +
.../views/classTask/container/quizStats.vue | 83 ++++++++++++++++---
.../src/views/classTask/teachClassTask.vue | 1 +
3 files changed, 72 insertions(+), 13 deletions(-)
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..70a5c8c 100644
--- a/src/renderer/src/views/classTask/container/quizStats.vue
+++ b/src/renderer/src/views/classTask/container/quizStats.vue
@@ -1,9 +1,9 @@
-
-
+
+
-
+
{{item.def?.titletext}}
@@ -54,13 +54,13 @@
-
+
-
提交情况
+
-
+
+
+ 试题详情
+
+
+
+
+
+ {{ activeExam.worktag }}
+
+
+
+
+
+
+
+
+ 【答案】
+
+ 【分析】
+
+ 【解答】
+
+ 【点评】
+
+
+
+
+
+
+
+
+
+
+
@@ -84,7 +118,9 @@ import { ref, defineExpose, onMounted, reactive, computed, watch, nextTick, watc
// import * as elementPlus from 'element-plus' // ElMessage ElMessageBox
let colorArr = [] // 进度颜色值 -- 静态数据
// const attrs = useAttrs() // props中未定义属性
-const activeTopic = ref(0) // 展开的题
+const activeTopic = ref(1) // 展开的题
+const activeExam = ref({}) // 展开的试题
+const activeExamFlag = ref(['1']) // 展开的试题
let dataList = ref([]) // 左侧数据
let studentList = ref([]) // 学生数据
const props = defineProps({ // 参数 defineProps
@@ -115,7 +151,10 @@ colorArr = [
// === 初始加载完 ===
onMounted(() => {
- activeTopic.value = dataList.value.map((_, index) => index + 1);
+ //activeTopic.value = dataList.value.map((_, index) => index + 1);
+ if (dataList.value[activeTopic.value-1].def != null && dataList.value[activeTopic.value-1].def != undefined) {
+ activeExam.value = dataList.value[activeTopic.value-1].def;
+ }
})
// === 方法(methods) ===
@@ -285,6 +324,18 @@ const clickInfo = async ind => {
setTimeout(() => {scrollToElement('collapse-' + ind)}, 300);
// elementPlus.ElMessage.warning('功能未开放!')
}
+
+// 点击试题
+const clickItem = async (index) => {
+ if (index > dataList.length-1 ) {
+ return
+ }
+ if (dataList.value[index].def == null || dataList.value[index].def == undefined) {
+ return;
+ }
+ activeExam.value = dataList.value[index].def;
+}
+
// === 通用工具 ===
// 滚动到指定位置
const scrollToElement = id => {
@@ -313,8 +364,14 @@ watchEffect(() => { initData() })
background: #F2F3F5;
height: 100%;
margin: 0 !important;
- .left{padding-left: 0 !important; height: 100%;}
- .right{padding-right: 0 !important;}
+ .left{
+ padding-left: 0 !important;
+ height: 100%;
+ }
+ .right{
+ padding-right: 0 !important;
+ height: 100%;
+ }
.c-item{
padding: 10px;
background: #fff;
@@ -362,7 +419,7 @@ watchEffect(() => { initData() })
margin-bottom: 10px;
}
.respond{
- height: calc(100% - 65px);
+ /* height: calc(100% - 65px);*/
overflow: auto;
.el-space{padding: 5px;}
.card-warp{
diff --git a/src/renderer/src/views/classTask/teachClassTask.vue b/src/renderer/src/views/classTask/teachClassTask.vue
index 76d80c9..86f5bbb 100644
--- a/src/renderer/src/views/classTask/teachClassTask.vue
+++ b/src/renderer/src/views/classTask/teachClassTask.vue
@@ -248,6 +248,7 @@ const openDialog = (data) => {
}
classWorkAnalysis.quizlist = idres.rows
classWorkActiveData.quizlist = idres.rows // zdg: 作业概览组件使用
+ processList(classWorkActiveData.quizlist);
// 统计每个题目的正误率
// 这个学习任务所有题目+所有学生的答题数据 , pageSize: 100
--
2.44.0.windows.1
From 6112cc8a926d3f3af6e52a09afb02dbf6b5314b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com>
Date: Tue, 22 Oct 2024 16:50:42 +0800
Subject: [PATCH 3/3] 1
---
src/renderer/src/views/classTask/container/quizStats.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/renderer/src/views/classTask/container/quizStats.vue b/src/renderer/src/views/classTask/container/quizStats.vue
index 70a5c8c..30631b3 100644
--- a/src/renderer/src/views/classTask/container/quizStats.vue
+++ b/src/renderer/src/views/classTask/container/quizStats.vue
@@ -74,7 +74,7 @@
试题详情
-
+
@@ -85,7 +85,7 @@
-
+
【答案】
--
2.44.0.windows.1