|
|
@@ -14,16 +14,15 @@
|
|
|
<template v-for="(li, i) in modelEssay">
|
|
|
<template v-if="li.type === 'text'">
|
|
|
<PinyinText
|
|
|
- v-if="isEnable(data.property.view_pinyin)"
|
|
|
:key="`text-${i}`"
|
|
|
class="content"
|
|
|
:paragraph-list="li.paragraph_list"
|
|
|
:rich-text-list="li.rich_text_list"
|
|
|
:pinyin-position="data.property.pinyin_position"
|
|
|
- :body-styles="getBodyStyles()"
|
|
|
+ :body-styles="pinyinBodyStyles"
|
|
|
+ :is-show-pinyin="isEnable(data.property.view_pinyin)"
|
|
|
:is-preview="true"
|
|
|
/>
|
|
|
- <span v-else :key="`text-${i}`" class="html-content" v-html="renderTextBlockContent(li)"></span>
|
|
|
</template>
|
|
|
<template v-if="li.type === 'input'">
|
|
|
<!-- 输入填空 -->
|
|
|
@@ -36,7 +35,7 @@
|
|
|
:class="[...computedAnswerClass(li.mark)]"
|
|
|
:style="[
|
|
|
{
|
|
|
- fontFamily: data.property.fill_font,
|
|
|
+ '--fill-font-family': data.property.fill_font,
|
|
|
width: (inputWidthMap[li.mark] || data.property.input_default_width) + 'px',
|
|
|
},
|
|
|
]"
|
|
|
@@ -86,7 +85,7 @@
|
|
|
:key="`record-${i}`"
|
|
|
type="mini"
|
|
|
:many-times="false"
|
|
|
- class="record-box"
|
|
|
+ class="record-box fill"
|
|
|
:attrib="data.unified_attrib"
|
|
|
:answer-record-list="data.audio_answer_list"
|
|
|
:task-model="isJudgingRightWrong ? 'ANSWER' : ''"
|
|
|
@@ -110,7 +109,12 @@
|
|
|
<div v-if="showLang" class="lang">
|
|
|
{{ data.multilingual.find((item) => item.type === getLang())?.translation }}
|
|
|
</div>
|
|
|
- <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @judgeCorrect="judgeCorrect" @retry="retry" />
|
|
|
+ <PreviewOperation
|
|
|
+ :is-show-retry="isHasFill"
|
|
|
+ @showAnswerAnalysis="showAnswerAnalysis"
|
|
|
+ @judgeCorrect="judgeCorrect"
|
|
|
+ @retry="retry"
|
|
|
+ />
|
|
|
</div>
|
|
|
|
|
|
<WriteDialog :visible.sync="writeVisible" @confirm="handleWriteConfirm" />
|
|
|
@@ -130,15 +134,15 @@
|
|
|
<template v-for="(li, i) in modelEssay">
|
|
|
<template v-if="li.type === 'text'">
|
|
|
<PinyinText
|
|
|
- v-if="isEnable(data.property.view_pinyin)"
|
|
|
:key="`answer-text-${i}`"
|
|
|
+ :is-show-pinyin="isEnable(data.property.view_pinyin)"
|
|
|
class="content"
|
|
|
:paragraph-list="li.paragraph_list"
|
|
|
:rich-text-list="li.rich_text_list"
|
|
|
+ :body-styles="pinyinBodyStyles"
|
|
|
:pinyin-position="data.property.pinyin_position"
|
|
|
:is-preview="true"
|
|
|
/>
|
|
|
- <span v-else :key="`answer-text-${i}`" class="html-content" v-html="renderTextBlockContent(li)"></span>
|
|
|
</template>
|
|
|
<template v-if="li.type === 'input'">
|
|
|
<span v-show="computedAnswerText(li.mark).length > 0" :key="`answer-${i}`" class="right-answer">
|
|
|
@@ -181,6 +185,19 @@ export default {
|
|
|
writeMark: '',
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ pinyinBodyStyles() {
|
|
|
+ const unifiedAttrib = this.data?.unified_attrib || {};
|
|
|
+ return {
|
|
|
+ fontFamily: unifiedAttrib.font || undefined,
|
|
|
+ fontSize: unifiedAttrib.font_size || undefined,
|
|
|
+ color: unifiedAttrib.text_color || undefined,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ isHasFill() {
|
|
|
+ return this.data.model_essay.some((li) => li.type === 'input');
|
|
|
+ },
|
|
|
+ },
|
|
|
watch: {
|
|
|
'data.model_essay': {
|
|
|
handler(list) {
|
|
|
@@ -221,21 +238,6 @@ export default {
|
|
|
handleWav(data) {
|
|
|
this.data.record_list = data;
|
|
|
},
|
|
|
- renderContent(content) {
|
|
|
- return this.convertText(this.sanitizeHTML(content));
|
|
|
- },
|
|
|
- /**
|
|
|
- * 渲染文本块内容
|
|
|
- * @param {Object} textBlock 文本块对象,包含纯文本内容和富文本内容
|
|
|
- */
|
|
|
- renderTextBlockContent(textBlock) {
|
|
|
- const richTextList = textBlock?.rich_text_list;
|
|
|
- if (Array.isArray(richTextList) && richTextList.length > 0) {
|
|
|
- const richHtml = richTextList.map((item) => item?.text || '').join('');
|
|
|
- return this.renderContent(richHtml);
|
|
|
- }
|
|
|
- return this.renderContent(textBlock?.content || '');
|
|
|
- },
|
|
|
syncAnswerList(list) {
|
|
|
this.answer.answer_list = list
|
|
|
.map(({ type, input, audio_answer_list, mark }) => {
|
|
|
@@ -478,23 +480,6 @@ export default {
|
|
|
|
|
|
this.$set(this.inputWidthMap, mark, nextWidth);
|
|
|
},
|
|
|
- getBodyStyles() {
|
|
|
- const styles = {};
|
|
|
- const unifiedAttrib = this.data?.unified_attrib || {};
|
|
|
-
|
|
|
- // 从统一属性中获取样式
|
|
|
- if (unifiedAttrib.font) {
|
|
|
- styles['font-family'] = unifiedAttrib.font;
|
|
|
- }
|
|
|
- if (unifiedAttrib.font_size) {
|
|
|
- styles['font-size'] = unifiedAttrib.font_size;
|
|
|
- }
|
|
|
- if (unifiedAttrib.text_color) {
|
|
|
- styles['color'] = unifiedAttrib.text_color;
|
|
|
- }
|
|
|
-
|
|
|
- return styles;
|
|
|
- },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -528,17 +513,16 @@ export default {
|
|
|
display: inline;
|
|
|
}
|
|
|
|
|
|
- .html-content {
|
|
|
- :deep p {
|
|
|
- display: inline;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .record-box {
|
|
|
+ .record-box.fill {
|
|
|
display: inline-flex;
|
|
|
align-items: center;
|
|
|
background-color: #fff;
|
|
|
border-bottom: 1px solid $font-color;
|
|
|
+
|
|
|
+ :deep(.playBack) {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.write-click {
|
|
|
@@ -602,6 +586,7 @@ export default {
|
|
|
|
|
|
:deep .el-input__inner {
|
|
|
padding: 0;
|
|
|
+ font-family: var(--fill-font-family, 'arial'), sans-serif;
|
|
|
font-size: 16pt;
|
|
|
color: $font-color;
|
|
|
text-align: center;
|