|
@@ -23,6 +23,17 @@
|
|
|
<span class="add-button" @click="addOption">增加选项</span>
|
|
|
</div>
|
|
|
|
|
|
+ <el-divider v-if="isEnable(data.property.view_pinyin)" content-position="left">拼音效果</el-divider>
|
|
|
+ <PinyinText
|
|
|
+ v-for="(item, i) in data.option_list"
|
|
|
+ v-show="isEnable(data.property.view_pinyin)"
|
|
|
+ :key="i"
|
|
|
+ ref="PinyinText"
|
|
|
+ :paragraph-list="item.paragraph_list"
|
|
|
+ :pinyin-position="data.property.pinyin_position"
|
|
|
+ @fillCorrectPinyin="fillCorrectPinyin($event, i)"
|
|
|
+ />
|
|
|
+
|
|
|
<MultilingualFill
|
|
|
v-if="curSelectIndex !== -1"
|
|
|
:visible.sync="multilingualVisible"
|
|
@@ -36,11 +47,17 @@
|
|
|
|
|
|
<script>
|
|
|
import ModuleMixin from '../../common/ModuleMixin';
|
|
|
+import PinyinText from '@/components/PinyinText.vue';
|
|
|
|
|
|
import { getSelectData, getOption, arrangeTypeList } from '@/views/book/courseware/data/select';
|
|
|
+import { isEnable } from '@/views/book/courseware/data/common';
|
|
|
+import { CrateParsedTextInfo_Pinyin } from '@/api/book';
|
|
|
|
|
|
export default {
|
|
|
name: 'SelectPage',
|
|
|
+ components: {
|
|
|
+ PinyinText,
|
|
|
+ },
|
|
|
mixins: [ModuleMixin],
|
|
|
data() {
|
|
|
return {
|
|
@@ -51,6 +68,18 @@ export default {
|
|
|
watch: {
|
|
|
'data.property.arrange_type': 'handlerMindMap',
|
|
|
'data.answer.answer_list': 'handlerMindMap',
|
|
|
+ 'data.property': {
|
|
|
+ handler({ view_pinyin }) {
|
|
|
+ if (!isEnable(view_pinyin)) return;
|
|
|
+ this.data.option_list.forEach((item, i) => {
|
|
|
+ const text = item.content.replace(/<[^>]+>/g, '');
|
|
|
+ if (!text) return;
|
|
|
+ item.paragraph_list_parameter.text = text;
|
|
|
+ this.crateParsedTextInfoPinyin(text, i);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
// 将数字转换为小写字母
|
|
@@ -101,6 +130,35 @@ export default {
|
|
|
handleMultilingualTranslation(translations) {
|
|
|
this.$set(this.data.option_list[this.curSelectIndex], 'multilingual', translations);
|
|
|
},
|
|
|
+ // 获取拼音解析文本
|
|
|
+ crateParsedTextInfoPinyin(text, i) {
|
|
|
+ const data = this.data.option_list[i];
|
|
|
+ if (text === '') {
|
|
|
+ data.paragraph_list_parameter.pinyin_proofread_word_list = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ data.paragraph_list_parameter.text = text;
|
|
|
+ CrateParsedTextInfo_Pinyin({
|
|
|
+ ...data.paragraph_list_parameter,
|
|
|
+ is_first_sentence_first_hz_pinyin_first_char_upper_case:
|
|
|
+ this.data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case,
|
|
|
+ }).then(({ parsed_text }) => {
|
|
|
+ if (parsed_text) {
|
|
|
+ data.paragraph_list = parsed_text.paragraph_list;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 填充校对后的拼音
|
|
|
+ fillCorrectPinyin({ selectContent, tonePinyin, i, j, k }, index) {
|
|
|
+ this.data.option_list[index].paragraph_list_parameter.pinyin_proofread_word_list.push({
|
|
|
+ paragraph_index: i,
|
|
|
+ sentence_index: j,
|
|
|
+ word_index: k,
|
|
|
+ word: selectContent,
|
|
|
+ pinyin: tonePinyin,
|
|
|
+ });
|
|
|
+ this.data.option_list[index].paragraph_list[i][j][k].pinyin = tonePinyin;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|