|
|
@@ -1089,6 +1089,8 @@ export default {
|
|
|
mathNum: Math.random().toString(36).substr(2),
|
|
|
ed: undefined,
|
|
|
refresh: true,
|
|
|
+ highWords: null,
|
|
|
+ newWordList: [],
|
|
|
multilingualTextList: {},
|
|
|
};
|
|
|
},
|
|
|
@@ -1262,6 +1264,7 @@ export default {
|
|
|
let wordTimeList = curQue.wordTime;
|
|
|
let dhaspinyin = false; // 每段是否有拼音
|
|
|
let dhaspinyinArr = [];
|
|
|
+ this.handleNewword();
|
|
|
curQue.detail.forEach((dItem, dIndex) => {
|
|
|
dhaspinyin = false;
|
|
|
dItem.wordsList.forEach((sItem, sIndex) => {
|
|
|
@@ -1271,7 +1274,21 @@ export default {
|
|
|
let startIndex = wIndex === 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
|
|
|
let endIndex = wIndex === 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
|
|
|
// this.judgePad(sItem, wItem, wIndex);
|
|
|
+ let sentence = dItem.sentences[sIndex];
|
|
|
this.mergeWordSymbol(wItem);
|
|
|
+ let words = '';
|
|
|
+ if (this.newWordList.length > 0) {
|
|
|
+ if (!this.highWords) {
|
|
|
+ this.findLightWord(wItem, wIndex, sentence, sItem);
|
|
|
+ words = this.highWords ? this.highWords.words : '';
|
|
|
+ } else if (wIndex > this.highWords.endIndex - 1) {
|
|
|
+ this.highWords = null;
|
|
|
+ this.findLightWord(wItem, wIndex, sentence, sItem);
|
|
|
+ words = this.highWords ? this.highWords.words : '';
|
|
|
+ } else {
|
|
|
+ words = this.highWords ? this.highWords.words : '';
|
|
|
+ }
|
|
|
+ }
|
|
|
let obj = {
|
|
|
paraIndex: dIndex, // 段落索引
|
|
|
sentIndex: sIndex, // 在段落中句子索引
|
|
|
@@ -1289,6 +1306,7 @@ export default {
|
|
|
startIndex,
|
|
|
endIndex,
|
|
|
leg: wItem.chs.length,
|
|
|
+ words,
|
|
|
timeList: [],
|
|
|
config: {
|
|
|
fontFamily: wItem.fontFamily,
|
|
|
@@ -1352,6 +1370,54 @@ export default {
|
|
|
wItem.isShow = true;
|
|
|
}
|
|
|
},
|
|
|
+ findLightWord(wItem, startIndex, sentence, sItem) {
|
|
|
+ let endIndex = 0;
|
|
|
+ let words = '';
|
|
|
+ this.newWordList.forEach((item) => {
|
|
|
+ if (item.length === 1) {
|
|
|
+ if (item === wItem.chs && !wItem.banLight) {
|
|
|
+ words = wItem.chs;
|
|
|
+ endIndex = startIndex + 1;
|
|
|
+ }
|
|
|
+ } else if (item.substring(0, wItem.chs.length) === wItem.chs && sentence.indexOf(item) > -1) {
|
|
|
+ let index = null;
|
|
|
+ let chsStr = '';
|
|
|
+ for (let i = startIndex; i < sItem.length + 1; i++) {
|
|
|
+ index = i;
|
|
|
+ if (chsStr.length === item.length) {
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ chsStr += sItem[i] ? sItem[i].chs : '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (chsStr === item && !wItem.banLight) {
|
|
|
+ words = item;
|
|
|
+ endIndex = index;
|
|
|
+ }
|
|
|
+ } else if (wItem.new_word && wItem.new_word === item && !wItem.banLight) {
|
|
|
+ words = item;
|
|
|
+ endIndex = startIndex + 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (words) {
|
|
|
+ this.highWords = { words, endIndex };
|
|
|
+ } else {
|
|
|
+ this.highWords = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleNewword() {
|
|
|
+ let NewWordList = [];
|
|
|
+ this.NNPENewWordList.forEach((wItem) => {
|
|
|
+ // item.forEach((wItem) => {
|
|
|
+ if (wItem.new_word) {
|
|
|
+ NewWordList.push(wItem.new_word);
|
|
|
+ } else if (wItem.detail && wItem.detail.sentence) {
|
|
|
+ NewWordList.push(wItem.detail.sentence);
|
|
|
+ }
|
|
|
+ // });
|
|
|
+ });
|
|
|
+ this.newWordList = JSON.parse(JSON.stringify(NewWordList));
|
|
|
+ },
|
|
|
|
|
|
// 判断是否有padding
|
|
|
judgePad(sItem, wItem, curIndex) {
|