|
@@ -8,18 +8,18 @@
|
|
|
<span v-html="sanitizeHTML(data.stem)"></span>
|
|
|
</div>
|
|
|
|
|
|
- <div v-if="isEnable(data.property.is_enable_word_select_fill)" class="word-fill">
|
|
|
- <span v-for="(text, i) in wordFillList" :key="i" class="word-fill-item" @click="selectedDescription(text)">
|
|
|
- {{ text }}
|
|
|
- </span>
|
|
|
- </div>
|
|
|
-
|
|
|
<div
|
|
|
v-if="isEnable(data.property.is_enable_description)"
|
|
|
class="description rich-text"
|
|
|
v-html="sanitizeHTML(data.description)"
|
|
|
></div>
|
|
|
|
|
|
+ <div v-if="isEnable(data.property.is_enable_word_select_fill)" class="word-fill">
|
|
|
+ <span v-for="(text, i) in wordFillList" :key="i" class="word-fill-item" @click="selectedDescription(text)">
|
|
|
+ {{ text }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="fill-wrapper">
|
|
|
<p v-for="(item, i) in modelEssay" :key="i">
|
|
|
<template v-for="(li, j) in item">
|
|
@@ -31,6 +31,7 @@
|
|
|
:disabled="disabled"
|
|
|
:class="[...computedAnswerClass(li.mark)]"
|
|
|
:style="[{ width: Math.max(80, li.content.length * 21.3) + 'px' }]"
|
|
|
+ @input="handleInput(i, j)"
|
|
|
@focus="handleInputFocus(i, j)"
|
|
|
@blur="handleTone(li.content, i, j)"
|
|
|
/>
|
|
@@ -55,6 +56,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
modelEssay: [],
|
|
|
+ history: [], // modelEssay 历史记录
|
|
|
inputFocus: false,
|
|
|
focusPostion: {
|
|
|
i: -1,
|
|
@@ -79,6 +81,7 @@ export default {
|
|
|
modelEssay: {
|
|
|
handler(val) {
|
|
|
if (!val) return;
|
|
|
+ this.history = JSON.parse(JSON.stringify(val));
|
|
|
this.answer.answer_list = val
|
|
|
.map((item) => {
|
|
|
return item
|
|
@@ -157,6 +160,16 @@ export default {
|
|
|
this.modelEssay[i][j].content = text;
|
|
|
this.inputFocus = false;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 处理输入框输入
|
|
|
+ * @param {number} i
|
|
|
+ * @param {number} j
|
|
|
+ */
|
|
|
+ handleInput(i, j) {
|
|
|
+ // 在开启选词填空的情况下,输入框输入内容时,做撤销处理
|
|
|
+ if (!this.isEnable(this.data.property.is_enable_word_select_fill)) return;
|
|
|
+ this.modelEssay[i][j].content = this.history[i][j].content;
|
|
|
+ },
|
|
|
handleTone(value, i, j) {
|
|
|
if (!/^[a-zA-Z0-9\s]+$/.test(value)) return;
|
|
|
this.modelEssay[i][j].content = value
|