|
@@ -425,9 +425,10 @@ import Notes from '../article/Notes.vue';
|
|
|
import CheckSubtitles from '@/views/book/courseware/create/components/question/voice_matrix/CheckSubtitles.vue';
|
|
import CheckSubtitles from '@/views/book/courseware/create/components/question/voice_matrix/CheckSubtitles.vue';
|
|
|
import ResourcesOperate from '../../common/ResourcesOperate.vue';
|
|
import ResourcesOperate from '../../common/ResourcesOperate.vue';
|
|
|
|
|
|
|
|
-import { getArticleData } from '@/views/book/courseware/data/dialogueArticle';
|
|
|
|
|
|
|
+import { getArticleData, roleDefaultColorList } from '@/views/book/courseware/data/dialogueArticle';
|
|
|
import { fileUpload, TextToAudioFile } from '@/api/app';
|
|
import { fileUpload, TextToAudioFile } from '@/api/app';
|
|
|
import { toolGetWordPinyinCorrectionList } from '@/api/pinyinCorrection';
|
|
import { toolGetWordPinyinCorrectionList } from '@/api/pinyinCorrection';
|
|
|
|
|
+import { getRandomNumber } from '@/utils';
|
|
|
import {
|
|
import {
|
|
|
segSentences,
|
|
segSentences,
|
|
|
BatchSegContent,
|
|
BatchSegContent,
|
|
@@ -567,30 +568,89 @@ export default {
|
|
|
if (!this.textInput.trim()) {
|
|
if (!this.textInput.trim()) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // console.log(this.textInput.split('\n'));
|
|
|
|
|
-
|
|
|
|
|
- this.data.detail.push({
|
|
|
|
|
- roleIndex: this.curRole,
|
|
|
|
|
- para: this.textInput.replace(/\n/, ''),
|
|
|
|
|
- remark: {
|
|
|
|
|
- chs: '',
|
|
|
|
|
- en: '',
|
|
|
|
|
- heightNumber: null,
|
|
|
|
|
- img_list: [],
|
|
|
|
|
- widthNumber: null,
|
|
|
|
|
- chsBg: '#988ed6',
|
|
|
|
|
- enBg: '#fff',
|
|
|
|
|
- },
|
|
|
|
|
- type: 'text',
|
|
|
|
|
- paraIndex: 0,
|
|
|
|
|
- sentences: [],
|
|
|
|
|
- segList: [],
|
|
|
|
|
- seg_words: [],
|
|
|
|
|
- wordsList: [],
|
|
|
|
|
- timeList: [],
|
|
|
|
|
- isTitle: false,
|
|
|
|
|
- sentencesEn: [],
|
|
|
|
|
|
|
+ let textList = this.textInput.trim().split('\n');
|
|
|
|
|
+ textList.forEach((item) => {
|
|
|
|
|
+ let obj = {
|
|
|
|
|
+ roleIndex: null,
|
|
|
|
|
+ notice: '',
|
|
|
|
|
+ para: '',
|
|
|
|
|
+ remark: {
|
|
|
|
|
+ chs: '',
|
|
|
|
|
+ en: '',
|
|
|
|
|
+ heightNumber: null,
|
|
|
|
|
+ img_list: [],
|
|
|
|
|
+ widthNumber: null,
|
|
|
|
|
+ chsBg: '#988ed6',
|
|
|
|
|
+ enBg: '#fff',
|
|
|
|
|
+ },
|
|
|
|
|
+ type: 'notice',
|
|
|
|
|
+ paraIndex: 0,
|
|
|
|
|
+ sentences: [],
|
|
|
|
|
+ segList: [],
|
|
|
|
|
+ seg_words: [],
|
|
|
|
|
+ wordsList: [],
|
|
|
|
|
+ timeList: [],
|
|
|
|
|
+ isTitle: false,
|
|
|
|
|
+ sentencesEn: [],
|
|
|
|
|
+ };
|
|
|
|
|
+ if (item.indexOf(':') > -1) {
|
|
|
|
|
+ // 如果包含描述、语境或者角色名
|
|
|
|
|
+ let prefix = item.substring(0, item.indexOf(':'));
|
|
|
|
|
+ let content = item.substring(item.indexOf(':') + 1);
|
|
|
|
|
+ if (prefix === '描述' || prefix === '语境') {
|
|
|
|
|
+ // 语境内容
|
|
|
|
|
+ obj.roleIndex = null;
|
|
|
|
|
+ obj.notice = content;
|
|
|
|
|
+ obj.type = 'notice';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ obj.para = content;
|
|
|
|
|
+ obj.type = 'text';
|
|
|
|
|
+ let role = this.data.property.role_list.find((items) => items.fullName === prefix);
|
|
|
|
|
+ if (!role) {
|
|
|
|
|
+ // 角色名不存在
|
|
|
|
|
+ this.data.property.role_list.push({
|
|
|
|
|
+ name: prefix,
|
|
|
|
|
+ mark: getRandomNumber(),
|
|
|
|
|
+ color: roleDefaultColorList[this.data.property.role_list.length],
|
|
|
|
|
+ simpleHead: '',
|
|
|
|
|
+ img_list: [],
|
|
|
|
|
+ fullName: prefix,
|
|
|
|
|
+ fullPinyin: '',
|
|
|
|
|
+ id: Math.random().toString(36).substr(2),
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ obj.roleIndex = this.data.property.role_list.find((items) => items.fullName === prefix).id;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ obj.roleIndex = this.curRole;
|
|
|
|
|
+ obj.para = content;
|
|
|
|
|
+ obj.type = 'text';
|
|
|
|
|
+ }
|
|
|
|
|
+ this.data.detail.push(obj);
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ // this.data.detail.push({
|
|
|
|
|
+ // roleIndex: this.curRole,
|
|
|
|
|
+ // para: this.textInput.replace(/\n/, ''),
|
|
|
|
|
+ // remark: {
|
|
|
|
|
+ // chs: '',
|
|
|
|
|
+ // en: '',
|
|
|
|
|
+ // heightNumber: null,
|
|
|
|
|
+ // img_list: [],
|
|
|
|
|
+ // widthNumber: null,
|
|
|
|
|
+ // chsBg: '#988ed6',
|
|
|
|
|
+ // enBg: '#fff',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // type: 'text',
|
|
|
|
|
+ // paraIndex: 0,
|
|
|
|
|
+ // sentences: [],
|
|
|
|
|
+ // segList: [],
|
|
|
|
|
+ // seg_words: [],
|
|
|
|
|
+ // wordsList: [],
|
|
|
|
|
+ // timeList: [],
|
|
|
|
|
+ // isTitle: false,
|
|
|
|
|
+ // sentencesEn: [],
|
|
|
|
|
+ // });
|
|
|
this.textInput = '';
|
|
this.textInput = '';
|
|
|
this.handleMindMap();
|
|
this.handleMindMap();
|
|
|
},
|
|
},
|