main
unknown 2024-04-30 13:49:11 +08:00
parent 2a633adb5f
commit d493730d19
1 changed files with 56 additions and 40 deletions

View File

@ -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 @@
<view class="flex items-center">
<view>{{ op.text }}</view>
<uv-icon
v-if="op.selected || op.is_true"
:color="op.is_true&&op.selected ? '#4caf50' : '#ee2c37'"
:name="op.is_true&&op.selected ? 'checkbox-mark' : 'close'"
v-if="(op.selected || op.is_true)&& readonly"
:color="
op.is_true && op.selected ? '#4caf50' : '#ee2c37'
"
:name="
op.is_true && op.selected ? 'checkbox-mark' : 'close'
"
></uv-icon>
</view>
</uv-checkbox>
@ -78,7 +84,7 @@
<view class="flex items-center">
<view>{{ op.text }}</view>
<uv-icon
v-if="op.selected"
v-if="op.selected && readonly"
:color="op.is_true ? '#ee2c37' : '#5ac725'"
:name="op.is_true ? 'checkbox-mark' : 'close'"
></uv-icon>
@ -87,30 +93,38 @@
</uv-radio-group>
<template v-else>
<uv-checkbox-group
activeColor="#ee2c37"
v-model="item.answer"
placement="column"
>
<uv-checkbox
:customStyle="{ margin: '8px' }"
v-for="(op, i) in item.options"
:activeColor="
(op.selected!=op.is_true && op.selected) ? '#e3e3e3' : '#3678f7'
"
:key="i"
:label="op.text"
:name="i"
activeColor="#ee2c37"
v-model="item.answer"
placement="column"
>
<view class="flex items-center">
<view>{{ op.text }}</view>
<uv-icon
v-if="op.selected || op.is_true"
:color="op.is_true&&op.selected ? '#4caf50' : '#ee2c37'"
:name="op.is_true&&op.selected ? 'checkbox-mark' : 'close'"
></uv-icon>
</view>
</uv-checkbox>
</uv-checkbox-group>
<uv-checkbox
:customStyle="{ margin: '8px' }"
v-for="(op, i) in item.options"
:activeColor="
op.selected != op.is_true && op.selected
? '#e3e3e3'
: '#3678f7'
"
:key="i"
:label="op.text"
:name="i"
>
<view class="flex items-center">
<view>{{ op.text }}</view>
<uv-icon
v-if="(op.selected || op.is_true) && readonly"
:color="
op.is_true && op.selected ? '#4caf50' : '#ee2c37'
"
:name="
op.is_true && op.selected
? 'checkbox-mark'
: 'close'
"
></uv-icon>
</view>
</uv-checkbox>
</uv-checkbox-group>
</template>
</template>
</view>
@ -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 || []
})