| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434 |
- <!-- -->
- <template>
- <div v-if="curQue" class="NNPE-ArticleView">
- <div
- v-if="
- ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
- config.isHasPY ||
- config.isHasEN) &&
- curQue.property.mp3_position === 'top'
- "
- class="aduioLine-box aduioLine-practice-npc"
- >
- <div class="aduioLine-content">
- <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
- <AudioLine
- ref="audioLine"
- audio-id="artPhraseAudio"
- :mp3="curQue.mp3_list[0].url"
- :get-cur-time="getCurTime"
- :mp3-source="curQue.mp3_list[0].source"
- :width="colLength == 2 ? 200 : 700"
- />
- </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> -->
- <SvgIcon
- v-if="config.isHasPY"
- icon-class="pin-btn"
- size="16"
- :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
- :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
- @click="changePinyin"
- />
- <SvgIcon
- v-if="config.isHasEN"
- icon-class="en-btn"
- size="16"
- :class="['EN-16', config.isShowEN ? '' : 'disabled']"
- :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
- @click="changeEN"
- />
- </div>
- </div>
- <template v-if="!config.isHasEN || (config.isHasEN && !config.isShowEN)">
- <template v-if="resArr.length > 0">
- <div class="NPC-sentences-list">
- <div
- v-for="(item, index) in resArr"
- :key="'detail' + index"
- :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
- >
- <div
- class="wordsList-box"
- :class="[
- curQue.detail[index].paragraphAttr
- ? 'wordsList-box-' + curQue.detail[index].paragraphAttr.paragraphAlign
- : '',
- ]"
- >
- <img v-if="articleImg[0] && index == 0" :src="articleImg[index]" />
- <div>
- <div
- v-for="(pItem, pIndex) in item.wordsList"
- :key="'wordsList' + pIndex"
- class="NNPE-words"
- :class="[
- pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
- pItem.chs == '“' ? 'textRight' : '',
- ]"
- >
- <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
- "
- >
- <span class="NNPE-words-box" @click="showWordDetail($event, pItem)">
- <span
- v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
- class="NNPE-pinyin"
- :class="[pItem.className ? pItem.className : '']"
- >{{ pItem.pinyin }}</span
- >
- <span
- class="NNPE-chs"
- :class="[
- item.timeList &&
- item.timeList[pItem.sentIndex] &&
- curTime >= item.timeList[pItem.sentIndex].bg &&
- curTime <= item.timeList[pItem.sentIndex].ed &&
- curTime
- ? 'active'
- : '',
- paraIndex == pItem.paraIndex &&
- sentIndex == pItem.sentIndex &&
- wordIndex == pItem.wordIndex
- ? 'wordActive'
- : '',
- ]"
- :style="{
- fontFamily: pItem.config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs : '' }}</span
- >
- <span
- v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
- class="NNPE-pinyin"
- :class="[pItem.className ? pItem.className : '']"
- >{{ pItem.pinyin }}</span
- >
- </span>
- <span class="NNPE-words-box" @click="showWordDetail($event, item.wordsList[pIndex + 1])">
- <span
- v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
- class="NNPE-pinyin"
- style="text-align: left"
- >{{ item.wordsList[pIndex + 1].pinyin }}</span
- >
- <span
- class="NNPE-chs"
- style="text-align: left"
- :class="[
- item.timeList &&
- item.timeList[pItem.sentIndex] &&
- curTime >= item.timeList[pItem.sentIndex].bg &&
- curTime <= item.timeList[pItem.sentIndex].ed &&
- curTime
- ? 'active'
- : '',
- ]"
- :style="{
- fontFamily: item.wordsList[pIndex + 1].config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- >{{
- NumberList.indexOf(item.wordsList[pIndex + 1].pinyin) == -1
- ? item.wordsList[pIndex + 1].chs
- : ''
- }}</span
- >
- <span
- v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
- class="NNPE-pinyin"
- style="text-align: left"
- >{{ item.wordsList[pIndex + 1].pinyin }}</span
- >
- </span>
- <span
- v-if="
- item.wordsList[pIndex + 2] &&
- item.wordsList[pIndex + 2].chs &&
- chsFhList.indexOf(item.wordsList[pIndex + 2].chs) > -1
- "
- class="NNPE-words-box"
- @click="showWordDetail($event, item.wordsList[pIndex + 2])"
- >
- <span
- v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
- :class="[
- 'NNPE-pinyin',
- noFont.indexOf(item.wordsList[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
- ]"
- style="text-align: left"
- >{{ item.wordsList[pIndex + 2].pinyin }}</span
- >
- <span
- class="NNPE-chs"
- style="text-align: left"
- :class="[
- item.timeList &&
- item.timeList[pItem.sentIndex] &&
- curTime >= item.timeList[pItem.sentIndex].bg &&
- curTime <= item.timeList[pItem.sentIndex].ed &&
- curTime
- ? 'active'
- : '',
- pItem.paraIndex == paraIndex && pItem.sentIndex == sentIndex ? 'overActive' : '',
- pItem.chstimeList &&
- pItem.chstimeList[pItem.leg - 1] &&
- curTime >= pItem.chstimeList[pItem.leg - 1].wordBg &&
- curQue.wordTime &&
- curTime <= item.timeList[pItem.sentIndex].ed
- ? 'wordActive'
- : '',
- ]"
- :style="{
- fontFamily: item.wordsList[pIndex + 2].config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- >{{
- NumberList.indexOf(item.wordsList[pIndex + 2].pinyin) == -1
- ? item.wordsList[pIndex + 2].chs
- : ''
- }}</span
- >
- <span
- v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
- :class="[
- 'NNPE-pinyin',
- noFont.indexOf(item.wordsList[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
- ]"
- style="text-align: left"
- >{{ item.wordsList[pIndex + 2].pinyin }}</span
- >
- </span>
- </template>
- <template v-else>
- <span
- v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- ]"
- >{{ pItem.pinyin }}</span
- >
- <span
- class="NNPE-chs"
- :class="[
- item.timeList &&
- item.timeList[pItem.sentIndex] &&
- curTime >= item.timeList[pItem.sentIndex].bg &&
- curTime <= item.timeList[pItem.sentIndex].ed &&
- curTime
- ? 'active'
- : '',
- pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
- ]"
- :style="{
- fontFamily: pItem.config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- @click="showWordDetail($event, pItem)"
- >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs : '' }}</span
- >
- <span
- v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- ]"
- >{{ pItem.pinyin }}</span
- >
- </template>
- </template>
- </template>
- <template v-else>
- <span
- :style="{
- height: pItem.height + 'px',
- width: pItem.width + 'px',
- }"
- ></span>
- </template>
- </div>
- </div>
- <div
- v-if="curQue.property.multilingual_position === 'para'"
- class="multilingual-para"
- :class="[item.isTitle ? 'multilingual-para-center' : '']"
- >
- {{
- curQue.detail[index].multilingualTextList && curQue.detail[index].multilingualTextList[multilingual]
- ? curQue.detail[index].multilingualTextList[multilingual].join(' ')
- : ''
- }}
- </div>
- <img v-if="articleImg[index + 1]" :src="articleImg[index + 1]" />
- </div>
- </div>
- <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
- {{ items }}
- </div> -->
- </div>
- </template>
- </template>
- <template v-else>
- <template v-if="resObj">
- <!-- -->
- <div class="NPC-sentences-list">
- <div
- v-for="(item, index) in resObj.sentList"
- :key="'detail' + index"
- :class="['NNPE-detail-box', sentIndex == index ? 'active' : '']"
- >
- <div :class="['NNPE-details']">
- <div
- v-if="item.enwords && config.isShowEN && curQue.enPosition && curQue.enPosition == 'top'"
- :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
- >
- {{ item.enwords }}
- </div>
- <div style="overflow: hidden; clear: both"></div>
- <div
- v-for="(pItem, pIndex) in item.sentArr"
- :key="'wordsList' + pIndex"
- class="NNPE-words"
- :class="[
- pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
- pItem.chs == '“' ? 'textRight' : '',
- ]"
- >
- <template v-if="!pItem.width">
- <template v-if="pItem.isShow">
- <template
- v-if="
- item.sentArr[pIndex + 1] &&
- item.sentArr[pIndex + 1].chs &&
- chsFhList.indexOf(item.sentArr[pIndex + 1].chs) > -1
- "
- >
- <span class="NNPE-words-box" @click="showWordDetail($event, pItem)">
- <template v-if="curQue.property.pinyin_position == 'top'">
- <span
- v-if="config.isShowPY"
- class="NNPE-pinyin"
- :class="[
- pItem.className ? pItem.className : '',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
- ]"
- >{{ pItem.pinyin }}</span
- >
- </template>
- <span
- class="NNPE-chs"
- :class="[
- pItem.padding && config.isShowPY ? 'padding' : '',
- sentIndex == index ? 'wordBlank' : '',
- ]"
- >
- <template>
- <span
- v-for="(wItem, wIndex) in pItem.leg"
- :key="'ci' + wIndex + pIndex + index"
- :class="[]"
- :style="{
- fontFamily: pItem.config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs[wIndex] : '' }}</span
- >
- </template>
- </span>
- <template v-if="curQue.property.pinyin_position == 'bottom'">
- <span
- v-if="config.isShowPY"
- class="NNPE-pinyin"
- :class="[
- pItem.className ? pItem.className : '',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
- ]"
- >{{ pItem.pinyin }}</span
- >
- </template>
- </span>
- <span class="NNPE-words-box" @click="showWordDetail($event, item.sentArr[pIndex + 1])">
- <template v-if="curQue.property.pinyin_position == 'top'">
- <span
- v-if="config.isShowPY"
- :class="[
- 'NNPE-pinyin',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
- ]"
- style="text-align: left"
- >{{ item.sentArr[pIndex + 1].pinyin }}</span
- >
- </template>
- <span class="NNPE-chs" style="text-align: left">
- <span
- :class="[]"
- :style="{
- fontFamily: item.sentArr[pIndex + 1].config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- >
- {{
- NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
- ? item.sentArr[pIndex + 1].chs
- : ''
- }}</span
- >
- </span>
- <template v-if="curQue.property.pinyin_position == 'bottom'">
- <span
- v-if="config.isShowPY"
- :class="[
- 'NNPE-pinyin',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
- ]"
- style="text-align: left"
- >{{ item.sentArr[pIndex + 1].pinyin }}</span
- >
- </template>
- </span>
- <span
- v-if="
- item.sentArr[pIndex + 2] &&
- item.sentArr[pIndex + 2].chs &&
- chsFhList.indexOf(item.sentArr[pIndex + 2].chs) > -1
- "
- class="NNPE-words-box"
- @click="showWordDetail($event, item.sentArr[pIndex + 2])"
- >
- <template v-if="curQue.property.pinyin_position == 'top'">
- <span
- v-if="config.isShowPY"
- :class="[
- 'NNPE-pinyin',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
- ]"
- style="text-align: left"
- >{{ item.sentArr[pIndex + 2].pinyin }}</span
- >
- </template>
- <span class="NNPE-chs" style="text-align: left">
- <span
- :class="[]"
- :style="{
- fontFamily: item.sentArr[pIndex + 2].config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- >
- {{
- NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
- ? item.sentArr[pIndex + 2].chs
- : ''
- }}</span
- >
- </span>
- <template v-if="curQue.property.pinyin_position == 'bottom'">
- <span
- v-if="config.isShowPY"
- :class="[
- 'NNPE-pinyin',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
- ]"
- style="text-align: left"
- >{{ item.sentArr[pIndex + 2].pinyin }}</span
- >
- </template>
- </span>
- </template>
- <template v-else>
- <template v-if="curQue.property.pinyin_position == 'top'">
- <span
- v-if="config.isShowPY"
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
- ]"
- >{{ pItem.pinyin }}</span
- >
- </template>
- <span
- class="NNPE-chs"
- :class="[
- pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
- sentIndex == index ? 'wordBlank' : '',
- ]"
- >
- <template>
- <span
- v-for="(wItem, wIndex) in pItem.leg"
- :key="'ci' + wIndex + pIndex + index"
- :class="[]"
- :style="{
- fontFamily: pItem.config.fontFamily,
- height: '28px',
- display: 'inline-block',
- }"
- >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs[wIndex] : '' }}</span
- >
- </template>
- </span>
- <template v-if="curQue.property.pinyin_position == 'bottom'">
- <span
- v-if="config.isShowPY"
- class="NNPE-pinyin"
- :class="[
- pItem.chs != '“' && pItem.padding ? 'padding' : '',
- pItem.className ? pItem.className : '',
- sentIndex == index ? 'wordBlank' : '',
- noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
- ]"
- >{{ pItem.pinyin }}</span
- >
- </template>
- </template>
- </template>
- </template>
- <template v-else>
- <span
- :style="{
- height: pItem.height + 'px',
- width: pItem.width + 'px',
- }"
- ></span>
- </template>
- </div>
- <div style="overflow: hidden; clear: both"></div>
- <div
- v-if="
- item.enwords &&
- config.isShowEN &&
- (!curQue.enPosition || (curQue.enPosition && curQue.enPosition == 'bottom'))
- "
- :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
- >
- {{ item.enwords }}
- </div>
- <div
- v-if="curQue.property.multilingual_position === 'para'"
- class="multilingual-para"
- :class="[item.isTitle ? 'multilingual-para-center' : '']"
- >
- {{
- curQue.detail[index].multilingualTextList[multilingual]
- ? curQue.detail[index].multilingualTextList[multilingual].join(' ')
- : ''
- }}
- </div>
- </div>
- </div>
- <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
- {{ items }}
- </div> -->
- </div>
- </template>
- </template>
- <div v-for="(items, indexs) in curQue.detail" :key="indexs" class="multilingual">
- <div
- v-if="curQue.property.multilingual_position === 'all'"
- class="multilingual-para"
- :class="[items.isTitle ? 'multilingual-para-center' : '']"
- >
- {{
- items.multilingualTextList && items.multilingualTextList[multilingual]
- ? items.multilingualTextList[multilingual].join(' ')
- : ''
- }}
- </div>
- </div>
- <div
- v-if="
- ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
- config.isHasPY ||
- config.isHasEN) &&
- curQue.property.mp3_position === 'bottom'
- "
- class="aduioLine-box aduioLine-practice-npc aduioLine-box-bottom"
- >
- <div class="aduioLine-content">
- <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
- <AudioLine
- ref="audioLine"
- audio-id="artPhraseAudio"
- :mp3="curQue.mp3_list[0].url"
- :get-cur-time="getCurTime"
- :mp3-source="curQue.mp3_list[0].source"
- :width="colLength == 2 ? 200 : 700"
- />
- </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> -->
- <SvgIcon
- v-if="config.isHasPY"
- icon-class="pin-btn"
- size="16"
- :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
- :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
- @click="changePinyin"
- />
- <SvgIcon
- v-if="config.isHasEN"
- icon-class="en-btn"
- size="16"
- :class="['EN-16', config.isShowEN ? '' : 'disabled']"
- :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
- @click="changeEN"
- />
- </div>
- </div>
- <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"
- :change-word-card="changeWordCard"
- :theme-color="themeColor"
- :current-tree-i-d="currentTreeID"
- :TaskModel="TaskModel"
- :write-list="curQue.Bookanswer.writeModel"
- :attrib="attrib"
- @changeCurQue="changeCurQue"
- />
- </div>
- </template>
- </div>
- </template>
- <script>
- import AudioLine from '../voice_matrix/components/AudioLine.vue';
- import Wordcard from './components/Wordcard.vue'; // 卡片
- export default {
- name: 'WordModelChs',
- components: {
- AudioLine,
- Wordcard,
- },
- props: [
- 'curQue',
- 'bodyLeft',
- 'NNPENewWordList',
- 'themeColor',
- 'currentTreeID',
- 'config',
- 'TaskModel',
- 'colLength',
- 'noFont',
- 'multilingual',
- 'attrib',
- ],
- data() {
- return {
- resArr: [],
- resObj: null,
- curTime: 0, // 单位s
- chsFhList: [',', '。', '”', ':', '》', '?', '!', ';', '、', '……'],
- enFhList: [',', '.', ';', '?', '!', ':', '>', '<'],
- NumberList: ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'],
- newWords: ['鱼', '辩礼义'],
- isShow: false,
- hz: '',
- oldHz: '',
- pinyin: '',
- word: null,
- clientY: 0,
- top: 0,
- left: 0,
- contentWidth: 732,
- articleImg: {}, // 文章图片
- paraIndex: -1,
- sentIndex: -1,
- wordIndex: -1,
- screenHeight: 0,
- cardHeight: 0,
- windowWidth: window.innerWidth,
- };
- },
- computed: {},
- watch: {
- hz: {
- handler(val, oldVal) {
- let _this = this;
- if (val) {
- if (_this.NumberList.indexOf(val) > -1) {
- return;
- }
- _this.handleNewWords(val, _this.top, _this.left);
- }
- },
- // 深度观察监听
- deep: true,
- },
- isShow: {
- handler(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;
- // }
- }, 0);
- }
- },
- // 深度观察监听
- deep: true,
- },
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- if (this.curQue) {
- this.handleData();
- }
- window.addEventListener('resize', this.getScreenHeight);
- this.getScreenHeight();
- },
- beforeCreate() {}, // 生命周期 - 创建之前
- beforeMount() {}, // 生命周期 - 挂载之前
- beforeUpdate() {}, // 生命周期 - 更新之前
- updated() {}, // 生命周期 - 更新之后
- beforeDestroy() {
- this.isShow = false;
- window.removeEventListener('resize', this.getScreenHeight);
- }, // 生命周期 - 销毁之前
- destroyed() {}, // 生命周期 - 销毁完成
- activated() {},
- // 方法集合
- methods: {
- // 拼音的显示和隐藏
- changePinyin() {
- if (this.config.isHasPY) {
- this.$emit('changeConfig', 'isShowPY');
- }
- },
- // 英文的显示和隐藏
- changeEN() {
- if (this.config.isHasEN) {
- this.$emit('changeConfig', 'isShowEN');
- }
- },
- getCurTime(curTime) {
- this.curTime = curTime * 1000;
- this.getSentIndex(this.curTime);
- },
- getSentIndex(curTime) {
- for (let i = 0; i < this.curQue.wordTime.length; i++) {
- let bg = this.curQue.wordTime[i].bg;
- let ed = this.curQue.wordTime[i].ed;
- if (curTime >= bg && curTime <= ed) {
- this.sentIndex = i;
- break;
- }
- }
- },
- 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 paraArr = [];
- if (!dItem.isTitle) {
- paraArr = [
- {
- pinyin: '',
- chs: '',
- width: 20,
- height: 20,
- },
- {
- width: 20,
- height: 20,
- pinyin: '',
- chs: '',
- },
- ];
- }
- dItem.wordsList.forEach((sItem, sIndex) => {
- sItem.forEach((wItem, wIndex) => {
- // this.judgePad(sItem, wItem, wIndex);
- this.mergeWordSymbol(sItem, wItem, wIndex);
- let obj = {
- paraIndex: dIndex, // 段落索引
- sentIndex: sIndex, // 在段落中句子索引
- wordIndex: wIndex, // 单词的索引
- pinyin:
- curQue.pinyin_type === 'pinyin'
- ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
- ? wItem.pinyin_up
- : wItem.pinyin
- : wItem.pinyin_tone,
- chs: wItem.chs,
- padding: true,
- className: wItem.className,
- isShow: wItem.isShow,
- isNewWord: this.newWords.indexOf(wItem.chs) > -1,
- config: {
- fontFamily: wItem.fontFamily,
- },
- };
- paraArr.push(obj);
- if (wItem.pinyin) dhaspinyin = true;
- });
- });
- let curSentencesLeg = dItem.sentences.length;
- let startLeg = dIndex == 0 ? 0 : curQue.detail[dIndex - 1].endLeg;
- let endLeg = startLeg + curSentencesLeg;
- dItem.endLeg = endLeg;
- let timeList = curQue.wordTime.slice(startLeg, endLeg);
- let paraObj = {
- wordsList: paraArr,
- timeList,
- dhaspinyin,
- isTitle: dItem.isTitle,
- };
- resArr.push(paraObj);
- });
- this.resArr = resArr;
- // 循环文章图片
- if (curQue.img_list) {
- curQue.img_list.forEach((item) => {
- this.articleImg[item.imgNumber] = item.id;
- });
- }
- let resArrs = [];
- let sentArrTotal = [];
- let timeArr = [];
- let wordTimeList = curQue.wordTime;
- curQue.detail.forEach((dItem, dIndex) => {
- dItem.wordsList.forEach((sItem, sIndex) => {
- let sentArr = [];
- sItem.forEach((wItem, wIndex) => {
- 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);
- this.mergeWordSymbol(wItem);
- let obj = {
- paraIndex: dIndex, // 段落索引
- sentIndex: sIndex, // 在段落中句子索引
- wordIndex: wIndex, // 单词的索引
- pinyin:
- curQue.pinyin_type === 'pinyin'
- ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
- ? wItem.pinyin_up
- : wItem.pinyin
- : wItem.pinyin_tone,
- chs: wItem.chs,
- padding: true,
- className: wItem.className,
- isShow: wItem.isShow,
- startIndex,
- endIndex,
- leg: wItem.chs.length,
- timeList: [],
- };
- sentArr.push(obj);
- });
- let objs = {
- sentArr,
- enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
- };
- sentArrTotal.push(sentArr);
- resArrs.push(objs);
- });
- timeArr.push(dItem.timeList);
- });
- if (wordTimeList && wordTimeList.length > 0) {
- this.mergeWordTime(sentArrTotal, wordTimeList);
- }
- let timeList = [];
- timeArr.forEach((item) => {
- item.forEach((aItem) => {
- if (timeList.indexOf(aItem) < 0) {
- timeList.push(aItem);
- }
- });
- });
- this.resObj = { sentList: resArrs, timeList };
- },
- mergeWordTime(resArr, wordTimeList) {
- resArr.forEach((item, index) => {
- let wordsResultList = wordTimeList[index].wordsResultList;
- item.forEach((wItem) => {
- let startIndex = wItem.startIndex;
- let endIndex = wItem.endIndex;
- wItem.timeList = wordsResultList.slice(startIndex, endIndex);
- });
- });
- },
- // 词和标点合一起
- mergeWordSymbol(sItem, wItem, curIndex) {
- let leg = sItem.length;
- if (wItem && wItem.chs) {
- if (this.chsFhList.indexOf(wItem.chs) > -1) {
- wItem.isShow = false;
- } else {
- wItem.isShow = true;
- }
- }
- },
- mergeWordSymbols(wItem) {
- if (this.chsFhList.indexOf(wItem.chs) > -1 || this.NumberList.indexOf(wItem.chs) > -1) {
- wItem.isShow = false;
- } else {
- wItem.isShow = true;
- }
- },
- // 判断是否有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;
- },
- // 分:秒转秒
- timeStrToSen(time) {
- if (!time) {
- return -1;
- }
- let pos = time.indexOf(':');
- let min = 0;
- let sec = 0;
- if (pos > 0) {
- min = parseInt(time.substring(0, pos));
- sec = parseFloat(time.substring(pos + 1));
- }
- return min * 60 + sec;
- },
- // 点击播放某个句子
- handleChangeTime(time) {
- this.curTime = time;
- this.$refs.audioLine.onTimeupdateTime(time / 1000);
- },
- showWordDetail(e, item) {
- let _this = this;
- if (
- this.chsFhList.indexOf(item.chs) > -1 ||
- item.chs == '“' ||
- item.chs == '(' ||
- /^[a-zA-Z0-9]/.test(item.chs)
- ) {
- return false;
- }
- if (_this.oldHz != item.chs) {
- this.isShow = false;
- setTimeout(() => {
- _this.hz = item.chs;
- _this.pinyin = item.pinyin;
- _this.paraIndex = item.paraIndex;
- _this.sentIndex = item.sentIndex;
- _this.wordIndex = item.wordIndex;
- }, 50);
- }
- _this.clientY = e.clientY;
- let left = e.clientX;
- let width = 0;
- if (item.chs.length == 1 || item.chs.length == 2) {
- width = 304;
- } else if (item.chs.length == 3 || item.chs.length == 4) {
- width = 432;
- } else if (item.chs.length > 3) {
- width = 560;
- }
- if (left - this.bodyLeft > this.contentWidth / 2) {
- _this.left = left - width + 30;
- } else {
- _this.left = left - 30;
- }
- },
- changeWordCard(isShow) {
- let _this = this;
- _this.isShow = isShow;
- _this.oldHz = '';
- _this.hz = '';
- _this.paraIndex = -1;
- _this.sentIndex = -1;
- _this.wordIndex = -1;
- },
- // 处理分词数据
- handleNewWords(val) {
- this.isShow = true;
- this.word = null;
- let wordlist = val.split('');
- let option = {
- definition_list: [],
- mp3_list: [],
- new_word: val,
- pinyin: this.pinyin,
- };
- this.word = { list: wordlist, detail: option };
- this.oldHz = val;
- },
- getScreenHeight() {
- this.screenHeight = window.innerHeight;
- },
- changeCurQue(answer) {
- if (answer) {
- let writeModel = this.curQue.Bookanswer.writeModel;
- let hz = answer.hz;
- if (writeModel.hasOwn(hz)) {
- writeModel[hz].push(answer);
- } else {
- writeModel[hz] = [answer];
- }
- }
- },
- }, // 如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang="scss" scoped>
- //@import url(); 引入公共css类
- .NNPE-ArticleView {
- width: 100%;
- .aduioLine-practice-npc {
- display: flex;
- align-items: center;
- justify-content: flex-start;
- .aduioLine-content {
- flex: 1;
- }
- .aduioLine-right {
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 69px;
- height: 40px;
- padding: 0 12px;
- border-left: 1px solid rgba(0, 0, 0, 10%);
- > span {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
- }
- }
- .NPC-sentences-list {
- padding: 24px 0;
- }
- .multilingual {
- padding: 6px 24px 12px;
- word-break: break-word;
- }
- .NNPE-detail {
- overflow: hidden;
- clear: both;
- color: rgba(0, 0, 0, 85%);
- .NNPE-words {
- float: left;
- &-box {
- float: left;
- > span {
- display: block;
- &.NNPE-pinyin {
- height: 22px;
- font-family: 'League';
- font-size: 14px;
- font-weight: normal;
- line-height: 22px;
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- }
- &.NNPE-chs {
- font-family: '楷体';
- font-size: 20px;
- line-height: 28px;
- &.active {
- background: rgba(36, 185, 158, 15%);
- }
- // &.wordActive {
- // color: #de4444;
- // }
- }
- &.padding {
- padding: 0 3px;
- }
- }
- }
- &.textLeft {
- text-align: left;
- }
- &.textCenter {
- text-align: center;
- }
- &.textRight {
- text-align: right;
- }
- > span {
- display: block;
- &.NNPE-pinyin {
- height: 22px;
- font-family: 'League';
- font-size: 14px;
- font-weight: normal;
- line-height: 22px;
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- }
- &.NNPE-chs {
- font-family: '楷体';
- font-size: 20px;
- line-height: 28px;
- &.active {
- background: rgba(36, 185, 158, 15%);
- }
- // &.wordActive {
- // color: #de4444;
- // }
- }
- &.padding {
- padding: 0 3px;
- }
- }
- }
- &.NNPE-detail-title {
- .wordsList-box {
- > div {
- display: flex;
- flex-flow: wrap;
- justify-content: center;
- width: 100%;
- }
- }
- }
- .index {
- box-sizing: border-box;
- width: 48px;
- padding: 8px;
- text-align: right;
- border-right: 1px solid rgba(0, 0, 0, 10%);
- b {
- font-weight: 400;
- line-height: 1.5;
- color: #000;
- }
- }
- .wordsList-box {
- // display: flex;
- width: 100%;
- padding: 6px 24px 12px;
- &-left {
- justify-content: flex-start;
- }
- &-center {
- justify-content: center;
- }
- &-right {
- justify-content: flex-end;
- }
- > div {
- overflow: hidden;
- clear: both;
- }
- > img {
- display: block;
- max-width: 100%;
- margin: 0 auto;
- }
- }
- }
- }
- .NNPE-wordDetail {
- position: fixed;
- top: 50%;
- left: 50%;
- z-index: 116;
- max-width: 100%;
- margin-top: -196px;
- overflow: auto;
- box-shadow: 0 4px 16px rgba(0, 0, 0, 15%);
- // width: 260px;
- // height: 200px;
- // background: #cc0;
- }
- .NNPE-detail-box {
- box-sizing: border-box;
- width: 100%;
- padding: 8px 24px;
- margin-bottom: 8px;
- &.active {
- background: rgba(222, 68, 68, 15%);
- }
- }
- .NNPE-details {
- overflow: hidden;
- clear: both;
- .NNPE-words {
- float: left;
- &-box {
- float: left;
- > span {
- display: block;
- &.NNPE-pinyin {
- height: 20px;
- font-family: 'League';
- font-size: 14px;
- font-weight: normal;
- line-height: 20px;
- color: rgba(0, 0, 0, 85%);
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- &.wordBlank {
- color: rgba(0, 0, 0, 85%);
- }
- }
- &.NNPE-chs {
- font-family: '楷体';
- font-size: 20px;
- line-height: 28px;
- color: rgba(0, 0, 0, 85%);
- .active {
- color: #de4444;
- }
- &.wordBlank {
- color: rgba(0, 0, 0, 85%);
- }
- }
- // &.padding {
- // padding-right: 6px;
- // }
- }
- }
- &.textLeft {
- text-align: left;
- }
- &.textCenter {
- text-align: center;
- }
- &.textRight {
- text-align: right;
- }
- > span {
- display: block;
- &.NNPE-pinyin {
- height: 20px;
- font-family: 'League';
- font-size: 14px;
- font-weight: normal;
- line-height: 20px;
- color: rgba(0, 0, 0, 85%);
- &.noFont {
- font-family: initial;
- }
- &.textLeft {
- text-align: left;
- }
- &.wordBlank {
- color: rgba(0, 0, 0, 85%);
- }
- }
- &.NNPE-chs {
- font-family: '楷体';
- font-size: 20px;
- line-height: 28px;
- color: rgba(0, 0, 0, 85%);
- .active {
- color: #de4444;
- }
- &.wordBlank {
- color: rgba(0, 0, 0, 85%);
- }
- }
- &.padding {
- padding: 0 3px;
- }
- }
- }
- }
- .enwords {
- padding-left: 3px;
- font-family: 'Helvetica';
- font-size: 14px;
- font-weight: normal;
- line-height: 22px;
- color: rgba(0, 0, 0, 85%);
- word-break: break-word;
- &.wordBlank {
- color: rgba(0, 0, 0, 85%);
- }
- }
- .multilingual-para {
- text-indent: 40px;
- word-break: break-word;
- &-center {
- text-align: center;
- text-indent: 0;
- }
- }
- .NPC-Big-Book-preview-green {
- .NNPE-ArticleView {
- .NNPE-detail-box {
- &.active {
- background: rgba(36, 185, 158, 15%);
- }
- }
- }
- }
- .NPC-Big-Book-preview-brown {
- .NNPE-ArticleView {
- .NNPE-detail-box {
- &.active {
- background: rgba(189, 136, 101, 15%);
- }
- }
- }
- }
- </style>
|