239 lines
5.4 KiB
Vue
239 lines
5.4 KiB
Vue
<template>
|
||
<view class="item">
|
||
<view class="top">
|
||
<view class="type">{{ subject_type_text }}</view>
|
||
<view class="score">{{ item.tgtGrade }}分</view>
|
||
<view class="fl1"></view>
|
||
<view class="right" v-if="[''].includes(props.mode)">
|
||
<view class="right_text">展开</view>
|
||
<uv-icon class="arrow-icon" name="arrow-right"></uv-icon>
|
||
</view>
|
||
</view>
|
||
<view class="text">{{ item.qnsContent }}</view>
|
||
<view class="additional_div">
|
||
<view class="option_div">
|
||
<radioSubjectItem v-for="(analysisVo,index) in item.itemVos" @click_option="click_option" :key="index"
|
||
:analysisVo="analysisVo" :my_answer="props.item.anserResult" :backend_answer="[]">
|
||
</radioSubjectItem>
|
||
|
||
<!-- <view class="option_item success">
|
||
<view class="text">A.这里是选项 A 的内容</view>
|
||
<image class="img" src="@/static/images/common/success.png" mode="heightFix"></image>
|
||
</view>
|
||
<view class="option_item success">
|
||
<view class="text">B.这里是选项 B 的内容</view>
|
||
<image class="img" src="@/static/images/common/success.png" mode="heightFix"></image>
|
||
</view>
|
||
<view class="option_item error">
|
||
<view class="text">C.这里是选项 C 的内容</view>
|
||
<image class="img" src="@/static/images/common/success.png" mode="heightFix"></image>
|
||
</view>
|
||
<view class="option_item info">D.这里是选项D的内容</view> -->
|
||
</view>
|
||
<view class="analysis_div">
|
||
<view class="analysis_title">
|
||
<view class="success_answer">正确答案:{{ correctResultLabel.join('') }}</view>
|
||
|
||
<view class="your_answer">
|
||
你的答案:
|
||
<text class="red_color">{{ myResultLabel.join('') }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="analysis_note">
|
||
题目解析:{{item.analyContent}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import radioSubjectItem from '@/components/examination/radio-subject-item.vue'
|
||
import { SUBJECT_TYPE } from '@/enum.js';
|
||
import { ref, reactive, computed, onMounted, nextTick, getCurrentInstance } from 'vue';
|
||
const props = defineProps({
|
||
item: {
|
||
type: Object,
|
||
required: true
|
||
},
|
||
mode: {
|
||
type: String,
|
||
required: true,
|
||
validator: (value) => {
|
||
// 考试: examination 练习: practice 错题本: mistake 学习: study
|
||
return ['examination', 'practice', 'mistake', 'study'].includes(value);
|
||
}
|
||
}
|
||
});
|
||
// 试题类型
|
||
const qnsTyp = computed(() => props.item.qnsTyp);
|
||
// 正确答案选项
|
||
const correctResultLabel = computed(() =>
|
||
props.item.itemVos.filter((res) => res.correctFlag === 'R').map((res) => res.itemNo)
|
||
);
|
||
// 我的答案选项
|
||
const myResultLabel = computed(() => {
|
||
const anserResultArray = props.item.anserResult.split(',');
|
||
return props.item.itemVos.filter((res) => anserResultArray.includes(res.itemId)).map((res) => res.itemNo);
|
||
});
|
||
|
||
console.log(myResultLabel.value, 'myResultLabel');
|
||
|
||
//
|
||
|
||
const subject_data = reactive({
|
||
qnsId: '',
|
||
qnsContent: '',
|
||
qnsTyp: '',
|
||
itemVos: props.item.itemVos.map((res) => ({
|
||
...res,
|
||
// 选择状态, 'info表示未选' , primary 表示蓝色, sunccess 表示绿色, error 表示红色
|
||
select_status: 'info'
|
||
}))
|
||
});
|
||
// 题目类型换成汉字
|
||
const subject_type_text = computed(() => SUBJECT_TYPE.find((res) => qnsTyp.value === res.value)?.label || '');
|
||
const click_option = () => {
|
||
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.success {
|
||
color: #15b859;
|
||
background: #e7f8ed;
|
||
}
|
||
|
||
.info {
|
||
color: #333333;
|
||
background: #f9f9f9;
|
||
}
|
||
|
||
.error {
|
||
color: #f5212d;
|
||
background: #fce8e9;
|
||
}
|
||
|
||
.option_item {
|
||
width: 100%;
|
||
height: 108rpx;
|
||
|
||
border-radius: 15rpx;
|
||
margin-top: 32rpx;
|
||
font-family: PingFangSC;
|
||
font-weight: 500;
|
||
font-size: 30rpx;
|
||
line-height: 108rpx;
|
||
text-align: left;
|
||
font-style: normal;
|
||
padding-left: 52rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.text {
|
||
flex: 1;
|
||
white-space: nowrap;
|
||
/* 强制不换行 */
|
||
overflow: hidden;
|
||
/* 超出部分隐藏 */
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.img {
|
||
height: 30rpx;
|
||
padding-right: 30rpx;
|
||
}
|
||
}
|
||
|
||
.analysis_div {
|
||
.analysis_title {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin: 32rpx 0 28rpx 0;
|
||
|
||
.success_answer {
|
||
}
|
||
|
||
.your_answer {
|
||
}
|
||
|
||
.red_color {
|
||
color: #f5212d;
|
||
}
|
||
}
|
||
|
||
.analysis_note {
|
||
font-family: PingFangSC;
|
||
font-weight: 500;
|
||
font-size: 30rpx;
|
||
color: #666666;
|
||
line-height: 48rpx;
|
||
text-align: left;
|
||
font-style: normal;
|
||
}
|
||
}
|
||
|
||
.item {
|
||
// height: 170rpx;
|
||
border-radius: 16rpx;
|
||
margin: 12rpx 0 50rpx 0;
|
||
padding: 34rpx 30rpx 34rpx 36rpx;
|
||
background-color: #fff;
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
.top {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.type {
|
||
width: 108rpx;
|
||
height: 46rpx;
|
||
background: #267eff;
|
||
border-radius: 8rpx;
|
||
font-family: PingFangSC;
|
||
font-weight: 500;
|
||
font-size: 25rpx;
|
||
color: #ffffff;
|
||
text-align: center;
|
||
line-height: 46rpx;
|
||
}
|
||
|
||
.score {
|
||
margin-left: 24rpx;
|
||
font-family: ArialMT;
|
||
font-size: 30rpx;
|
||
color: #333333;
|
||
text-align: left;
|
||
}
|
||
|
||
.right {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.right_text {
|
||
font-family: PingFangSC;
|
||
font-weight: 600;
|
||
font-size: 28rpx;
|
||
color: #333;
|
||
line-height: 40rpx;
|
||
text-align: left;
|
||
font-style: normal;
|
||
}
|
||
}
|
||
}
|
||
|
||
.text {
|
||
font-family: PingFangSC;
|
||
font-weight: 500;
|
||
font-size: 30rpx;
|
||
color: #333333;
|
||
line-height: 48rpx;
|
||
text-align: left;
|
||
font-style: normal;
|
||
margin-top: 20rpx;
|
||
}
|
||
}
|
||
</style>
|