|
@@ -10,13 +10,13 @@
|
|
toolbar="fontselect fontsizeselect forecolor backcolor | underline | bold italic strikethrough alignleft aligncenter alignright"
|
|
toolbar="fontselect fontsizeselect forecolor backcolor | underline | bold italic strikethrough alignleft aligncenter alignright"
|
|
class="title-box"
|
|
class="title-box"
|
|
/>
|
|
/>
|
|
- <el-table :data="data.option" border style="width: 100%">
|
|
|
|
- <el-table-column fixed prop="number" label="序号" width="70">
|
|
|
|
|
|
+ <el-table :data="data.option" :key="refreshKey" border style="width: 100%">
|
|
|
|
+ <el-table-column prop="number" label="序号" width="70">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.number" />
|
|
<el-input v-model="scope.row.number" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column fixed prop="con" label="内容" width="200">
|
|
|
|
|
|
+ <el-table-column prop="con" label="内容" width="200">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<RichText
|
|
<RichText
|
|
ref="richText"
|
|
ref="richText"
|
|
@@ -47,6 +47,18 @@
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
+ <el-table-column prop="img_list" label="图片">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <UploadPicture
|
|
|
|
+ :file-id="scope.row.file_list[0]"
|
|
|
|
+ :item-index="scope.$index"
|
|
|
|
+ :show-upload="!scope.row.file_list[0]"
|
|
|
|
+ @upload="uploadPic"
|
|
|
|
+ @deleteFile="deletePic"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+
|
|
<el-table-column label="操作" width="150">
|
|
<el-table-column label="操作" width="150">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button size="mini" type="text" @click="handleDelete(scope.$index)">删除</el-button>
|
|
<el-button size="mini" type="text" @click="handleDelete(scope.$index)">删除</el-button>
|
|
@@ -63,27 +75,80 @@
|
|
:translations="data.multilingual"
|
|
:translations="data.multilingual"
|
|
@SubmitTranslation="handleMultilingualTranslation"
|
|
@SubmitTranslation="handleMultilingualTranslation"
|
|
/>
|
|
/>
|
|
|
|
+ <el-divider v-if="isEnable(data.property.view_pinyin)" content-position="left">拼音效果</el-divider>
|
|
|
|
+ <PinyinText
|
|
|
|
+ v-if="isEnable(data.property.view_pinyin)"
|
|
|
|
+ :id="'table_pinyin_text'"
|
|
|
|
+ ref="PinyinText"
|
|
|
|
+ :paragraph-list="data.paragraph_list"
|
|
|
|
+ :pinyin-position="data.property.pinyin_position"
|
|
|
|
+ @fillCorrectPinyin="fillCorrectPinyin"
|
|
|
|
+ />
|
|
</template>
|
|
</template>
|
|
</ModuleBase>
|
|
</ModuleBase>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { isEnable } from '@/views/book/courseware/data/common';
|
|
import ModuleMixin from '../../common/ModuleMixin';
|
|
import ModuleMixin from '../../common/ModuleMixin';
|
|
|
|
+import { CrateParsedTextInfo_Pinyin } from '@/api/book';
|
|
|
|
+import PinyinText from '@/components/PinyinText.vue';
|
|
|
|
+import UploadPicture from '../new_word/components/UploadPicture.vue';
|
|
|
|
|
|
import { getNotesData, getOption } from '@/views/book/courseware/data/notes';
|
|
import { getNotesData, getOption } from '@/views/book/courseware/data/notes';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'NotesPage',
|
|
name: 'NotesPage',
|
|
- components: {},
|
|
|
|
|
|
+ components: { PinyinText, UploadPicture },
|
|
mixins: [ModuleMixin],
|
|
mixins: [ModuleMixin],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ isEnable,
|
|
data: getNotesData(),
|
|
data: getNotesData(),
|
|
multilingualText: '',
|
|
multilingualText: '',
|
|
|
|
+ refreshKey: '',
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
'data.option': 'handleMindMap',
|
|
'data.option': 'handleMindMap',
|
|
|
|
+ 'data.property.view_pinyin': {
|
|
|
|
+ handler(val) {
|
|
|
|
+ let text = '';
|
|
|
|
+ this.data.option.forEach((item) => {
|
|
|
|
+ text += `${item.con.replace(/<[^>]+>/g, '')}\n`;
|
|
|
|
+ });
|
|
|
|
+ if (!isEnable(val)) {
|
|
|
|
+ this.data.paragraph_list = [];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (isEnable(val) && text && this.data.paragraph_list.length <= 0) {
|
|
|
|
+ this.data.paragraph_list_parameter.text = text;
|
|
|
|
+ this.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;
|
|
|
|
+ this.createParsedTextInfoPinyin(text);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ deep: true,
|
|
|
|
+ },
|
|
|
|
+ 'data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case': {
|
|
|
|
+ handler(val, oldVal) {
|
|
|
|
+ if (val === oldVal) return;
|
|
|
|
+ let text = '';
|
|
|
|
+ this.data.option.forEach((item) => {
|
|
|
|
+ text += `${item.con.replace(/<[^>]+>/g, '')}\n`;
|
|
|
|
+ });
|
|
|
|
+ if (!isEnable(this.data.property.view_pinyin)) {
|
|
|
|
+ this.data.paragraph_list = [];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (text && isEnable(this.data.property.view_pinyin)) {
|
|
|
|
+ this.data.paragraph_list_parameter.text = text;
|
|
|
|
+ this.data.paragraph_list_parameter.is_first_sentence_first_hz_pinyin_first_char_upper_case = val;
|
|
|
|
+ this.createParsedTextInfoPinyin(text);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ deep: true,
|
|
|
|
+ },
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 删除行
|
|
// 删除行
|
|
@@ -127,6 +192,70 @@ export default {
|
|
});
|
|
});
|
|
this.multilingualVisible = true;
|
|
this.multilingualVisible = true;
|
|
},
|
|
},
|
|
|
|
+ // 获取拼音解析文本
|
|
|
|
+ createParsedTextInfoPinyin(text) {
|
|
|
|
+ if (text === '') {
|
|
|
|
+ this.data.paragraph_list_parameter.pinyin_proofread_word_list = [];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.data.paragraph_list_parameter.text = text.replace(/<[^>]+>/g, '');
|
|
|
|
+ this.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;
|
|
|
|
+ CrateParsedTextInfo_Pinyin(this.data.paragraph_list_parameter).then((res) => {
|
|
|
|
+ if (res.parsed_text) {
|
|
|
|
+ const mergedData = res.parsed_text.paragraph_list.map((outerArr, i) =>
|
|
|
|
+ outerArr.map((innerArr, j) =>
|
|
|
|
+ innerArr.map((newItem, k) => {
|
|
|
|
+ // 从 originalData 中找到对应的项
|
|
|
|
+ const originalItem = this.data.paragraph_list[i]?.[j];
|
|
|
|
+
|
|
|
|
+ // 如果 originalItem 有 activeTextStyle,就合并到 newItem
|
|
|
|
+ if (originalItem?.activeTextStyle) {
|
|
|
|
+ return {
|
|
|
|
+ ...newItem,
|
|
|
|
+ activeTextStyle: originalItem.activeTextStyle,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ // 否则直接返回 newItem
|
|
|
|
+ return newItem;
|
|
|
|
+ }),
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ this.data.paragraph_list = mergedData;
|
|
|
|
+ let pinyin_index = 0;
|
|
|
|
+ this.data.option.forEach((items, index) => {
|
|
|
|
+ items.model_pinyin = [];
|
|
|
|
+ if (items.content && mergedData[pinyin_index] && mergedData[pinyin_index][0]) {
|
|
|
|
+ mergedData[pinyin_index][0].forEach((itemP) => {
|
|
|
|
+ items.model_pinyin.push(itemP);
|
|
|
|
+ });
|
|
|
|
+ pinyin_index++;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 填充校对后的拼音
|
|
|
|
+ fillCorrectPinyin({ selectContent: { text, pinyin, activeTextStyle }, i, j }) {
|
|
|
|
+ this.data.paragraph_list_parameter.pinyin_proofread_word_list.push({
|
|
|
|
+ paragraph_index: i,
|
|
|
|
+ sentence_index: j,
|
|
|
|
+ word_index: k,
|
|
|
|
+ word: text,
|
|
|
|
+ pinyin,
|
|
|
|
+ });
|
|
|
|
+ if (pinyin) this.data.paragraph_list[i][j].pinyin = pinyin;
|
|
|
|
+ if (activeTextStyle) this.data.paragraph_list[i][j].activeTextStyle = activeTextStyle;
|
|
|
|
+ },
|
|
|
|
+ uploadPic(file_id, index) {
|
|
|
|
+ this.data.option[index].file_list[0] = file_id;
|
|
|
|
+ this.data.file_id_list.push(file_id);
|
|
|
|
+ this.refreshKey = Math.random();
|
|
|
|
+ },
|
|
|
|
+ deletePic(file_id, index) {
|
|
|
|
+ this.data.option[index].file_list[0] = '';
|
|
|
|
+ this.data.file_id_list = this.data.file_id_list.filter((item) => item !== file_id);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|