From 3705d435088fe1b8abdf16b6e96c121319ef3bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=B2=A9?= Date: Thu, 21 Aug 2025 10:28:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=9A=E7=94=A8=E7=AD=94?= =?UTF-8?q?=E9=A2=98=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examination/radio-subject-item.vue | 7 +- src/components/examination/radio-subject.vue | 36 ++-- src/components/examination/subject.vue | 187 ++++++++++-------- src/pages/examination/index.vue | 11 +- 4 files changed, 139 insertions(+), 102 deletions(-) diff --git a/src/components/examination/radio-subject-item.vue b/src/components/examination/radio-subject-item.vue index 1af98956..db2f29c8 100644 --- a/src/components/examination/radio-subject-item.vue +++ b/src/components/examination/radio-subject-item.vue @@ -31,8 +31,8 @@ required: false, }, my_answer: { - type: String, - defauft:'' + type: Array, + default: () => [] } }); const select_status = computed(() => { @@ -40,8 +40,9 @@ if (props.analysisVo.correctFlag === 'R') return 'success'; // 是错误答案但是被用户错误选中的为红 console.log('props.my_answer', props.my_answer); - const my_answer_array = props.my_answer.split(','); + const my_answer_array = props.my_answer; if(my_answer_array.includes(props.analysisVo.itemId) && props.analysisVo.correctFlag === 'E') return 'error'; + // 只有被我选中,不知是正确还是错误的为蓝 if(my_answer_array.includes(props.analysisVo.itemId)) return 'primary'; // 什么都不是者为灰色 diff --git a/src/components/examination/radio-subject.vue b/src/components/examination/radio-subject.vue index 8f4445da..2aaeddf3 100644 --- a/src/components/examination/radio-subject.vue +++ b/src/components/examination/radio-subject.vue @@ -24,7 +24,7 @@ + :analysisVo="analysisVo" :my_answer="props.item.my_answer" :mode="props.mode"> @@ -66,6 +66,7 @@ type: String, required: true, }, + // 是否预览模式 isPreview:{ type: Boolean, default: false @@ -92,29 +93,30 @@ qnsContent: props.item.qnsContent, qnsTyp: props.item.qnsTyp, }) - + const item_answer = ref(props.item?.my_answer.split(',')) // 题类型 const subject_type_text = computed(() => SUBJECT_TYPE.find(res => subject_data.qnsTyp === res.value)?.label || '') // 点击答题 const click_option = (analysisVo) => { - // // // 无论什么类型如果表里已经有了,再次点击就是弹出 - // if (props.item.my_answer.includes(analysisVo.itemId)) { - // props.item.my_answer = props.item.my_answer.filter(id => id !== analysisVo.itemId); - // } else if (props.item.qnsTyp === 'SN') { // 单选 - // // 单选插入,并且移除其他 - // props.item.my_answer[0] = analysisVo.itemId - // muCheckbox() - // } else if (props.item.qnsTyp === 'MU') { // 多选题 - // // 多选直接插入 - // props.item.my_answer.push(analysisVo.itemId) - // } else if (props.item.qnsTyp === 'JD') { // 判断题 - // // 判断插入,并且移除其他 - // props.item.my_answer = [analysisVo.itemId] - // muCheckbox() - // } + // // 无论什么类型如果表里已经有了,再次点击就是弹出 + if (props.item.my_answer.includes(analysisVo.itemId)) { + // props.item.my_answer = props.item.my_answer.filter(id => id !== analysisVo.itemId); + } else if (props.item.qnsTyp === 'SN') { // 单选 + // 单选插入,并且移除其他 + // props.item.my_answer[0] = analysisVo.itemId + muCheckbox() + } else if (props.item.qnsTyp === 'MU') { // 多选题 + // 多选直接插入 + // props.item.my_answer.push(analysisVo.itemId) + } else if (props.item.qnsTyp === 'JD') { // 判断题 + // 判断插入,并且移除其他 + // props.item.my_answer = [analysisVo.itemId] + muCheckbox() + } } + const muCheckbox = () => { emit('subject_click', 'answer', { qnsTyp: props.item.qnsTyp, diff --git a/src/components/examination/subject.vue b/src/components/examination/subject.vue index abd58d6a..74af4beb 100644 --- a/src/components/examination/subject.vue +++ b/src/components/examination/subject.vue @@ -2,17 +2,17 @@ - {{subject_type_text}} - - - 5分 - - - + {{ subject_type_text }} + 5分 + - + - - 确定 + + + 确定 + \ No newline at end of file + diff --git a/src/pages/examination/index.vue b/src/pages/examination/index.vue index f858381f..58e71bee 100644 --- a/src/pages/examination/index.vue +++ b/src/pages/examination/index.vue @@ -41,7 +41,7 @@ - +