From d493730d1912d09b4e75826b095ce4c5eb9d737d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Apr 2024 13:49:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/examination/detail.vue | 96 +++++++++++++++++++------------- 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/src/pages/examination/detail.vue b/src/pages/examination/detail.vue index cf16c27..8c6f4c0 100644 --- a/src/pages/examination/detail.vue +++ b/src/pages/examination/detail.vue @@ -44,7 +44,9 @@ :customStyle="{ margin: '8px' }" v-for="(op, i) in item.options" :activeColor=" - (op.selected!=op.is_true && op.selected) ? '#e3e3e3' : '#3678f7' + op.selected != op.is_true && op.selected + ? '#e3e3e3' + : '#3678f7' " :key="i" :label="op.text" @@ -53,9 +55,13 @@ {{ op.text }} @@ -78,7 +84,7 @@ {{ op.text }} @@ -87,30 +93,38 @@ @@ -148,19 +162,21 @@ const loading = ref(false) const list = computed(() => { const content = info.value?.content ?? [] content.forEach((item) => { - const trueIndices = item.options.reduce((indices, item, index) => { - if (item.is_true || item.selected) { - indices.push(index) + if (readonly.value) { + const trueIndices = item.options.reduce((indices, item, index) => { + if (item.is_true || item.selected) { + indices.push(index) + } + return indices + }, []) + item.answer = trueIndices + } else { + if (item.cate == 1) { + item.answer = item.user_answer?.[0] ?? '' + } else { + item.answer = item.user_answer ?? [] } - return indices - }, []) - - item.answer = trueIndices - // if (item.cate == 1) { - // item.answer = item.user_answer?.[0] ?? '' - // } else { - // item.answer = item.user_answer ?? [] - // } + } }) return info.value.content || [] })