|
@@ -7,97 +7,99 @@
|
|
|
ref="audioLine"
|
|
|
/>
|
|
|
<template v-if="resArr.length > 0">
|
|
|
- <div
|
|
|
- :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
|
|
|
- v-for="(item, index) in resArr"
|
|
|
- :key="'detail' + index"
|
|
|
- >
|
|
|
- <div class="wordsList-box">
|
|
|
- <img :src="articleImg[index]" v-if="articleImg[0] && index == 0" />
|
|
|
- <div>
|
|
|
- <div
|
|
|
- class="NNPE-words"
|
|
|
- v-for="(pItem, pIndex) in item.wordsList"
|
|
|
- :key="'wordsList' + pIndex"
|
|
|
- :class="[pItem.wordIndex == 0 ? 'textLeft' : 'textCenter']"
|
|
|
- @click="showWordDetail($event, pItem.chs)"
|
|
|
- >
|
|
|
- <template v-if="!pItem.width">
|
|
|
- <template v-if="pItem.isShow">
|
|
|
- <template
|
|
|
- v-if="
|
|
|
- item.wordsList[pIndex + 1].chs &&
|
|
|
- chsFhList.indexOf(item.wordsList[pIndex + 1].chs) > -1
|
|
|
- "
|
|
|
- >
|
|
|
- <span class="NNPE-words-box">
|
|
|
+ <div class="NPC-sentences-list">
|
|
|
+ <div
|
|
|
+ :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
|
|
|
+ v-for="(item, index) in resArr"
|
|
|
+ :key="'detail' + index"
|
|
|
+ >
|
|
|
+ <div class="wordsList-box">
|
|
|
+ <img :src="articleImg[index]" v-if="articleImg[0] && index == 0" />
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ class="NNPE-words"
|
|
|
+ v-for="(pItem, pIndex) in item.wordsList"
|
|
|
+ :key="'wordsList' + pIndex"
|
|
|
+ :class="[pItem.wordIndex == 0 ? 'textLeft' : 'textCenter']"
|
|
|
+ @click="showWordDetail($event, pItem.chs, pItem.pinyin)"
|
|
|
+ >
|
|
|
+ <template v-if="!pItem.width">
|
|
|
+ <template v-if="pItem.isShow">
|
|
|
+ <template
|
|
|
+ v-if="
|
|
|
+ item.wordsList[pIndex + 1].chs &&
|
|
|
+ chsFhList.indexOf(item.wordsList[pIndex + 1].chs) > -1
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <span class="NNPE-words-box">
|
|
|
+ <span
|
|
|
+ class="NNPE-pinyin"
|
|
|
+ :class="[pItem.className ? pItem.className : '']"
|
|
|
+ >{{ pItem.pinyin }}</span
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ class="NNPE-chs"
|
|
|
+ :class="[
|
|
|
+ curTime >= item.timeList[pItem.sentIndex].bg &&
|
|
|
+ curTime <= item.timeList[pItem.sentIndex].ed
|
|
|
+ ? 'active'
|
|
|
+ : '',
|
|
|
+ ]"
|
|
|
+ >{{ pItem.chs }}</span
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ <span class="NNPE-words-box">
|
|
|
+ <span class="NNPE-pinyin" style="text-align: left">{{
|
|
|
+ item.wordsList[pIndex + 1].pinyin
|
|
|
+ }}</span>
|
|
|
+ <span
|
|
|
+ class="NNPE-chs"
|
|
|
+ style="text-align: left"
|
|
|
+ :class="[
|
|
|
+ curTime >= item.timeList[pItem.sentIndex].bg &&
|
|
|
+ curTime <= item.timeList[pItem.sentIndex].ed
|
|
|
+ ? 'active'
|
|
|
+ : '',
|
|
|
+ ]"
|
|
|
+ >{{ item.wordsList[pIndex + 1].chs }}</span
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
<span
|
|
|
class="NNPE-pinyin"
|
|
|
- :class="[pItem.className ? pItem.className : '']"
|
|
|
- >{{ pItem.pinyin }}</span
|
|
|
- >
|
|
|
- <span
|
|
|
- class="NNPE-chs"
|
|
|
:class="[
|
|
|
- curTime >= item.timeList[pItem.sentIndex].bg &&
|
|
|
- curTime <= item.timeList[pItem.sentIndex].ed
|
|
|
- ? 'active'
|
|
|
- : '',
|
|
|
+ pItem.padding ? 'padding' : '',
|
|
|
+ pItem.className ? pItem.className : '',
|
|
|
]"
|
|
|
- >{{ pItem.chs }}</span
|
|
|
+ >{{ pItem.pinyin }}</span
|
|
|
>
|
|
|
- </span>
|
|
|
- <span class="NNPE-words-box">
|
|
|
- <span class="NNPE-pinyin" style="text-align: left">{{
|
|
|
- item.wordsList[pIndex + 1].pinyin
|
|
|
- }}</span>
|
|
|
<span
|
|
|
class="NNPE-chs"
|
|
|
- style="text-align: left"
|
|
|
:class="[
|
|
|
curTime >= item.timeList[pItem.sentIndex].bg &&
|
|
|
curTime <= item.timeList[pItem.sentIndex].ed
|
|
|
? 'active'
|
|
|
: '',
|
|
|
+ pItem.padding ? 'padding' : '',
|
|
|
]"
|
|
|
- >{{ item.wordsList[pIndex + 1].chs }}</span
|
|
|
+ >{{ pItem.chs }}</span
|
|
|
>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <span
|
|
|
- class="NNPE-pinyin"
|
|
|
- :class="[
|
|
|
- pItem.padding ? 'padding' : '',
|
|
|
- pItem.className ? pItem.className : '',
|
|
|
- ]"
|
|
|
- >{{ pItem.pinyin }}</span
|
|
|
- >
|
|
|
- <span
|
|
|
- class="NNPE-chs"
|
|
|
- :class="[
|
|
|
- curTime >= item.timeList[pItem.sentIndex].bg &&
|
|
|
- curTime <= item.timeList[pItem.sentIndex].ed
|
|
|
- ? 'active'
|
|
|
- : '',
|
|
|
- pItem.padding ? 'padding' : '',
|
|
|
- ]"
|
|
|
- >{{ pItem.chs }}</span
|
|
|
- >
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</template>
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <span
|
|
|
- :style="{
|
|
|
- height: pItem.height + 'px',
|
|
|
- width: pItem.width + 'px',
|
|
|
- }"
|
|
|
- ></span>
|
|
|
- </template>
|
|
|
+ <template v-else>
|
|
|
+ <span
|
|
|
+ :style="{
|
|
|
+ height: pItem.height + 'px',
|
|
|
+ width: pItem.width + 'px',
|
|
|
+ }"
|
|
|
+ ></span>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <img :src="articleImg[index + 1]" v-if="articleImg[index + 1]" />
|
|
|
</div>
|
|
|
- <img :src="articleImg[index + 1]" v-if="articleImg[index + 1]" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -133,6 +135,7 @@ export default {
|
|
|
isShow: false,
|
|
|
hz: "",
|
|
|
oldHz: "",
|
|
|
+ pinyin: "",
|
|
|
word: null,
|
|
|
top: 0,
|
|
|
left: 0,
|
|
@@ -145,7 +148,9 @@ export default {
|
|
|
hz: {
|
|
|
handler: function (val, oldVal) {
|
|
|
let _this = this;
|
|
|
- this.handleNewWords(val, this.top, this.left);
|
|
|
+ if (val) {
|
|
|
+ _this.handleNewWords(val, _this.top, _this.left);
|
|
|
+ }
|
|
|
},
|
|
|
// 深度观察监听
|
|
|
deep: true,
|
|
@@ -260,14 +265,27 @@ export default {
|
|
|
this.curTime = time;
|
|
|
this.$refs.audioLine.onTimeupdateTime(time / 1000);
|
|
|
},
|
|
|
- showWordDetail(e, word) {
|
|
|
+ showWordDetail(e, word, pinyin) {
|
|
|
let _this = this;
|
|
|
- this.isShow = true;
|
|
|
- _this.hz = word;
|
|
|
+ if (_this.oldHz != word) {
|
|
|
+ this.isShow = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.hz = word;
|
|
|
+ _this.pinyin = pinyin;
|
|
|
+ }, 50);
|
|
|
+ }
|
|
|
_this.top = e.clientY + 20;
|
|
|
let left = e.clientX;
|
|
|
+ let width = 0;
|
|
|
+ if (word.length == 1 || word.length == 2) {
|
|
|
+ width = 304;
|
|
|
+ } else if (word.length == 3 || word.length == 4) {
|
|
|
+ width = 432;
|
|
|
+ } else if (word.length > 3) {
|
|
|
+ width = 560;
|
|
|
+ }
|
|
|
if (left - this.bodyLeft > this.contentWidth / 2) {
|
|
|
- _this.left = left - 200;
|
|
|
+ _this.left = left - width;
|
|
|
} else {
|
|
|
_this.left = left;
|
|
|
}
|
|
@@ -284,14 +302,22 @@ export default {
|
|
|
handleNewWords(val, top, left) {
|
|
|
this.isShow = true;
|
|
|
this.word = null;
|
|
|
- for (let i = 0; i < this.NNPENewWordList.length; i++) {
|
|
|
- let item = this.NNPENewWordList[i];
|
|
|
- if (item.new_word.trim() == val.trim()) {
|
|
|
- let wordlist = val.split("");
|
|
|
- this.word = { list: wordlist, detail: item, top: top, left: left };
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ let wordlist = val.split("");
|
|
|
+ let option = {
|
|
|
+ definition_list: [],
|
|
|
+ mp3_list: [],
|
|
|
+ new_word: val,
|
|
|
+ pinyin: this.pinyin,
|
|
|
+ };
|
|
|
+ this.word = { list: wordlist, detail: option, top: top, left: left };
|
|
|
+ // for (let i = 0; i < this.NNPENewWordList.length; i++) {
|
|
|
+ // let item = this.NNPENewWordList[i];
|
|
|
+ // if (item.new_word.trim() == val.trim()) {
|
|
|
+ // let wordlist = val.split("");
|
|
|
+ // this.word = { list: wordlist, detail: item, top: top, left: left };
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
this.oldHz = val;
|
|
|
},
|
|
|
},
|
|
@@ -318,6 +344,9 @@ export default {
|
|
|
//@import url(); 引入公共css类
|
|
|
.NNPE-ArticleView {
|
|
|
width: 100%;
|
|
|
+ .NPC-sentences-list {
|
|
|
+ padding: 24px 0;
|
|
|
+ }
|
|
|
.NNPE-detail {
|
|
|
clear: both;
|
|
|
overflow: hidden;
|
|
@@ -409,6 +438,10 @@ export default {
|
|
|
.wordsList-box {
|
|
|
width: 100%;
|
|
|
padding: 6px 24px 12px 24px;
|
|
|
+ > div {
|
|
|
+ overflow: hidden;
|
|
|
+ clear: both;
|
|
|
+ }
|
|
|
> img {
|
|
|
width: 100%;
|
|
|
display: block;
|