|
|
@@ -21,7 +21,10 @@
|
|
|
<ul class="word-list">
|
|
|
<li v-for="(item, index) in data.word_list" :key="item.mark" class="word-item">
|
|
|
<span v-html="sanitizeHTML(item.content)"></span>
|
|
|
- <el-button type="text" size="mini" class="delete-word" @click="removeWord(index)">
|
|
|
+ <el-button type="text" size="mini" class="delete-word" @click="editWord(index)">
|
|
|
+ <SvgIcon icon-class="edit" size="14" />
|
|
|
+ </el-button>
|
|
|
+ <el-button type="text" size="mini" class="delete-word" style="margin-left: 0" @click="removeWord(index)">
|
|
|
<SvgIcon icon-class="delete-black" size="12" />
|
|
|
</el-button>
|
|
|
</li>
|
|
|
@@ -112,7 +115,7 @@
|
|
|
@updateAnswerAnalysisFileList="updateAnswerAnalysisFileList"
|
|
|
@deleteAnswerAnalysis="deleteAnswerAnalysis"
|
|
|
/>
|
|
|
- <AddWord :visible.sync="visibleWord" @add-word="addWord" />
|
|
|
+ <AddWord :visible.sync="visibleWord" :word="editingWord" @add-word="addWord" @edit-word="editWordConfirm" />
|
|
|
</template>
|
|
|
</ModuleBase>
|
|
|
</template>
|
|
|
@@ -149,12 +152,17 @@ export default {
|
|
|
fillTypeList,
|
|
|
sanitizeHTML,
|
|
|
visibleWord: false,
|
|
|
+ editingIndex: null, // 当前编辑的词汇索引,null 表示新增模式
|
|
|
wordData: { detail: [] }, // 分词校对数据
|
|
|
inited: false,
|
|
|
loading: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ editingWord() {
|
|
|
+ if (this.editingIndex === null || this.editingIndex === undefined) return null;
|
|
|
+ return this.data.word_list[this.editingIndex] || null;
|
|
|
+ },
|
|
|
pinyinBodyStyles() {
|
|
|
const unifiedAttrib = this.data?.unified_attrib || {};
|
|
|
return {
|
|
|
@@ -656,9 +664,31 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
openAddWord() {
|
|
|
+ this.editingIndex = null;
|
|
|
+ this.visibleWord = true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 编辑词汇
|
|
|
+ * @param {number} index 词汇在 word_list 中的索引
|
|
|
+ */
|
|
|
+ editWord(index) {
|
|
|
+ this.editingIndex = index;
|
|
|
this.visibleWord = true;
|
|
|
},
|
|
|
/**
|
|
|
+ * 确认编辑词汇
|
|
|
+ * @param {string} word 编辑后的词汇内容
|
|
|
+ */
|
|
|
+ editWordConfirm(word) {
|
|
|
+ if (!word) return;
|
|
|
+ if (this.editingIndex === null || this.editingIndex === undefined) return;
|
|
|
+ this.$set(this.data.word_list, this.editingIndex, {
|
|
|
+ ...this.data.word_list[this.editingIndex],
|
|
|
+ content: word,
|
|
|
+ });
|
|
|
+ this.editingIndex = null;
|
|
|
+ },
|
|
|
+ /**
|
|
|
* 添加词汇
|
|
|
* @param {string} word 词汇内容
|
|
|
*/
|
|
|
@@ -796,7 +826,7 @@ export default {
|
|
|
|
|
|
:deep .pinyin-area .rich-text-container,
|
|
|
:deep .pinyin-area .pinyin-paragraph,
|
|
|
- :deep .pinyin-area .pinyin-sentence {
|
|
|
+ :deep .pinyin-area .pinyin-sentence {
|
|
|
display: inline;
|
|
|
}
|
|
|
}
|