1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387 |
- <!-- -->
- <template>
- <div class="NNPE-ArticleView" v-if="curQue">
- <div
- class="aduioLine-box aduioLine-practice-npc"
- v-if="
- (curQue.mp3_list &&
- curQue.mp3_list.length > 0 &&
- curQue.mp3_list[0].id) ||
- config.isHasPY ||
- config.isHasEN
- "
- >
- <div class="aduioLine-content">
- <template
- v-if="
- curQue.mp3_list &&
- curQue.mp3_list.length > 0 &&
- curQue.mp3_list[0].id
- "
- >
- <AudioLine
- audioId="diaPhraAudio"
- :mp3="curQue.mp3_list[0].id"
- :getCurTime="getCurTime"
- :mp3Source="curQue.mp3_list[0].source"
- :width="windowWidth - 220"
- ref="audioLine"
- :baseSizePhone="baseSizePhone"
- />
- </template>
- </div>
- <div class="aduioLine-right">
- <span
- :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
- @click="changePinyin"
- v-if="config.isHasPY"
- ></span>
- <span
- :class="['EN-16', config.isShowEN ? '' : 'disabled']"
- @click="changeEN"
- v-if="config.isHasEN"
- ></span>
- </div>
- </div>
- <template v-if="resArr.length > 0">
- <div class="NPC-sentences-list">
- <div class="NPC-article-empty">
- <div :class="['empty-left', isHasRemark ? 'hasRemark' : '']"></div>
- <div class="empty-right"></div>
- </div>
- <p
- :class="['notice', isHasRemark ? 'hasRemark' : '']"
- v-if="curQue.notice"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >
- {{ curQue.notice }}
- </p>
- <div
- :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
- v-for="(item, index) in resArr"
- :key="'detail' + index"
- >
- <div :class="['article-content', isHasRemark ? 'hasRemark' : '']">
- <RoleChs
- :curRole="item.roleDetail"
- :type="1"
- :baseSizePhone="baseSizePhone"
- />
- <div class="wordsList-box">
- <img
- :src="articleImg[index]"
- v-if="articleImg[0] && index == 0"
- />
- <div
- class="roleDetail"
- v-if="item.roleDetail.detail.wordsList.length > 0"
- >
- <span
- class="pinyin"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >{{ item.roleDetail.detail.wordsList | handlePinyin }}</span
- >
- <span
- class="chs"
- :style="{ fontSize: baseSizePhone + 2 + 'px' }"
- >{{ item.roleDetail.detail.wordsList | handleChs }}</span
- >
- </div>
- <div
- class="para-con"
- :style="{ background: item.roleDetail.color.bg }"
- >
- <div
- v-if="
- config.isShowEN &&
- item.enwords &&
- curQue.enPosition &&
- curQue.enPosition == 'top'
- "
- class="enwords"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >
- {{ item.enwords }}
- </div>
- <div style="clear: both; overflow: hidden"></div>
- <div
- class="NNPE-words"
- v-for="(pItem, pIndex) in item.wordsList"
- :key="'wordsList' + pIndex"
- :class="[
- pItem.chs != '“' && pItem.wordIndex == 0
- ? 'textLeft'
- : 'textCenter',
- pItem.chs == '“' ? 'textRight' : ''
- ]"
- @click="showWordDetail($event, pItem.chs, pItem.words)"
- >
- <template v-if="!pItem.width">
- <template v-if="pItem.isShow">
- <template
- v-if="
- item.wordsList[pIndex + 1] &&
- item.wordsList[pIndex + 1].chs &&
- (chsFhList.indexOf(item.wordsList[pIndex + 1].chs) >
- -1 ||
- NumberList.indexOf(
- item.wordsList[pIndex + 1].chs
- ) > -1)
- "
- >
- <span class="NNPE-words-box">
- <span
- v-if="
- curQue.pyPosition == 'top' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- class="NNPE-pinyin"
- :class="[
- pItem.className ? pItem.className : '',
- noFont.indexOf(item.pinyin) > -1 ? 'noFont' : ''
- ]"
- @click.stop="viewNotes($event, pItem.pinyin)"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >{{ pItem.pinyin }}</span
- >
- <span
- class="NNPE-chs"
- :class="[
- newWordList.indexOf(pItem.chs) > -1
- ? 'newActive'
- : '',
- pItem.words ? 'newActive' : ''
- ]"
- @click.stop="
- viewNotes(
- $event,
- pItem.words ? pItem.words : pItem.chs
- )
- "
- :style="{
- fontFamily: pItem.config.fontFamily,
- height: '28px',
- display: 'inline-block',
- fontSize: baseSizePhone + 6 + 'px'
- }"
- >{{
- NumberList.indexOf(pItem.pinyin) == -1
- ? pItem.chs
- : ""
- }}</span
- >
- <span
- v-if="
- curQue.pyPosition == 'bottom' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- class="NNPE-pinyin"
- :class="[
- pItem.className ? pItem.className : '',
- noFont.indexOf(item.pinyin) > -1 ? 'noFont' : ''
- ]"
- @click.stop="viewNotes($event, pItem.pinyin)"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >{{ pItem.pinyin }}</span
- >
- </span>
- <span class="NNPE-words-box">
- <span
- v-if="
- curQue.pyPosition == 'top' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- class="NNPE-pinyin"
- style="text-align: left"
- :class="[
- noFont.indexOf(
- item.wordsList[pIndex + 1].pinyin
- ) > -1
- ? 'noFont'
- : ''
- ]"
- @click.stop="
- viewNotes(
- $event,
- item.wordsList[pIndex + 1].pinyin
- )
- "
- :style="{ fontSize: baseSizePhone + 'px' }"
- >{{ item.wordsList[pIndex + 1].pinyin }}</span
- >
- <span
- class="NNPE-chs"
- style="text-align: left"
- @click.stop="
- viewNotes(
- $event,
- item.wordsList[pIndex + 1].words
- ? item.wordsList[pIndex + 1].words
- : item.wordsList[pIndex + 1].chs
- )
- "
- :style="{
- fontFamily:
- item.wordsList[pIndex + 1].config.fontFamily,
- height: '28px',
- display: 'inline-block',
- fontSize: baseSizePhone + 6 + 'px'
- }"
- >{{
- NumberList.indexOf(
- item.wordsList[pIndex + 1].pinyin
- ) == -1
- ? item.wordsList[pIndex + 1].chs
- : ""
- }}</span
- >
- <span
- v-if="
- curQue.pyPosition == 'bottom' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- class="NNPE-pinyin"
- :class="[
- noFont.indexOf(
- item.wordsList[pIndex + 1].pinyin
- ) > -1
- ? 'noFont'
- : ''
- ]"
- @click.stop="
- viewNotes(
- $event,
- item.wordsList[pIndex + 1].pinyin
- )
- "
- style="text-align: left"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >{{ item.wordsList[pIndex + 1].pinyin }}</span
- >
- </span>
- <span
- class="NNPE-words-box"
- v-if="
- item.wordsList[pIndex + 2] &&
- item.wordsList[pIndex + 2].chs &&
- (chsFhList.indexOf(
- item.wordsList[pIndex + 2].chs
- ) > -1 ||
- NumberList.indexOf(
- item.wordsList[pIndex + 2].chs
- ) > -1)
- "
- >
- <span
- v-if="
- curQue.pyPosition == 'top' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- :class="[
- 'NNPE-pinyin',
- noFont.indexOf(
- item.wordsList[pIndex + 2].pinyin
- ) > -1
- ? 'noFont'
- : ''
- ]"
- @click.stop="
- viewNotes(
- $event,
- item.wordsList[pIndex + 2].pinyin
- )
- "
- style="text-align: left"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >{{ item.wordsList[pIndex + 2].pinyin }}</span
- >
- <span
- class="NNPE-chs"
- style="text-align: left"
- :class="[
- pItem.chstimeList &&
- pItem.chstimeList[pItem.leg - 1] &&
- curTime >=
- pItem.chstimeList[pItem.leg - 1].wordBg &&
- curQue.wordTime &&
- curTime <= item.timeList[pItem.sentIndex].ed
- ? 'wordActive'
- : ''
- ]"
- @click.stop="
- viewNotes(
- $event,
- item.wordsList[pIndex + 2].words
- ? item.wordsList[pIndex + 2].words
- : item.wordsList[pIndex + 2].chs
- )
- "
- :style="{
- fontFamily:
- item.wordsList[pIndex + 2].config.fontFamily,
- height: '28px',
- display: 'inline-block',
- fontSize: baseSizePhone + 6 + 'px'
- }"
- >{{
- NumberList.indexOf(
- item.wordsList[pIndex + 2].pinyin
- ) == -1
- ? item.wordsList[pIndex + 2].chs
- : ""
- }}</span
- >
- <span
- v-if="
- curQue.pyPosition == 'bottom' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- :class="[
- 'NNPE-pinyin',
- noFont.indexOf(
- item.wordsList[pIndex + 2].pinyin
- ) > -1
- ? 'noFont'
- : ''
- ]"
- @click.stop="
- viewNotes(
- $event,
- item.wordsList[pIndex + 2].pinyin
- )
- "
- style="text-align: left"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >{{ item.wordsList[pIndex + 2].pinyin }}</span
- >
- </span>
- </template>
- <template v-else>
- <span
- v-if="
- curQue.pyPosition == 'top' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : ''
- ]"
- :style="{ fontSize: baseSizePhone + 'px' }"
- @click.stop="viewNotes($event, pItem.pinyin)"
- >{{ pItem.pinyin }}</span
- >
- <span
- v-if="pItem.chs != '#'"
- class="NNPE-chs"
- :class="[
- newWordList.indexOf(pItem.chs) > -1
- ? 'newActive'
- : '',
- pItem.chs != '“' && pItem.padding && config.isShowPY
- ? 'padding'
- : '',
- pItem.words ? 'newActive' : ''
- ]"
- @click.stop="
- viewNotes(
- $event,
- pItem.words ? pItem.words : pItem.chs
- )
- "
- :style="{
- fontFamily: pItem.config.fontFamily,
- height: '28px',
- display: 'inline-block',
- fontSize: baseSizePhone + 6 + 'px'
- }"
- >{{
- NumberList.indexOf(pItem.pinyin) == -1
- ? pItem.chs
- : ""
- }}</span
- >
- <span
- v-if="
- curQue.pyPosition == 'bottom' &&
- config.isShowPY &&
- item.dhaspinyin
- "
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : ''
- ]"
- :style="{ fontSize: baseSizePhone + 'px' }"
- @click.stop="viewNotes($event, pItem.pinyin)"
- >{{ pItem.pinyin }}</span
- >
- </template>
- </template>
- </template>
- <template v-else>
- <span
- :style="{
- height: pItem.height + 'px',
- width: pItem.width + 'px'
- }"
- ></span>
- </template>
- </div>
- <div style="clear: both; overflow: hidden"></div>
- <div
- v-if="
- config.isShowEN &&
- item.enwords &&
- (!curQue.enPosition ||
- (curQue.enPosition && curQue.enPosition == 'bottom'))
- "
- class="enwords"
- :style="{ fontSize: baseSizePhone + 'px' }"
- >
- {{ item.enwords }}
- </div>
- </div>
- <img :src="articleImg[index + 1]" v-if="articleImg[index + 1]" />
- </div>
- </div>
- <div class="remarkBox remark-top">
- <RemarkChs
- :remarkDetail="item.remarkDetail"
- :marginTop="item.roleDetail.detail.wordsList.length > 0 ? 44 : 8"
- :baseSizePhone="baseSizePhone"
- />
- </div>
- </div>
- <div class="NPC-article-empty NPC-article-empty-bottom">
- <div :class="['empty-left', isHasRemark ? 'hasRemark' : '']"></div>
- <div class="empty-right"></div>
- </div>
- <div class="dia-article-record" v-if="1 == 2">
- <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
- </div>
- </div>
- </template>
- <template v-if="isShow">
- <div
- ref="wordcard"
- class="NNPE-wordDetail"
- :style="{
- marginLeft:
- word.detail.new_word.length === 1
- ? '-152px'
- : windowWidth > word.detail.new_word.length * 126 + 48
- ? '-' + (word.detail.new_word.length * 63 + 24) + 'px'
- : '0px',
- left:
- windowWidth > word.detail.new_word.length * 126 + 48 ? '' : '0px'
- }"
- >
- <Wordcard
- :word="word"
- :changeWordCard="changeWordCard"
- :themeColor="themeColor"
- :currentTreeID="currentTreeID"
- :TaskModel="TaskModel"
- :writeList="curQue.Bookanswer.writeModel"
- @changeCurQue="changeCurQue"
- :mp3Url="wordPlayMp3"
- :bg="wordbgs"
- :ed="wordeds"
- :baseSizePhone="baseSizePhone"
- :themeColorPhone="themeColorPhone"
- />
- </div>
- </template>
- <template v-if="isNoteShow">
- <div
- ref="notecard"
- class="NNPE-wordDetail NNPE-noteDetail"
- :style="{
- marginLeft: windowWidth > 642 ? '-321px' : '0px',
- left: windowWidth > 642 ? '' : '0px'
- }"
- >
- <Notecard
- :item="curNoteCon"
- :changeCard="changeCard"
- :baseSizePhone="baseSizePhone"
- :themeColorPhone="themeColorPhone"
- />
- </div>
- </template>
- </div>
- </template>
- <script>
- import { timeStrToSen } from "../../../../utils/index";
- import AudioLine from "../AudioLine.vue";
- import Wordcard from "../components/Wordcard.vue"; // 卡片
- import Notecard from "../components/Notecard.vue"; // 注释
- import RoleChs from "./RoleChs.vue";
- import RemarkChs from "./RemarkChs.vue";
- import Soundrecord from "../Soundrecord.vue";
- export default {
- name: "PhraseModelChs",
- props: [
- "curQue",
- "bodyLeft",
- "NNPENewWordList",
- "NNPEAnnotationList",
- "colorBox",
- "themeColor",
- "noFont",
- "currentTreeID",
- "config",
- "TaskModel",
- "colLength",
- "NpcNewWordMp3",
- "baseSizePhone",
- "themeColorPhone"
- ],
- components: {
- AudioLine,
- Wordcard,
- RoleChs,
- RemarkChs,
- Soundrecord,
- Notecard
- },
- filters: {
- handlePinyin(wordsList) {
- let str = "";
- wordsList.forEach((item, index) => {
- if (index < wordsList.length - 1) {
- str += item.pinyin + " ";
- } else {
- str += item.pinyin;
- }
- });
- return str;
- },
- handleChs(wordsList) {
- let str = "";
- wordsList.forEach((item, index) => {
- if (index < wordsList.length - 1) {
- str += item.chs + " ";
- } else {
- str += item.chs;
- }
- });
- return str;
- }
- },
- data() {
- return {
- resArr: [],
- curTime: 0, //单位s
- chsFhList: [",", "。", "”", ":", "》", "?", "!", ";", "#", "、"],
- enFhList: [",", ".", ";", "?", "!", ":", ">", "<"],
- NumberList: [
- "①",
- "②",
- "③",
- "④",
- "⑤",
- "⑥",
- "⑦",
- "⑧",
- "⑨",
- "⑩",
- "⑪",
- "⑫",
- "⑬",
- "⑭",
- "⑮",
- "⑯",
- "⑰",
- "⑱",
- "⑲",
- "⑳"
- ],
- newWords: ["鱼", "辩礼义"],
- oldHz: "",
- hz: "",
- clientY: "",
- top: 0,
- left: 0,
- articleImg: {}, // 文章图片
- newWordList: [],
- word: null,
- isShow: false,
- screenHeight: 0,
- cardHeight: 0,
- isHasRemark: false,
- clickType: "",
- isNoteShow: false,
- noteNum: "",
- oldNoteNum: "",
- curNoteCon: null,
- contentWidth: 732,
- highWords: null,
- highWordsArr: [],
- highIndex: 0,
- wordbgs: 0,
- wordeds: 0,
- wordPlayMp3: "",
- windowWidth: window.innerWidth
- };
- },
- computed: {},
- watch: {
- hz: {
- handler: function(val, oldVal) {
- let _this = this;
- if (val) {
- _this.handleNewWords(val, _this.top, _this.left);
- }
- },
- // 深度观察监听
- deep: true
- },
- isShow: {
- handler: function(val, oldVal) {
- let _this = this;
- if (val) {
- setTimeout(() => {
- _this.cardHeight = _this.$refs.wordcard.offsetHeight;
- if (_this.screenHeight - _this.clientY > _this.cardHeight) {
- _this.top = _this.clientY + 20;
- } else {
- _this.top = _this.clientY - _this.cardHeight - 30;
- }
- }, 50);
- }
- },
- // 深度观察监听
- deep: true
- },
- noteNum: {
- handler: function(val, oldVal) {
- let _this = this;
- if (val) {
- _this.handleNote(val);
- }
- },
- // 深度观察监听
- deep: true
- },
- isNoteShow: {
- handler: function(val, oldVal) {
- let _this = this;
- if (val) {
- setTimeout(() => {
- _this.cardHeight = _this.$refs.notecard.offsetHeight;
- if (_this.screenHeight - _this.clientY > _this.cardHeight) {
- _this.top = _this.clientY + 20;
- } else {
- _this.top = _this.clientY - _this.cardHeight - 30;
- }
- }, 50);
- }
- },
- // 深度观察监听
- deep: true
- }
- },
- //方法集合
- methods: {
- //拼音的显示和隐藏
- changePinyin() {
- if (this.config.isHasPY) {
- this.$emit("changeConfig", "isShowPY");
- }
- },
- // 英文的显示和隐藏
- changeEN() {
- if (this.config.isHasEN) {
- this.$emit("changeConfig", "isShowEN");
- }
- },
- handleWav() {},
- getCurTime(curTime) {
- this.curTime = curTime;
- },
- handleData() {
- let resArr = [];
- let leg = this.curQue.detail.length;
- let curQue = JSON.parse(JSON.stringify(this.curQue));
- let dhaspinyin = false; // 每段是否有拼音
- curQue.detail.forEach((dItem, dIndex) => {
- dhaspinyin = false;
- let roleDetail = this.getRole(dItem);
- let remarkDetail = dItem.remark;
- if (
- remarkDetail &&
- (remarkDetail.chs ||
- remarkDetail.en ||
- (remarkDetail.img_list && remarkDetail.img_list.length > 0))
- ) {
- this.isHasRemark = true;
- }
- let paraArr = [];
- dItem.wordsList.forEach((sItem, sIndex) => {
- let sentence = dItem.sentences[sIndex];
- sItem.forEach((wItem, wIndex) => {
- //this.judgePad(sItem, wItem, wIndex);
- 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, //在段落中句子索引
- wordIndex: wIndex, //单词的索引
- pinyin: wItem.pinyin,
- chs: wItem.chs,
- padding: true, //wItem.padding,
- className: wItem.className,
- isShow: wItem.isShow,
- words: words,
- isNewWord: this.newWords.indexOf(wItem.chs) > -1 ? true : false,
- config: {
- fontFamily: wItem.fontFamily
- }
- };
- paraArr.push(obj);
- if (wItem.pinyin) dhaspinyin = true;
- });
- });
- let enwords =
- dItem.sentencesEn && dItem.sentencesEn.length > 0
- ? dItem.sentencesEn.join(" ").replace(/\'/g, "’")
- : "";
- let paraObj = {
- wordsList: paraArr,
- enwords: enwords,
- roleDetail: roleDetail,
- remarkDetail: remarkDetail,
- dhaspinyin: dhaspinyin
- };
- resArr.push(paraObj);
- });
- this.resArr = resArr;
- // 循环文章图片
- if (curQue.img_list) {
- curQue.img_list.forEach(item => {
- this.articleImg[item.imgNumber] = item.id;
- });
- }
- },
- 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(wItem) {
- if (
- this.chsFhList.indexOf(wItem.chs) > -1 ||
- this.NumberList.indexOf(wItem.chs) > -1
- ) {
- wItem.isShow = false;
- } else {
- wItem.isShow = true;
- }
- },
- //获取角色
- getRole(dItem) {
- let roleIndex = dItem.roleIndex;
- let resObj = null;
- let roleList = JSON.parse(JSON.stringify(this.curQue.roleList));
- for (let i = 0; i < roleList.length; i++) {
- let item = roleList[i];
- if (item.id == roleIndex) {
- resObj = item;
- resObj.color = this.colorBox[i];
- break;
- }
- }
- return resObj;
- },
- //判断是否有padding
- judgePad(sItem, wItem, curIndex) {
- let leg = sItem.length;
- if (curIndex < leg - 1) {
- let nextIndex = curIndex + 1;
- let chs = sItem[nextIndex].chs;
- if (
- this.chsFhList.indexOf(chs) > -1 ||
- this.chsFhList.indexOf(wItem.chs) > -1
- ) {
- wItem.padding = false;
- } else {
- wItem.padding = true;
- }
- if (this.enFhList.indexOf(wItem.pinyin) > -1) {
- wItem.className = "textLeft";
- }
- }
- },
- //转化时间
- handleTimeList(list) {
- let listRes = [];
- list.forEach(item => {
- let res = timeStrToSen(item);
- listRes.push(res);
- });
- return listRes;
- },
- //点击播放某个句子
- handleChangeTime(time) {
- this.curTime = time;
- this.$refs.audioLine.onTimeupdateTime(time);
- },
- handleNewword() {
- let NewWordList = [];
- this.NNPENewWordList.forEach(item => {
- 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));
- },
- showWordDetail(e, word, words) {
- let _this = this;
- _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) {
- width = 432;
- } else if (word.length > 3) {
- width = 560;
- }
- if (left - this.bodyLeft > this.contentWidth / 2) {
- _this.left = left - width + 10;
- } else {
- _this.left = left;
- }
- }
- },
- hideWordDetail() {
- this.isShow = false;
- },
- changeWordCard(isShow) {
- this.isShow = isShow;
- this.oldHz = "";
- this.hz = "";
- },
- // 处理分词数据
- handleNewWords(val, top, left) {
- this.isShow = true;
- this.word = null;
- for (let i = 0; i < this.NNPENewWordList.length; i++) {
- let pItem = this.NNPENewWordList[i];
- for (let j = 0; j < pItem.length; j++) {
- let item = pItem[j];
- if (item.new_word.trim() == val.trim()) {
- let wordlist = val.split("");
- this.word = JSON.parse(
- JSON.stringify({
- list: wordlist,
- detail: item,
- top: top,
- left: left
- })
- );
- break;
- }
- }
- }
- this.oldHz = val;
- },
- viewNotes(e, noteNum) {
- let _this = this;
- _this.clickType = "note";
- let noteIndex = "";
- _this.wordPlayMp3 = "";
- _this.NNPENewWordList.forEach(items => {
- items.forEach(itemn => {
- if (itemn.new_word === noteNum) {
- _this.wordbgs = itemn.bg;
- _this.wordeds = itemn.ed;
- _this.wordPlayMp3 = itemn.newWordMp3;
- }
- });
- });
- if (_this.NumberList.indexOf(noteNum) > -1) {
- for (let i = 0; i < _this.NumberList.length; i++) {
- if (_this.NumberList[i] == noteNum) {
- noteIndex = "" + i + "";
- break;
- }
- }
- this.showNoteDetail(e, noteIndex);
- } else {
- if (this.newWordList.indexOf(noteNum) > -1) {
- if (_this.oldHz != noteNum) {
- this.isShow = false;
- setTimeout(() => {
- _this.hz = noteNum;
- }, 50);
- }
- _this.clientY = e.clientY;
- let left = e.clientX;
- let width = 0;
- if (noteNum.length == 1 || noteNum.length == 2) {
- width = 304;
- } else if (noteNum.length == 3 || noteNum.length == 4) {
- width = 432;
- } else if (noteNum.length > 3) {
- width = 560;
- }
- if (left - this.bodyLeft > this.contentWidth / 2) {
- _this.left = left - width + 10;
- } else {
- _this.left = left;
- }
- }
- }
- },
- showNoteDetail(e, noteNum) {
- let _this = this;
- if (_this.oldNoteNum != noteNum) {
- this.isNoteShow = false;
- setTimeout(() => {
- _this.noteNum = noteNum;
- }, 50);
- }
- _this.clientY = e.clientY;
- let left = e.clientX;
- let width = 642;
- if (left - this.bodyLeft > this.contentWidth / 2) {
- _this.left = left - width + 10;
- } else {
- _this.left = left - 200;
- }
- },
- // 处理注释数据
- handleNote(val) {
- let _this = this;
- _this.isNoteShow = true;
- _this.oldNoteNum = val;
- let noteIndex = Number(val);
- if (_this.NNPEAnnotationList && _this.NNPEAnnotationList.length > 0) {
- _this.curNoteCon = _this.NNPEAnnotationList[noteIndex]
- ? _this.NNPEAnnotationList[noteIndex]
- : null;
- }
- },
- changeCard(isShow) {
- let _this = this;
- _this.isNoteShow = isShow;
- _this.oldNoteNum = "";
- _this.noteNum = "";
- },
- getScreenHeight() {
- this.screenHeight = window.innerHeight;
- },
- changeCurQue(answer) {
- if (answer) {
- let writeModel = this.curQue.Bookanswer.writeModel;
- let hz = answer.hz;
- if (writeModel.hasOwnProperty(hz)) {
- writeModel[hz].push(answer);
- } else {
- writeModel[hz] = [answer];
- }
- }
- }
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- if (this.NNPENewWordList && this.NNPENewWordList.length > 0) {
- this.handleNewword();
- }
- if (this.curQue) {
- this.handleData();
- }
- $(window).resize(() => {
- this.getScreenHeight();
- });
- this.getScreenHeight();
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang="scss" scoped>
- //@import url(); 引入公共css类
- .NNPE-ArticleView {
- width: 100%;
- .aduioLine-practice-npc {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .aduioLine-content {
- flex: 1;
- }
- .aduioLine-right {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 69px;
- height: 40px;
- box-sizing: border-box;
- padding: 0 12px;
- border-left: 1px solid rgba(0, 0, 0, 0.1);
- > span {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
- }
- }
- .NPC-sentences-list {
- .NPC-article-empty {
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- > div {
- height: 24px;
- &.empty-left {
- width: 100%;
- box-sizing: border-box;
- &.hasRemark {
- width: calc(100% - 120px);
- box-sizing: border-box;
- border-right: 1px rgba(0, 0, 0, 0.1) solid;
- }
- }
- &.empty-right {
- flex: 1;
- }
- }
- &-bottom {
- > div {
- height: 40px;
- }
- }
- }
- .dia-article-record {
- width: 100%;
- border-top: 1px solid rgba(0, 0, 0, 0.1);
- .luyin-box {
- justify-content: start;
- padding: 8px 12px;
- height: 40px;
- width: 280px;
- justify-content: flex-start;
- }
- }
- }
- .NNPE-detail {
- clear: both;
- // overflow: hidden; // 为了不遮挡备注内容
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- &.active {
- background: rgba(0, 0, 0, 0.06);
- }
- .article-content {
- width: 100%;
- box-sizing: border-box;
- padding: 8px 24px 8px 24px;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- &.hasRemark {
- width: calc(100% - 120px);
- border-right: 1px rgba(0, 0, 0, 0.1) solid;
- padding: 8px 0px 8px 23px;
- }
- &.paraLast {
- padding-bottom: 24px;
- }
- }
- .enwords {
- font-family: Helvetica;
- font-weight: normal;
- font-size: 14px;
- line-height: 22px;
- color: rgba(0, 0, 0, 0.85);
- padding-left: 3px;
- word-break: break-word;
- }
- .NNPE-words {
- float: left;
- &-box {
- float: left;
- > span {
- display: block;
- &.NNPE-pinyin {
- font-family: "GB-PINYINOK-B";
- font-weight: normal;
- font-size: 14px;
- line-height: 22px;
- color: #000000;
- height: 22px;
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- }
- &.NNPE-chs {
- font-family: "FZJCGFKTK";
- font-size: 20px;
- line-height: 28px;
- color: #000000;
- &.active {
- background: rgba(60, 200, 99, 0.2);
- }
- &.wordActive {
- color: #de4444;
- }
- &.newActive {
- color: #de4444;
- }
- }
- &.padding {
- padding: 0 3px;
- }
- }
- }
- &.textLeft {
- text-align: left;
- }
- &.textCenter {
- text-align: center;
- }
- &.textRight {
- text-align: right;
- }
- > span {
- display: block;
- &.NNPE-pinyin {
- font-family: "GB-PINYINOK-B";
- font-weight: normal;
- font-size: 14px;
- line-height: 22px;
- color: #000000;
- height: 22px;
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- }
- &.NNPE-chs {
- font-family: "FZJCGFKTK";
- font-size: 20px;
- line-height: 28px;
- color: #000000;
- &.active {
- background: rgba(60, 200, 99, 0.2);
- }
- &.wordActive {
- color: #de4444;
- }
- &.newActive {
- color: #de4444;
- }
- }
- &.padding {
- padding: 0 3px;
- }
- }
- }
- &.NNPE-detail-title {
- .wordsList-box {
- > div {
- display: flex;
- justify-content: center;
- flex-flow: wrap;
- }
- }
- }
- .index {
- width: 48px;
- box-sizing: border-box;
- padding: 8px;
- text-align: right;
- border-right: 1px solid rgba(0, 0, 0, 0.1);
- b {
- font-weight: 400;
- color: #000000;
- line-height: 1.5;
- }
- }
- .wordsList-box {
- width: 100%;
- padding: 0px 24px 0px 8px;
- clear: both;
- overflow: hidden;
- .roleDetail {
- min-height: 36px;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .pinyin {
- font-family: "GB-PINYINOK-B";
- font-size: 14px;
- line-height: 22px;
- color: rgba(0, 0, 0, 0.85);
- margin-right: 4px;
- }
- .chs {
- font-family: "FZJCGFKTK";
- font-size: 16px;
- line-height: 24px;
- color: rgba(0, 0, 0, 0.85);
- }
- }
- > .para-con {
- float: left;
- border: 1px solid rgba(0, 0, 0, 0.1);
- box-sizing: border-box;
- padding: 8px 12px 8px 12px;
- border-radius: 8px;
- }
- > img {
- width: 100%;
- display: block;
- }
- }
- }
- .remarkBox {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- &.remark72 {
- padding-top: 72px;
- }
- &.remark-top {
- padding-top: 44px;
- }
- }
- .NNPE-wordDetail {
- position: fixed;
- z-index: 116;
- top: 50%;
- margin-top: -196px;
- left: 50%;
- max-width: 100%;
- overflow: auto;
- box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.15);
- }
- .NNPE-noteDetail {
- margin-top: -130px;
- padding: 8px;
- box-shadow: none;
- }
- }
- </style>
|