|
@@ -45,7 +45,7 @@
|
|
|
v-for="(item, index) in resArr"
|
|
|
:key="'detail' + index"
|
|
|
>
|
|
|
- <div class="wordsList-box">
|
|
|
+ <div class="wordsList-box" :class="[curQue.detail[index].paragraphAttr?'wordsList-box-'+curQue.detail[index].paragraphAttr.paragraphAlign:'']">
|
|
|
<img :src="articleImg[index]" v-if="articleImg[0] && index == 0" />
|
|
|
<div>
|
|
|
<div
|
|
@@ -58,7 +58,7 @@
|
|
|
: 'textCenter',
|
|
|
pItem.chs == '“' ? 'textRight' : '',
|
|
|
]"
|
|
|
- @click="showWordDetail($event, pItem.chs)"
|
|
|
+ @click="showWordDetail($event, pItem.chs, pItem.words)"
|
|
|
>
|
|
|
<template v-if="!pItem.width">
|
|
|
<template v-if="pItem.isShow">
|
|
@@ -87,8 +87,9 @@
|
|
|
:class="[
|
|
|
'NNPE-chs',
|
|
|
newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
|
|
|
+ pItem.words ? 'active' : '',
|
|
|
]"
|
|
|
- @click.stop="viewNotes($event, pItem.chs)"
|
|
|
+ @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
|
|
|
>{{ NumberList.indexOf(pItem.pinyin) == -1
|
|
|
? pItem.chs
|
|
|
: "" }}</span
|
|
@@ -128,7 +129,7 @@
|
|
|
<span class="NNPE-chs" style="text-align: left" @click.stop="
|
|
|
viewNotes(
|
|
|
$event,
|
|
|
- item.wordsList[pIndex + 1].chs
|
|
|
+ item.wordsList[pIndex + 1].words?item.wordsList[pIndex + 1].words:item.wordsList[pIndex + 1].chs
|
|
|
)
|
|
|
">{{
|
|
|
NumberList.indexOf(
|
|
@@ -192,7 +193,7 @@
|
|
|
<span class="NNPE-chs" style="text-align: left" @click.stop="
|
|
|
viewNotes(
|
|
|
$event,
|
|
|
- item.wordsList[pIndex + 2].chs
|
|
|
+ item.wordsList[pIndex + 2].words?item.wordsList[pIndex + 2].words:item.wordsList[pIndex + 2].chs
|
|
|
)
|
|
|
">{{
|
|
|
NumberList.indexOf(
|
|
@@ -240,8 +241,9 @@
|
|
|
:class="[
|
|
|
pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
|
|
|
newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
|
|
|
+ pItem.words ? 'active' : '',
|
|
|
]"
|
|
|
- @click.stop="viewNotes($event, pItem.chs)"
|
|
|
+ @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
|
|
|
>{{ NumberList.indexOf(pItem.pinyin) == -1
|
|
|
? pItem.chs
|
|
|
: "" }}</span
|
|
@@ -305,7 +307,7 @@
|
|
|
: 'textCenter',
|
|
|
pItem.chs == '“' ? 'textRight' : '',
|
|
|
]"
|
|
|
- @click="showWordDetail($event, pItem.chs)"
|
|
|
+ @click="showWordDetail($event, pItem.chs, pItem.words)"
|
|
|
>
|
|
|
<template v-if="!pItem.width">
|
|
|
<template v-if="pItem.isShow">
|
|
@@ -338,6 +340,7 @@
|
|
|
pItem.padding && config.isShowPY ? 'padding' : '',
|
|
|
sentIndex == index ? 'wordBlank' : '',
|
|
|
newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
|
|
|
+ pItem.words ? 'active' : '',
|
|
|
]"
|
|
|
>
|
|
|
<template>
|
|
@@ -347,7 +350,7 @@
|
|
|
:class="[
|
|
|
|
|
|
]"
|
|
|
- @click.stop="viewNotes($event, pItem.chs)"
|
|
|
+ @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
|
|
|
>{{ NumberList.indexOf(pItem.pinyin) == -1
|
|
|
? pItem.chs[wIndex]
|
|
|
: "" }}</span
|
|
@@ -389,7 +392,7 @@
|
|
|
:class="[
|
|
|
|
|
|
]"
|
|
|
- @click.stop="viewNotes($event, item.sentArr[pIndex + 1].chs)"
|
|
|
+ @click.stop="viewNotes($event, item.sentArr[pIndex + 1].words?item.sentArr[pIndex + 1].words:item.sentArr[pIndex + 1].chs)"
|
|
|
>
|
|
|
{{ NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
|
|
|
? item.sentArr[pIndex + 1].chs
|
|
@@ -440,7 +443,7 @@
|
|
|
:class="[
|
|
|
|
|
|
]"
|
|
|
- @click.stop="viewNotes($event, item.sentArr[pIndex + 2].chs)"
|
|
|
+ @click.stop="viewNotes($event, item.sentArr[pIndex + 2].words?item.sentArr[pIndex + 2].words:item.sentArr[pIndex + 2].chs)"
|
|
|
>
|
|
|
{{ NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
|
|
|
? item.sentArr[pIndex + 2].chs
|
|
@@ -487,6 +490,7 @@
|
|
|
: '',
|
|
|
sentIndex == index ? 'wordBlank' : '',
|
|
|
newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
|
|
|
+ pItem.words ? 'active' : '',
|
|
|
]"
|
|
|
>
|
|
|
<template>
|
|
@@ -496,7 +500,7 @@
|
|
|
:class="[
|
|
|
|
|
|
]"
|
|
|
- @click.stop="viewNotes($event, pItem.chs)"
|
|
|
+ @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
|
|
|
>{{ NumberList.indexOf(pItem.pinyin) == -1
|
|
|
? pItem.chs[wIndex]
|
|
|
: "" }}</span
|
|
@@ -643,6 +647,9 @@ export default {
|
|
|
clientY: 0,
|
|
|
clickType: "",
|
|
|
sentIndex: -1,
|
|
|
+ highWords: null,
|
|
|
+ highWordsArr: [],
|
|
|
+ highIndex: 0,
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -746,8 +753,24 @@ export default {
|
|
|
}
|
|
|
dItem.wordsList.forEach((sItem, sIndex) => {
|
|
|
sItem.forEach((wItem, wIndex) => {
|
|
|
+ let sentence = dItem.sentences[sIndex];
|
|
|
//this.judgePad(sItem, wItem, wIndex);
|
|
|
this.mergeWordSymbol(sItem, wItem, wIndex);
|
|
|
+ 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, //在段落中句子索引
|
|
@@ -758,6 +781,7 @@ export default {
|
|
|
className: wItem.className,
|
|
|
isShow: wItem.isShow,
|
|
|
isNewWord: this.newWords.indexOf(wItem.chs) > -1 ? true : false,
|
|
|
+ words: words,
|
|
|
};
|
|
|
paraArr.push(obj);
|
|
|
if(wItem.pinyin) dhaspinyin=true
|
|
@@ -837,6 +861,43 @@ export default {
|
|
|
});
|
|
|
this.resObj = { sentList: resArrs, timeList: timeList };
|
|
|
},
|
|
|
+ findLightWord(wItem, startIndex, sentence,sItem) {
|
|
|
+ let words = "",
|
|
|
+ endIndex = 0;
|
|
|
+ this.newWordList.forEach((item) => {
|
|
|
+ if (item.length == 1) {
|
|
|
+ if (item == wItem.chs&&!wItem.banLight) {
|
|
|
+ words = wItem.chs;
|
|
|
+ endIndex = startIndex + 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (item[0] == 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: words, endIndex: endIndex };
|
|
|
+ } else {
|
|
|
+ this.highWords = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
//词和标点合一起
|
|
|
mergeWordSymbol(sItem, wItem, curIndex) {
|
|
|
let leg = sItem.length;
|
|
@@ -915,24 +976,47 @@ export default {
|
|
|
let NewWordList = [];
|
|
|
this.NNPENewWordList.forEach((item) => {
|
|
|
item.forEach((wItem) => {
|
|
|
- NewWordList.push(wItem.new_word);
|
|
|
+ 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));
|
|
|
},
|
|
|
|
|
|
- showWordDetail(e, word) {
|
|
|
+ showWordDetail(e, word, words) {
|
|
|
let _this = this;
|
|
|
- if (this.newWordList.indexOf(word) > -1) {
|
|
|
- if (_this.oldHz != word) {
|
|
|
- this.isShow = false;
|
|
|
- setTimeout(() => {
|
|
|
- _this.hz = word;
|
|
|
- }, 50);
|
|
|
+ _this.highIndex = 0;
|
|
|
+ _this.highWordsArr = [];
|
|
|
+ if (word && this.newWordList.indexOf(word) > -1) {
|
|
|
+ this.highWordsArr.push(word);
|
|
|
+ }
|
|
|
+ if (words && word != words && this.newWordList.indexOf(words) > -1) {
|
|
|
+ this.highWordsArr.push(words);
|
|
|
+ }
|
|
|
+ if (this.newWordList.indexOf(word) > -1 ||
|
|
|
+ this.newWordList.indexOf(words) > -1) {
|
|
|
+ if (word && this.newWordList.indexOf(word) > -1) {
|
|
|
+ if (_this.oldHz != word) {
|
|
|
+ this.isShow = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.hz = word;
|
|
|
+ }, 50);
|
|
|
+ }
|
|
|
+ }else if (words && this.newWordList.indexOf(words) > -1) {
|
|
|
+ if (_this.oldHz != words) {
|
|
|
+ this.isShow = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.hz = words;
|
|
|
+ }, 50);
|
|
|
+ }
|
|
|
}
|
|
|
_this.clientY = e.clientY;
|
|
|
let left = e.clientX;
|
|
|
let width = 0;
|
|
|
+
|
|
|
if (word.length == 1 || word.length == 2) {
|
|
|
width = 304;
|
|
|
} else if (word.length == 3 || word.length == 4) {
|
|
@@ -940,6 +1024,7 @@ export default {
|
|
|
} else if (word.length > 3) {
|
|
|
width = 560;
|
|
|
}
|
|
|
+
|
|
|
if (left - this.bodyLeft > this.contentWidth / 2) {
|
|
|
_this.left = left - width + 10;
|
|
|
} else {
|
|
@@ -1071,13 +1156,12 @@ export default {
|
|
|
created() {},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
|
- if (this.curQue) {
|
|
|
- this.handleData();
|
|
|
- }
|
|
|
-
|
|
|
if (this.NNPENewWordList && this.NNPENewWordList.length > 0) {
|
|
|
this.handleNewword();
|
|
|
}
|
|
|
+ if (this.curQue) {
|
|
|
+ this.handleData();
|
|
|
+ }
|
|
|
$(window).resize(() => {
|
|
|
this.getScreenHeight();
|
|
|
});
|
|
@@ -1221,6 +1305,16 @@ export default {
|
|
|
.wordsList-box {
|
|
|
width: 100%;
|
|
|
padding: 6px 24px 12px 24px;
|
|
|
+ display: flex;
|
|
|
+ &-left{
|
|
|
+ justify-content: flex-start;
|
|
|
+ }
|
|
|
+ &-center{
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ &-right{
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
> div {
|
|
|
overflow: hidden;
|
|
|
clear: both;
|