更改问答题展示的考试样式
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<view class="line">
|
||||
<text class="tr">维度评分:</text>
|
||||
<text class="td">{{ dimension_all_score }}</text>
|
||||
|
||||
|
||||
<view class="td_success_error_img">
|
||||
<image :src="select_status_icon" class="img"></image>
|
||||
</view>
|
||||
@@ -11,8 +11,9 @@
|
||||
<view class="line" v-for="item in evalSettingVos">
|
||||
<text class="tr">{{ item.gradeDimens }}:</text>
|
||||
<text class="td">{{ item.anlyGrade }}</text>
|
||||
<view class="your_answer" v-if="item.dimensCode === '01'">
|
||||
<rich-text :nodes="highlightedText" class="content" />
|
||||
<view class="your_answer" v-if="item.dimensCode === '01' && passKeyword">
|
||||
关键词:{{ passKeyword }}
|
||||
<!-- <rich-text :nodes="highlightedText" class="content" /> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -33,13 +34,9 @@
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
},
|
||||
answerText: {
|
||||
type: String,
|
||||
default: '',
|
||||
required: false
|
||||
}
|
||||
});
|
||||
const passKeyword = computed(() => props.value.passKeyword);
|
||||
const evalSettingVos = computed(() => props.value.evalSettingVos);
|
||||
const status = computed(() => (props.judgeResult ? 'success' : 'error'));
|
||||
const select_status_icon = computed(() => {
|
||||
@@ -54,19 +51,19 @@
|
||||
return props.value.relKeyword.split(/[,、]/).map((key) => key.trim());
|
||||
});
|
||||
|
||||
const highlightedText = computed(() => {
|
||||
// 如果没有关键词,直接返回原文本
|
||||
if (!keywords.value.length) return '你的答案:' + props.answerText;
|
||||
// 构建正则表达式,匹配所有关键词(不区分大小写)
|
||||
// 对关键词进行转义,避免特殊字符影响正则
|
||||
const escapedKeywords = keywords.value.map((keyword) => keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
||||
// const highlightedText = computed(() => {
|
||||
// // 如果没有关键词,直接返回原文本
|
||||
// if (!keywords.value.length) return '你的答案:' + props.answerText;
|
||||
// // 构建正则表达式,匹配所有关键词(不区分大小写)
|
||||
// // 对关键词进行转义,避免特殊字符影响正则
|
||||
// const escapedKeywords = keywords.value.map((keyword) => keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
||||
|
||||
// 创建正则表达式,g表示全局匹配,i表示不区分大小写
|
||||
const regex = new RegExp(`(${escapedKeywords.join('|')})`, 'gi');
|
||||
// // 创建正则表达式,g表示全局匹配,i表示不区分大小写
|
||||
// const regex = new RegExp(`(${escapedKeywords.join('|')})`, 'gi');
|
||||
|
||||
// 替换匹配到的关键词,用span包裹并添加高亮样式
|
||||
return '你的答案:' + props.answerText.replace(regex, (match) => `<span class="highlight">${match}</span>`);
|
||||
});
|
||||
// // 替换匹配到的关键词,用span包裹并添加高亮样式
|
||||
// return '你的答案:' + props.answerText.replace(regex, (match) => `<span class="highlight">${match}</span>`);
|
||||
// });
|
||||
const dimension_all_score = computed(() => {
|
||||
return (
|
||||
evalSettingVos.value
|
||||
@@ -76,9 +73,7 @@
|
||||
.reduce((total, current) => total + current, 0)
|
||||
);
|
||||
});
|
||||
watch(evalSettingVos.value, (newVal) => {
|
||||
console.log('newVal2', newVal);
|
||||
});
|
||||
|
||||
const click_option = () => {
|
||||
emit('click_option', props.analysisVo);
|
||||
};
|
||||
|
||||
@@ -90,11 +90,14 @@
|
||||
<text :class="right_or_wrong_class ? 'success' : 'error'">{{ myResultLabel.join('') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="reference_answer" v-if="qnsTyp === 'ES'">
|
||||
<view class="reference_answer_title">你的答案:</view>
|
||||
{{ subject_data.anserResult ?? '' }}
|
||||
</view>
|
||||
<esAnalysis
|
||||
v-if="qnsTyp === 'ES'"
|
||||
:value="subject_data.itemVos[0]"
|
||||
:judgeResult="judgeResultStatus"
|
||||
:answerText="subject_data.anserResult"
|
||||
></esAnalysis>
|
||||
|
||||
<!-- 问答题专属参考答案 -->
|
||||
@@ -174,7 +177,7 @@
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val)
|
||||
});
|
||||
|
||||
|
||||
let answerText = props.item?.my_answer || props.item.anserResult || [];
|
||||
// item_answer 是答题结果,可以是对象 数组 字符串类型
|
||||
const item_answer = ref(typeof answerText === 'string' ? answerText.split(',') : answerText);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
},
|
||||
mode:{
|
||||
type: String,
|
||||
default: 'aspectFit'
|
||||
default: 'scaleToFill'
|
||||
},
|
||||
previewDetail: {
|
||||
default: '',
|
||||
|
||||
@@ -103,8 +103,7 @@
|
||||
:useEasing="true"
|
||||
ref="accmExamCntRef"
|
||||
></uv-count-to>
|
||||
|
||||
|
||||
|
||||
<span class="number">次</span>
|
||||
</view>
|
||||
</view>
|
||||
@@ -171,7 +170,7 @@
|
||||
<image-preview
|
||||
class="img-box img"
|
||||
:imgId="item.imgId"
|
||||
mode="aspectFill"
|
||||
mode="scaleToFill"
|
||||
:isCache="true"
|
||||
:width="240"
|
||||
:height="240"
|
||||
@@ -179,13 +178,9 @@
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title ellipsis-text">{{ item.crsName }}</view>
|
||||
<view class="note ellipsis-text">
|
||||
更新:{{ (item.mtTime || '').substr(0, 10) }}
|
||||
</view>
|
||||
<view class="note ellipsis-text">更新:{{ (item.mtTime || '').substr(0, 10) }}</view>
|
||||
<view class="button_div">
|
||||
<view class="note ellipsis-text">
|
||||
已学:{{ item.accmStdyCnt }}人次
|
||||
</view>
|
||||
<view class="note ellipsis-text">已学:{{ item.accmStdyCnt }}人次</view>
|
||||
<view class="button">去学习</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -214,7 +209,7 @@
|
||||
<image-preview
|
||||
class="img-box img"
|
||||
:imgId="item.imgId"
|
||||
mode="aspectFill"
|
||||
mode="scaleToFill"
|
||||
:isCache="true"
|
||||
:width="240"
|
||||
:height="240"
|
||||
@@ -222,13 +217,9 @@
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title ellipsis-text">{{ item.crsName }}</view>
|
||||
<view class="note ellipsis-text">
|
||||
更新:{{ (item.mtTime || '').substr(0, 10) }}
|
||||
</view>
|
||||
<view class="note ellipsis-text">更新:{{ (item.mtTime || '').substr(0, 10) }}</view>
|
||||
<view class="button_div">
|
||||
<view class="note ellipsis-text">
|
||||
已学:{{ item.accmStdyCnt }}人次
|
||||
</view>
|
||||
<view class="note ellipsis-text">已学:{{ item.accmStdyCnt }}人次</view>
|
||||
<view class="button">去学习</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -264,13 +255,9 @@
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title ellipsis-text">{{ item.crsName }}</view>
|
||||
<view class="note ellipsis-text">
|
||||
更新:{{ (item.mtTime || '').substr(0, 10) }}
|
||||
</view>
|
||||
<view class="note ellipsis-text">更新:{{ (item.mtTime || '').substr(0, 10) }}</view>
|
||||
<view class="button_div">
|
||||
<view class="note ellipsis-text">
|
||||
已学:{{ item.accmStdyCnt }}人次
|
||||
</view>
|
||||
<view class="note ellipsis-text">已学:{{ item.accmStdyCnt }}人次</view>
|
||||
<view class="button">去学习</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user