PhraseModelChs.vue 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796
  1. <!-- -->
  2. <template>
  3. <div v-if="curQue" class="NNPE-ArticleView">
  4. <div
  5. v-if="
  6. ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
  7. config.isHasPY ||
  8. config.isHasEN) &&
  9. curQue.property.mp3_position === 'top'
  10. "
  11. class="aduioLine-box aduioLine-practice-npc"
  12. >
  13. <div class="aduioLine-content">
  14. <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
  15. <AudioLine
  16. ref="audioLine"
  17. audio-id="artPhraseAudio"
  18. :mp3="curQue.mp3_list[0].url"
  19. :get-cur-time="getCurTime"
  20. :mp3-source="curQue.mp3_list[0].source"
  21. :width="colLength == 2 ? 200 : 700"
  22. :attrib="attrib"
  23. />
  24. </template>
  25. </div>
  26. <div class="aduioLine-right">
  27. <!-- <span
  28. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  29. @click="changePinyin"
  30. v-if="config.isHasPY"
  31. ></span>
  32. <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  33. <SvgIcon
  34. v-if="config.isHasPY"
  35. icon-class="pin-btn"
  36. size="16"
  37. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  38. :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  39. @click="changePinyin"
  40. />
  41. <SvgIcon
  42. v-if="config.isHasEN"
  43. icon-class="en-btn"
  44. size="16"
  45. :class="['EN-16', config.isShowEN ? '' : 'disabled']"
  46. :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  47. @click="changeEN"
  48. />
  49. </div>
  50. </div>
  51. <template v-if="!config.isHasEN || (config.isHasEN && !config.isShowEN)">
  52. <template v-if="resArr.length > 0">
  53. <div class="NPC-sentences-list">
  54. <div
  55. v-for="(item, index) in resArr"
  56. :key="'detail' + index"
  57. :class="['NNPE-detail', item.isTitle ? 'NNPE-detail-title' : '']"
  58. >
  59. <div
  60. class="wordsList-box"
  61. :class="[
  62. curQue.detail[index].paragraphAttr
  63. ? 'wordsList-box-' + curQue.detail[index].paragraphAttr.paragraphAlign
  64. : '',
  65. ]"
  66. >
  67. <img v-if="articleImg[0] && index == 0" :src="articleImg[index]" />
  68. <div>
  69. <div
  70. v-for="(pItem, pIndex) in item.wordsList"
  71. :key="'wordsList' + pIndex"
  72. class="NNPE-words"
  73. :class="[
  74. pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
  75. pItem.chs == '“' ? 'textRight' : '',
  76. ]"
  77. @click="showWordDetail($event, pItem.chs, pItem.words)"
  78. >
  79. <template v-if="!pItem.width">
  80. <template v-if="pItem.isShow">
  81. <template
  82. v-if="
  83. item.wordsList[pIndex + 1] &&
  84. item.wordsList[pIndex + 1].chs &&
  85. (chsFhList.indexOf(item.wordsList[pIndex + 1].chs) > -1 ||
  86. NumberList.indexOf(item.wordsList[pIndex + 1].chs) > -1)
  87. "
  88. >
  89. <span class="NNPE-words-box">
  90. <span
  91. v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
  92. :class="[
  93. 'NNPE-pinyin',
  94. pItem.className ? pItem.className : '',
  95. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  96. ]"
  97. @click.stop="viewNotes($event, pItem.pinyin)"
  98. :style="{
  99. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  100. height:
  101. attrib && attrib.pinyin_size
  102. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  103. : '22px',
  104. }"
  105. >{{ pItem.pinyin }}</span
  106. >
  107. <span
  108. :class="[
  109. 'NNPE-chs',
  110. newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
  111. pItem.words ? 'active' : '',
  112. ]"
  113. :style="{
  114. fontFamily: pItem.config.fontFamily,
  115. height:
  116. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  117. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  118. lineHeight:
  119. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  120. display: 'inline-block',
  121. color:
  122. newWordList.indexOf(pItem.chs) > -1 || pItem.words
  123. ? attrib
  124. ? attrib.topic_color
  125. : ''
  126. : '',
  127. }"
  128. @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs)"
  129. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs : '' }}</span
  130. >
  131. <span
  132. v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
  133. :class="[
  134. 'NNPE-pinyin',
  135. pItem.className ? pItem.className : '',
  136. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  137. ]"
  138. @click.stop="viewNotes($event, pItem.pinyin)"
  139. :style="{
  140. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  141. height:
  142. attrib && attrib.pinyin_size
  143. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  144. : '22px',
  145. }"
  146. >{{ pItem.pinyin }}</span
  147. >
  148. </span>
  149. <span class="NNPE-words-box">
  150. <span
  151. v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
  152. :class="[
  153. 'NNPE-pinyin',
  154. noFont.indexOf(item.wordsList[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  155. ]"
  156. style="text-align: left"
  157. :style="{
  158. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  159. height:
  160. attrib && attrib.pinyin_size
  161. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  162. : '22px',
  163. }"
  164. @click.stop="viewNotes($event, item.wordsList[pIndex + 1].pinyin)"
  165. >{{ item.wordsList[pIndex + 1].pinyin }}</span
  166. >
  167. <span
  168. class="NNPE-chs"
  169. style="text-align: left"
  170. :style="{
  171. fontFamily: item.wordsList[pIndex + 1].config.fontFamily,
  172. height:
  173. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  174. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  175. lineHeight:
  176. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  177. display: 'inline-block',
  178. }"
  179. @click.stop="
  180. viewNotes(
  181. $event,
  182. item.wordsList[pIndex + 1].words
  183. ? item.wordsList[pIndex + 1].words
  184. : item.wordsList[pIndex + 1].chs,
  185. )
  186. "
  187. >{{
  188. NumberList.indexOf(item.wordsList[pIndex + 1].pinyin) == -1
  189. ? item.wordsList[pIndex + 1].chs
  190. : ''
  191. }}</span
  192. >
  193. <span
  194. v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
  195. :class="[
  196. 'NNPE-pinyin',
  197. noFont.indexOf(item.wordsList[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  198. ]"
  199. style="text-align: left"
  200. :style="{
  201. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  202. height:
  203. attrib && attrib.pinyin_size
  204. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  205. : '22px',
  206. }"
  207. @click.stop="viewNotes($event, item.wordsList[pIndex + 1].pinyin)"
  208. >{{ item.wordsList[pIndex + 1].pinyin }}</span
  209. >
  210. </span>
  211. <span
  212. v-if="
  213. item.wordsList[pIndex + 2] &&
  214. item.wordsList[pIndex + 2].chs &&
  215. (chsFhList.indexOf(item.wordsList[pIndex + 2].chs) > -1 ||
  216. NumberList.indexOf(item.wordsList[pIndex + 2].chs) > -1)
  217. "
  218. class="NNPE-words-box"
  219. >
  220. <span
  221. v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
  222. :class="[
  223. 'NNPE-pinyin',
  224. noFont.indexOf(item.wordsList[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  225. ]"
  226. style="text-align: left"
  227. :style="{
  228. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  229. height:
  230. attrib && attrib.pinyin_size
  231. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  232. : '22px',
  233. }"
  234. @click.stop="viewNotes($event, item.wordsList[pIndex + 2].pinyin)"
  235. >{{ item.wordsList[pIndex + 2].pinyin }}</span
  236. >
  237. <span
  238. class="NNPE-chs"
  239. style="text-align: left"
  240. :style="{
  241. fontFamily: item.wordsList[pIndex + 2].config.fontFamily,
  242. height:
  243. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  244. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  245. lineHeight:
  246. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  247. display: 'inline-block',
  248. }"
  249. @click.stop="
  250. viewNotes(
  251. $event,
  252. item.wordsList[pIndex + 2].words
  253. ? item.wordsList[pIndex + 2].words
  254. : item.wordsList[pIndex + 2].chs,
  255. )
  256. "
  257. >{{
  258. NumberList.indexOf(item.wordsList[pIndex + 2].pinyin) == -1
  259. ? item.wordsList[pIndex + 2].chs
  260. : ''
  261. }}</span
  262. >
  263. <span
  264. v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
  265. :class="[
  266. 'NNPE-pinyin',
  267. noFont.indexOf(item.wordsList[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  268. ]"
  269. style="text-align: left"
  270. :style="{
  271. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  272. height:
  273. attrib && attrib.pinyin_size
  274. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  275. : '22px',
  276. }"
  277. @click.stop="viewNotes($event, item.wordsList[pIndex + 2].pinyin)"
  278. >{{ item.wordsList[pIndex + 2].pinyin }}</span
  279. >
  280. </span>
  281. </template>
  282. <template v-else>
  283. <span
  284. v-if="curQue.property.pinyin_position == 'top' && config.isShowPY && item.dhaspinyin"
  285. class="NNPE-pinyin"
  286. :class="[
  287. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  288. pItem.className ? pItem.className : '',
  289. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  290. ]"
  291. :style="{
  292. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  293. height:
  294. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  295. }"
  296. @click.stop="viewNotes($event, pItem.pinyin)"
  297. >{{ pItem.pinyin }}</span
  298. >
  299. <span
  300. class="NNPE-chs"
  301. :class="[
  302. pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
  303. newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
  304. pItem.words ? 'active' : '',
  305. ]"
  306. :style="{
  307. fontFamily: pItem.config.fontFamily,
  308. height:
  309. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  310. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  311. lineHeight:
  312. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  313. display: 'inline-block',
  314. color:
  315. newWordList.indexOf(pItem.chs) > -1 || pItem.words
  316. ? attrib
  317. ? attrib.topic_color
  318. : ''
  319. : '',
  320. }"
  321. @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs)"
  322. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs : '' }}</span
  323. >
  324. <span
  325. v-if="curQue.property.pinyin_position == 'bottom' && config.isShowPY && item.dhaspinyin"
  326. class="NNPE-pinyin"
  327. :class="[
  328. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  329. pItem.className ? pItem.className : '',
  330. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  331. ]"
  332. :style="{
  333. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  334. height:
  335. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  336. }"
  337. @click.stop="viewNotes($event, pItem.pinyin)"
  338. >{{ pItem.pinyin }}</span
  339. >
  340. </template>
  341. </template>
  342. </template>
  343. <template v-else>
  344. <span
  345. :style="{
  346. height: pItem.height + 'px',
  347. width: pItem.width + 'px',
  348. }"
  349. ></span>
  350. </template>
  351. </div>
  352. </div>
  353. <div
  354. v-if="curQue.property.multilingual_position === 'para'"
  355. class="multilingual-para"
  356. :class="[item.isTitle ? 'multilingual-para-center' : '']"
  357. >
  358. {{
  359. curQue.detail[index].multilingualTextList && curQue.detail[index].multilingualTextList[multilingual]
  360. ? curQue.detail[index].multilingualTextList[multilingual].join(' ')
  361. : ''
  362. }}
  363. </div>
  364. <img v-if="articleImg[index + 1]" :src="articleImg[index + 1]" />
  365. </div>
  366. </div>
  367. <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
  368. {{ items }}
  369. </div> -->
  370. </div>
  371. </template>
  372. </template>
  373. <template v-else>
  374. <template v-if="resObj">
  375. <!-- -->
  376. <div class="NPC-sentences-list">
  377. <div v-for="(item, index) in resObj.sentList" :key="'detail' + index" :class="['NNPE-detail-box']">
  378. <div :class="['NNPE-details']">
  379. <div
  380. v-if="item.enwords && config.isShowEN && curQue.enPosition && curQue.enPosition == 'top'"
  381. :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
  382. >
  383. {{ item.enwords }}
  384. </div>
  385. <div style="overflow: hidden; clear: both"></div>
  386. <div
  387. v-for="(pItem, pIndex) in item.sentArr"
  388. :key="'wordsList' + pIndex"
  389. class="NNPE-words"
  390. :class="[
  391. pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
  392. pItem.chs == '“' ? 'textRight' : '',
  393. ]"
  394. @click="showWordDetail($event, pItem.chs, pItem.words)"
  395. >
  396. <template v-if="!pItem.width">
  397. <template v-if="pItem.isShow">
  398. <template
  399. v-if="
  400. item.sentArr[pIndex + 1] &&
  401. item.sentArr[pIndex + 1].chs &&
  402. (chsFhList.indexOf(item.sentArr[pIndex + 1].chs) > -1 ||
  403. NumberList.indexOf(item.sentArr[pIndex + 1].chs) > -1)
  404. "
  405. >
  406. <span class="NNPE-words-box">
  407. <template v-if="curQue.property.pinyin_position == 'top'">
  408. <span
  409. v-if="config.isShowPY"
  410. class="NNPE-pinyin"
  411. :class="[
  412. pItem.className ? pItem.className : '',
  413. sentIndex == index ? 'wordBlank' : '',
  414. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  415. ]"
  416. :style="{
  417. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  418. height:
  419. attrib && attrib.pinyin_size
  420. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  421. : '22px',
  422. }"
  423. @click.stop="viewNotes($event, pItem.pinyin)"
  424. >{{ pItem.pinyin }}</span
  425. >
  426. </template>
  427. <span
  428. class="NNPE-chs"
  429. :class="[
  430. pItem.padding && config.isShowPY ? 'padding' : '',
  431. sentIndex == index ? 'wordBlank' : '',
  432. newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
  433. pItem.words ? 'active' : '',
  434. ]"
  435. >
  436. <template>
  437. <span
  438. v-for="(wItem, wIndex) in pItem.leg"
  439. :key="'ci' + wIndex + pIndex + index"
  440. :class="[]"
  441. :style="{
  442. fontFamily: pItem.config.fontFamily,
  443. height:
  444. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  445. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  446. lineHeight:
  447. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  448. display: 'inline-block',
  449. }"
  450. @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs)"
  451. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs[wIndex] : '' }}</span
  452. >
  453. </template>
  454. </span>
  455. <template v-if="curQue.property.pinyin_position == 'bottom'">
  456. <span
  457. v-if="config.isShowPY"
  458. class="NNPE-pinyin"
  459. :class="[
  460. pItem.className ? pItem.className : '',
  461. sentIndex == index ? 'wordBlank' : '',
  462. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  463. ]"
  464. :style="{
  465. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  466. height:
  467. attrib && attrib.pinyin_size
  468. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  469. : '22px',
  470. }"
  471. @click.stop="viewNotes($event, pItem.pinyin)"
  472. >{{ pItem.pinyin }}</span
  473. >
  474. </template>
  475. </span>
  476. <span class="NNPE-words-box">
  477. <template v-if="curQue.property.pinyin_position == 'top'">
  478. <span
  479. v-if="config.isShowPY"
  480. :class="[
  481. 'NNPE-pinyin',
  482. sentIndex == index ? 'wordBlank' : '',
  483. noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  484. ]"
  485. style="text-align: left"
  486. :style="{
  487. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  488. height:
  489. attrib && attrib.pinyin_size
  490. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  491. : '22px',
  492. }"
  493. @click.stop="viewNotes($event, item.sentArr[pIndex + 1].pinyin)"
  494. >{{ item.sentArr[pIndex + 1].pinyin }}</span
  495. >
  496. </template>
  497. <span class="NNPE-chs" style="text-align: left">
  498. <span
  499. :class="[]"
  500. :style="{
  501. fontFamily: item.sentArr[pIndex + 1].config.fontFamily,
  502. height:
  503. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  504. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  505. lineHeight:
  506. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  507. display: 'inline-block',
  508. }"
  509. @click.stop="
  510. viewNotes(
  511. $event,
  512. item.sentArr[pIndex + 1].words
  513. ? item.sentArr[pIndex + 1].words
  514. : item.sentArr[pIndex + 1].chs,
  515. )
  516. "
  517. >
  518. {{
  519. NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
  520. ? item.sentArr[pIndex + 1].chs
  521. : ''
  522. }}</span
  523. >
  524. </span>
  525. <template v-if="curQue.property.pinyin_position == 'bottom'">
  526. <span
  527. v-if="config.isShowPY"
  528. :class="[
  529. 'NNPE-pinyin',
  530. sentIndex == index ? 'wordBlank' : '',
  531. noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  532. ]"
  533. style="text-align: left"
  534. :style="{
  535. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  536. height:
  537. attrib && attrib.pinyin_size
  538. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  539. : '22px',
  540. }"
  541. @click.stop="viewNotes($event, item.sentArr[pIndex + 1].pinyin)"
  542. >{{ item.sentArr[pIndex + 1].pinyin }}</span
  543. >
  544. </template>
  545. </span>
  546. <span
  547. v-if="
  548. item.sentArr[pIndex + 2] &&
  549. item.sentArr[pIndex + 2].chs &&
  550. chsFhList.indexOf(item.sentArr[pIndex + 2].chs) > -1
  551. "
  552. class="NNPE-words-box"
  553. >
  554. <template v-if="curQue.property.pinyin_position == 'top'">
  555. <span
  556. v-if="config.isShowPY"
  557. :class="[
  558. 'NNPE-pinyin',
  559. sentIndex == index ? 'wordBlank' : '',
  560. noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  561. ]"
  562. style="text-align: left"
  563. :style="{
  564. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  565. height:
  566. attrib && attrib.pinyin_size
  567. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  568. : '22px',
  569. }"
  570. @click.stop="viewNotes($event, item.sentArr[pIndex + 2].pinyin)"
  571. >{{ item.sentArr[pIndex + 2].pinyin }}</span
  572. >
  573. </template>
  574. <span class="NNPE-chs" style="text-align: left">
  575. <span
  576. :class="[]"
  577. :style="{
  578. fontFamily: item.sentArr[pIndex + 2].config.fontFamily,
  579. height:
  580. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  581. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  582. lineHeight:
  583. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  584. display: 'inline-block',
  585. }"
  586. @click.stop="
  587. viewNotes(
  588. $event,
  589. item.sentArr[pIndex + 2].words
  590. ? item.sentArr[pIndex + 2].words
  591. : item.sentArr[pIndex + 2].chs,
  592. )
  593. "
  594. >
  595. {{
  596. NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
  597. ? item.sentArr[pIndex + 2].chs
  598. : ''
  599. }}</span
  600. >
  601. </span>
  602. <template v-if="curQue.property.pinyin_position == 'bottom'">
  603. <span
  604. v-if="config.isShowPY"
  605. :class="[
  606. 'NNPE-pinyin',
  607. sentIndex == index ? 'wordBlank' : '',
  608. noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  609. ]"
  610. style="text-align: left"
  611. :style="{
  612. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  613. height:
  614. attrib && attrib.pinyin_size
  615. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  616. : '22px',
  617. }"
  618. @click.stop="viewNotes($event, item.sentArr[pIndex + 1].pinyin)"
  619. >{{ item.sentArr[pIndex + 2].pinyin }}</span
  620. >
  621. </template>
  622. </span>
  623. </template>
  624. <template v-else>
  625. <template v-if="curQue.property.pinyin_position == 'top'">
  626. <span
  627. v-if="config.isShowPY"
  628. class="NNPE-pinyin"
  629. :class="[
  630. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  631. pItem.className ? pItem.className : '',
  632. sentIndex == index ? 'wordBlank' : '',
  633. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  634. ]"
  635. :style="{
  636. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  637. height:
  638. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  639. }"
  640. @click.stop="viewNotes($event, pItem.pinyin)"
  641. >{{ pItem.pinyin }}</span
  642. >
  643. </template>
  644. <span
  645. class="NNPE-chs"
  646. :class="[
  647. pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
  648. sentIndex == index ? 'wordBlank' : '',
  649. newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
  650. pItem.words ? 'active' : '',
  651. ]"
  652. >
  653. <template>
  654. <span
  655. v-for="(wItem, wIndex) in pItem.leg"
  656. :key="'ci' + wIndex + pIndex + index"
  657. :class="[]"
  658. :style="{
  659. fontFamily: pItem.config.fontFamily,
  660. height:
  661. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  662. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  663. lineHeight:
  664. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  665. display: 'inline-block',
  666. }"
  667. @click.stop="viewNotes($event, pItem.words ? pItem.words : pItem.chs)"
  668. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs[wIndex] : '' }}</span
  669. >
  670. </template>
  671. </span>
  672. <template v-if="curQue.property.pinyin_position == 'bottom'">
  673. <span
  674. v-if="config.isShowPY"
  675. class="NNPE-pinyin"
  676. :class="[
  677. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  678. pItem.className ? pItem.className : '',
  679. sentIndex == index ? 'wordBlank' : '',
  680. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  681. ]"
  682. :style="{
  683. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  684. height:
  685. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  686. }"
  687. @click.stop="viewNotes($event, pItem.pinyin)"
  688. >{{ pItem.pinyin }}</span
  689. >
  690. </template>
  691. </template>
  692. </template>
  693. </template>
  694. <template v-else>
  695. <span
  696. :style="{
  697. height: pItem.height + 'px',
  698. width: pItem.width + 'px',
  699. }"
  700. ></span>
  701. </template>
  702. </div>
  703. <div style="overflow: hidden; clear: both"></div>
  704. <div
  705. v-if="
  706. item.enwords &&
  707. config.isShowEN &&
  708. (!curQue.enPosition || (curQue.enPosition && curQue.enPosition == 'bottom'))
  709. "
  710. :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
  711. >
  712. {{ item.enwords }}
  713. </div>
  714. <div
  715. v-if="curQue.property.multilingual_position === 'para'"
  716. class="multilingual-para"
  717. :class="[item.isTitle ? 'multilingual-para-center' : '']"
  718. >
  719. {{
  720. curQue.detail[index].multilingualTextList[multilingual]
  721. ? curQue.detail[index].multilingualTextList[multilingual].join(' ')
  722. : ''
  723. }}
  724. </div>
  725. </div>
  726. </div>
  727. <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
  728. {{ items }}
  729. </div> -->
  730. </div>
  731. </template>
  732. </template>
  733. <template v-for="(items, indexs) in curQue.detail">
  734. <div
  735. v-if="
  736. curQue.property.multilingual_position === 'all' &&
  737. items.multilingualTextList &&
  738. items.multilingualTextList[multilingual] &&
  739. items.multilingualTextList[multilingual].length > 0
  740. "
  741. :key="indexs"
  742. class="multilingual"
  743. >
  744. <div class="multilingual-para" :class="[items.isTitle ? 'multilingual-para-center' : '']">
  745. {{
  746. items.multilingualTextList && items.multilingualTextList[multilingual]
  747. ? items.multilingualTextList[multilingual].join(' ')
  748. : ''
  749. }}
  750. </div>
  751. </div>
  752. </template>
  753. <div
  754. v-if="
  755. ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
  756. config.isHasPY ||
  757. config.isHasEN) &&
  758. curQue.property.mp3_position === 'bottom'
  759. "
  760. class="aduioLine-box aduioLine-practice-npc aduioLine-box-bottom"
  761. >
  762. <div class="aduioLine-content">
  763. <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
  764. <AudioLine
  765. ref="audioLine"
  766. audio-id="artPhraseAudio"
  767. :mp3="curQue.mp3_list[0].url"
  768. :get-cur-time="getCurTime"
  769. :mp3-source="curQue.mp3_list[0].source"
  770. :width="colLength == 2 ? 200 : 700"
  771. :attrib="attrib"
  772. />
  773. </template>
  774. </div>
  775. <div class="aduioLine-right">
  776. <!-- <span
  777. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  778. @click="changePinyin"
  779. v-if="config.isHasPY"
  780. ></span>
  781. <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  782. <SvgIcon
  783. v-if="config.isHasPY"
  784. icon-class="pin-btn"
  785. size="16"
  786. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  787. :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  788. @click="changePinyin"
  789. />
  790. <SvgIcon
  791. v-if="config.isHasEN"
  792. icon-class="en-btn"
  793. size="16"
  794. :class="['EN-16', config.isShowEN ? '' : 'disabled']"
  795. :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  796. @click="changeEN"
  797. />
  798. </div>
  799. </div>
  800. <template v-if="isShow">
  801. <div
  802. ref="wordcard"
  803. class="NNPE-wordDetail"
  804. :style="{
  805. marginLeft:
  806. word.detail.new_word.length === 1
  807. ? '-152px'
  808. : windowWidth > word.detail.new_word.length * 126 + 48
  809. ? '-' + (word.detail.new_word.length * 63 + 24) + 'px'
  810. : '0px',
  811. left: windowWidth > word.detail.new_word.length * 126 + 48 ? '' : '0px',
  812. }"
  813. >
  814. <Wordcard
  815. :word="word"
  816. :change-word-card="changeWordCard"
  817. :theme-color="themeColor"
  818. :current-tree-i-d="currentTreeID"
  819. :TaskModel="TaskModel"
  820. :write-list="curQue.Bookanswer.writeModel"
  821. :mp3-url="activeWord ? activeWord.newWordMp3 : ''"
  822. :bg="activeWord ? activeWord.bg : null"
  823. :ed="activeWord ? activeWord.ed : null"
  824. :attrib="attrib"
  825. @changeCurQue="changeCurQue"
  826. />
  827. </div>
  828. </template>
  829. <template v-if="isNoteShow">
  830. <div
  831. ref="notecard"
  832. class="NNPE-wordDetail"
  833. :style="{
  834. marginLeft: windowWidth > 642 ? '-321px' : '0px',
  835. left: windowWidth > 642 ? '' : '0px',
  836. }"
  837. >
  838. <Notecard :item="curNoteCon" :change-card="changeCard" :attrib="attrib" />
  839. </div>
  840. </template>
  841. </div>
  842. </template>
  843. <script>
  844. import AudioLine from '../voice_matrix/components/AudioLine.vue';
  845. import Wordcard from './components/Wordcard.vue'; // 卡片
  846. import Notecard from './components/Notecard.vue'; // 注释
  847. import $ from 'jquery';
  848. export default {
  849. name: 'PhraseModelChs',
  850. components: {
  851. AudioLine,
  852. Wordcard,
  853. Notecard,
  854. },
  855. props: [
  856. 'curQue',
  857. 'bodyLeft',
  858. 'NNPENewWordList',
  859. 'themeColor',
  860. 'noFont',
  861. 'currentTreeID',
  862. 'config',
  863. 'TaskModel',
  864. 'NNPEAnnotationList',
  865. 'colLength',
  866. 'multilingual',
  867. 'attrib',
  868. ],
  869. data() {
  870. return {
  871. resArr: [],
  872. resObj: null,
  873. curTime: 0, // 单位s
  874. chsFhList: [',', '。', '”', ':', '》', '?', '!', ';', '#', '、'],
  875. enFhList: [',', '.', ';', '?', '!', ':', '>', '<'],
  876. NumberList: ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'],
  877. newWords: ['鱼', '辩礼义'],
  878. oldHz: '',
  879. hz: '',
  880. clientY: 0,
  881. top: 0,
  882. left: 0,
  883. articleImg: {}, // 文章图片
  884. newWordList: [],
  885. word: null,
  886. isShow: false,
  887. screenHeight: 0,
  888. cardHeight: 0,
  889. contentWidth: 732,
  890. noteNum: '',
  891. curNoteCon: null,
  892. isNoteShow: false,
  893. oldNoteNum: '',
  894. clientY: 0,
  895. clickType: '',
  896. sentIndex: -1,
  897. highWords: null,
  898. highWordsArr: [],
  899. highIndex: 0,
  900. activeWord: null,
  901. windowWidth: window.innerWidth,
  902. };
  903. },
  904. computed: {},
  905. watch: {
  906. hz: {
  907. handler(val, oldVal) {
  908. let _this = this;
  909. if (val) {
  910. _this.handleNewWords(val);
  911. }
  912. },
  913. // 深度观察监听
  914. deep: true,
  915. },
  916. isShow: {
  917. handler(val, oldVal) {
  918. let _this = this;
  919. if (val) {
  920. setTimeout(() => {
  921. _this.cardHeight = _this.$refs.wordcard.offsetHeight;
  922. if (_this.screenHeight - _this.clientY > _this.cardHeight) {
  923. _this.top = _this.clientY + 20;
  924. } else {
  925. _this.top = _this.clientY - _this.cardHeight - 30;
  926. }
  927. }, 0);
  928. }
  929. },
  930. // 深度观察监听
  931. deep: true,
  932. },
  933. noteNum: {
  934. handler(val, oldVal) {
  935. let _this = this;
  936. if (val) {
  937. _this.handleNote(val);
  938. }
  939. },
  940. // 深度观察监听
  941. deep: true,
  942. },
  943. isNoteShow: {
  944. handler(val, oldVal) {
  945. let _this = this;
  946. if (val) {
  947. setTimeout(() => {
  948. _this.cardHeight = _this.$refs.notecard.offsetHeight;
  949. if (_this.screenHeight - _this.clientY > _this.cardHeight) {
  950. _this.top = _this.clientY + 20;
  951. } else {
  952. _this.top = _this.clientY - _this.cardHeight - 30;
  953. }
  954. }, 50);
  955. }
  956. },
  957. // 深度观察监听
  958. deep: true,
  959. },
  960. },
  961. // 生命周期 - 创建完成(可以访问当前this实例)
  962. created() {},
  963. // 生命周期 - 挂载完成(可以访问DOM元素)
  964. mounted() {
  965. if (this.NNPENewWordList && this.NNPENewWordList.length > 0) {
  966. this.handleNewword();
  967. }
  968. if (this.curQue) {
  969. this.handleData();
  970. }
  971. window.addEventListener('resize', this.getScreenHeight);
  972. this.getScreenHeight();
  973. },
  974. beforeCreate() {}, // 生命周期 - 创建之前
  975. beforeMount() {}, // 生命周期 - 挂载之前
  976. beforeUpdate() {}, // 生命周期 - 更新之前
  977. updated() {}, // 生命周期 - 更新之后
  978. beforeDestroy() {
  979. window.removeEventListener('resize', this.getScreenHeight);
  980. }, // 生命周期 - 销毁之前
  981. destroyed() {}, // 生命周期 - 销毁完成
  982. activated() {},
  983. // 方法集合
  984. methods: {
  985. // 拼音的显示和隐藏
  986. changePinyin() {
  987. if (this.config.isHasPY) {
  988. this.$emit('changeConfig', 'isShowPY');
  989. }
  990. },
  991. // 英文的显示和隐藏
  992. changeEN() {
  993. if (this.config.isHasEN) {
  994. this.$emit('changeConfig', 'isShowEN');
  995. }
  996. },
  997. getCurTime(curTime) {
  998. this.curTime = curTime;
  999. },
  1000. handleData() {
  1001. let resArr = [];
  1002. let leg = this.curQue.detail.length;
  1003. let curQue = JSON.parse(JSON.stringify(this.curQue));
  1004. let dhaspinyin = false; // 每段是否有拼音
  1005. curQue.detail.forEach((dItem, dIndex) => {
  1006. dhaspinyin = false;
  1007. let paraArr = [];
  1008. if (!dItem.isTitle) {
  1009. paraArr = [
  1010. {
  1011. pinyin: '',
  1012. chs: '',
  1013. width: 20,
  1014. height: 20,
  1015. },
  1016. {
  1017. width: 20,
  1018. height: 20,
  1019. pinyin: '',
  1020. chs: '',
  1021. },
  1022. ];
  1023. }
  1024. dItem.wordsList.forEach((sItem, sIndex) => {
  1025. sItem.forEach((wItem, wIndex) => {
  1026. let sentence = dItem.sentences[sIndex];
  1027. // this.judgePad(sItem, wItem, wIndex);
  1028. this.mergeWordSymbol(sItem, wItem, wIndex);
  1029. let words = '';
  1030. if (this.newWordList.length > 0) {
  1031. if (!this.highWords) {
  1032. this.findLightWord(wItem, wIndex, sentence, sItem);
  1033. words = this.highWords ? this.highWords.words : '';
  1034. } else if (wIndex > this.highWords.endIndex - 1) {
  1035. this.highWords = null;
  1036. this.findLightWord(wItem, wIndex, sentence, sItem);
  1037. words = this.highWords ? this.highWords.words : '';
  1038. } else {
  1039. words = this.highWords ? this.highWords.words : '';
  1040. }
  1041. }
  1042. let obj = {
  1043. paraIndex: dIndex, // 段落索引
  1044. sentIndex: sIndex, // 在段落中句子索引
  1045. wordIndex: wIndex, // 单词的索引
  1046. pinyin:
  1047. curQue.pinyin_type === 'pinyin'
  1048. ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
  1049. ? wItem.pinyin_up
  1050. : wItem.pinyin
  1051. : wItem.pinyin_tone,
  1052. chs: wItem.chs,
  1053. padding: true, // wItem.padding,
  1054. className: wItem.className,
  1055. isShow: wItem.isShow,
  1056. isNewWord: this.newWords.indexOf(wItem.chs) > -1,
  1057. words,
  1058. config: {
  1059. fontFamily: wItem.fontFamily,
  1060. },
  1061. };
  1062. paraArr.push(obj);
  1063. if (wItem.pinyin) dhaspinyin = true;
  1064. });
  1065. });
  1066. let paraObj = {
  1067. wordsList: paraArr,
  1068. dhaspinyin,
  1069. isTitle: dItem.isTitle,
  1070. };
  1071. resArr.push(paraObj);
  1072. });
  1073. this.resArr = resArr;
  1074. // 循环文章图片
  1075. if (curQue.img_list) {
  1076. curQue.img_list.forEach((item) => {
  1077. this.articleImg[item.imgNumber] = item.id;
  1078. });
  1079. }
  1080. let resArrs = [];
  1081. let sentArrTotal = [];
  1082. let timeArr = [];
  1083. let wordTimeList = curQue.wordTime;
  1084. curQue.detail.forEach((dItem, dIndex) => {
  1085. dItem.wordsList.forEach((sItem, sIndex) => {
  1086. let sentArr = [];
  1087. sItem.forEach((wItem, wIndex) => {
  1088. let startIndex = wIndex == 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
  1089. let endIndex = wIndex == 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
  1090. // this.judgePad(sItem, wItem, wIndex);
  1091. this.mergeWordSymbols(wItem);
  1092. let obj = {
  1093. paraIndex: dIndex, // 段落索引
  1094. sentIndex: sIndex, // 在段落中句子索引
  1095. wordIndex: wIndex, // 单词的索引
  1096. pinyin:
  1097. curQue.pinyin_type === 'pinyin'
  1098. ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
  1099. ? wItem.pinyin_up
  1100. : wItem.pinyin
  1101. : wItem.pinyin_tone,
  1102. chs: wItem.chs,
  1103. padding: true,
  1104. className: wItem.className,
  1105. isShow: wItem.isShow,
  1106. startIndex,
  1107. endIndex,
  1108. leg: wItem.chs.length,
  1109. timeList: [],
  1110. config: {
  1111. fontFamily: wItem.fontFamily,
  1112. },
  1113. };
  1114. sentArr.push(obj);
  1115. });
  1116. let objs = {
  1117. sentArr,
  1118. enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
  1119. };
  1120. sentArrTotal.push(sentArr);
  1121. resArrs.push(objs);
  1122. });
  1123. timeArr.push(dItem.timeList);
  1124. });
  1125. if (wordTimeList && wordTimeList.length > 0) {
  1126. this.mergeWordTime(sentArrTotal, wordTimeList);
  1127. }
  1128. let timeList = [];
  1129. timeArr.forEach((item) => {
  1130. item.forEach((aItem) => {
  1131. if (timeList.indexOf(aItem) < 0) {
  1132. timeList.push(aItem);
  1133. }
  1134. });
  1135. });
  1136. this.resObj = { sentList: resArrs, timeList };
  1137. },
  1138. findLightWord(wItem, startIndex, sentence, sItem) {
  1139. let endIndex = 0;
  1140. let words = '';
  1141. this.newWordList.forEach((item) => {
  1142. if (item.length == 1) {
  1143. if (item == wItem.chs && !wItem.banLight) {
  1144. words = wItem.chs;
  1145. endIndex = startIndex + 1;
  1146. }
  1147. } else if (item[0] == wItem.chs && sentence.indexOf(item) > -1) {
  1148. let index = null;
  1149. let chsStr = '';
  1150. for (let i = startIndex; i < sItem.length + 1; i++) {
  1151. index = i;
  1152. if (chsStr.length == item.length) {
  1153. break;
  1154. } else {
  1155. chsStr += sItem[i] ? sItem[i].chs : '';
  1156. }
  1157. }
  1158. if (chsStr == item && !wItem.banLight) {
  1159. words = item;
  1160. endIndex = index;
  1161. }
  1162. } else if (wItem.new_word && wItem.new_word == item && !wItem.banLight) {
  1163. words = item;
  1164. endIndex = startIndex + 1;
  1165. }
  1166. });
  1167. if (words) {
  1168. this.highWords = { words, endIndex };
  1169. } else {
  1170. this.highWords = null;
  1171. }
  1172. },
  1173. // 词和标点合一起
  1174. mergeWordSymbol(sItem, wItem, curIndex) {
  1175. let leg = sItem.length;
  1176. if (wItem && wItem.chs) {
  1177. // let nextIndex = curIndex + 1;
  1178. // let chs = sItem[nextIndex].chs;
  1179. // let pinyin = sItem[nextIndex].pinyin;
  1180. // if (this.chsFhList.indexOf(chs) > -1) {
  1181. // wItem.chs = "<a>" + wItem.chs + "</a><a>" + chs + "</a>";
  1182. // wItem.pinyin = "<a>" + wItem.pinyin + "</a><a>" + pinyin + "</a>";
  1183. // }
  1184. if (this.chsFhList.indexOf(wItem.chs) > -1 || this.NumberList.indexOf(wItem.chs) > -1) {
  1185. wItem.isShow = false;
  1186. } else {
  1187. wItem.isShow = true;
  1188. }
  1189. }
  1190. // if (this.enFhList.indexOf(wItem.pinyin) > -1) {
  1191. // wItem.className = "textLeft";
  1192. // }
  1193. },
  1194. mergeWordSymbols(wItem) {
  1195. if (this.chsFhList.indexOf(wItem.chs) > -1 || this.NumberList.indexOf(wItem.chs) > -1) {
  1196. wItem.isShow = false;
  1197. } else {
  1198. wItem.isShow = true;
  1199. }
  1200. },
  1201. mergeWordTime(resArr, wordTimeList) {
  1202. resArr.forEach((item, index) => {
  1203. let wordsResultList = wordTimeList[index].wordsResultList;
  1204. item.forEach((wItem) => {
  1205. let startIndex = wItem.startIndex;
  1206. let endIndex = wItem.endIndex;
  1207. wItem.timeList = wordsResultList.slice(startIndex, endIndex);
  1208. });
  1209. });
  1210. },
  1211. // 判断是否有padding
  1212. judgePad(sItem, wItem, curIndex) {
  1213. let leg = sItem.length;
  1214. if (curIndex < leg - 1) {
  1215. let nextIndex = curIndex + 1;
  1216. let chs = sItem[nextIndex].chs;
  1217. if (this.chsFhList.indexOf(chs) > -1 || this.chsFhList.indexOf(wItem.chs) > -1) {
  1218. wItem.padding = false;
  1219. } else {
  1220. wItem.padding = true;
  1221. }
  1222. if (this.enFhList.indexOf(wItem.pinyin) > -1) {
  1223. wItem.className = 'textLeft';
  1224. }
  1225. }
  1226. },
  1227. // 转化时间
  1228. handleTimeList(list) {
  1229. let listRes = [];
  1230. list.forEach((item) => {
  1231. let res = timeStrToSen(item);
  1232. listRes.push(res);
  1233. });
  1234. return listRes;
  1235. },
  1236. // 分:秒转秒
  1237. timeStrToSen(time) {
  1238. if (!time) {
  1239. return -1;
  1240. }
  1241. let pos = time.indexOf(':');
  1242. let min = 0;
  1243. let sec = 0;
  1244. if (pos > 0) {
  1245. min = parseInt(time.substring(0, pos));
  1246. sec = parseFloat(time.substring(pos + 1));
  1247. }
  1248. return min * 60 + sec;
  1249. },
  1250. // 点击播放某个句子
  1251. handleChangeTime(time) {
  1252. this.curTime = time;
  1253. this.$refs.audioLine.onTimeupdateTime(time);
  1254. },
  1255. handleNewword() {
  1256. let NewWordList = [];
  1257. this.NNPENewWordList.forEach((wItem) => {
  1258. // item.forEach((wItem) => {
  1259. if (wItem.new_word) {
  1260. NewWordList.push(wItem.new_word);
  1261. } else if (wItem.detail && wItem.detail.sentence) {
  1262. NewWordList.push(wItem.detail.sentence);
  1263. }
  1264. // });
  1265. });
  1266. this.newWordList = JSON.parse(JSON.stringify(NewWordList));
  1267. },
  1268. showWordDetail(e, word, words) {
  1269. let _this = this;
  1270. _this.highIndex = 0;
  1271. _this.highWordsArr = [];
  1272. if (word && this.newWordList.indexOf(word) > -1) {
  1273. this.highWordsArr.push(word);
  1274. }
  1275. if (words && word != words && this.newWordList.indexOf(words) > -1) {
  1276. this.highWordsArr.push(words);
  1277. }
  1278. if (this.newWordList.indexOf(word) > -1 || this.newWordList.indexOf(words) > -1) {
  1279. if (word && this.newWordList.indexOf(word) > -1) {
  1280. if (_this.oldHz != word) {
  1281. this.isShow = false;
  1282. setTimeout(() => {
  1283. _this.hz = word;
  1284. }, 50);
  1285. }
  1286. } else if (words && this.newWordList.indexOf(words) > -1) {
  1287. if (_this.oldHz != words) {
  1288. this.isShow = false;
  1289. setTimeout(() => {
  1290. _this.hz = words;
  1291. }, 50);
  1292. }
  1293. }
  1294. _this.clientY = e.clientY;
  1295. let left = e.clientX;
  1296. let width = 0;
  1297. if (word.length == 1 || word.length == 2) {
  1298. width = 304;
  1299. } else if (word.length == 3 || word.length == 4) {
  1300. width = 432;
  1301. } else if (word.length > 3) {
  1302. width = 560;
  1303. }
  1304. if (left - this.bodyLeft > this.contentWidth / 2) {
  1305. _this.left = left - width + 10;
  1306. } else {
  1307. _this.left = left;
  1308. }
  1309. }
  1310. },
  1311. hideWordDetail() {
  1312. this.isShow = false;
  1313. },
  1314. changeWordCard(isShow) {
  1315. this.isShow = isShow;
  1316. this.oldHz = '';
  1317. this.hz = '';
  1318. },
  1319. // 处理分词数据
  1320. handleNewWords(val, top, left) {
  1321. this.isShow = true;
  1322. this.word = null;
  1323. for (let i = 0; i < this.NNPENewWordList.length; i++) {
  1324. let item = this.NNPENewWordList[i];
  1325. // for (let j = 0; j < pItem.length; j++) {
  1326. // let item = pItem[j];
  1327. if (item.new_word.trim() == val.trim()) {
  1328. let wordlist = val.split('');
  1329. this.word = { list: wordlist, detail: item, top, left };
  1330. break;
  1331. }
  1332. // }
  1333. }
  1334. this.oldHz = val;
  1335. },
  1336. getScreenHeight() {
  1337. this.screenHeight = window.innerHeight;
  1338. },
  1339. changeCurQue(answer) {
  1340. if (answer) {
  1341. let writeModel = this.curQue.Bookanswer.writeModel;
  1342. let hz = answer.hz;
  1343. if (writeModel.hasOwnProperty(hz)) {
  1344. writeModel[hz].push(answer);
  1345. } else {
  1346. writeModel[hz] = [answer];
  1347. }
  1348. }
  1349. },
  1350. viewNotes(e, noteNum) {
  1351. let _this = this;
  1352. _this.clickType = 'note';
  1353. _this.activeWord = null;
  1354. let noteIndex = '';
  1355. if (_this.NumberList.indexOf(noteNum) > -1) {
  1356. for (let i = 0; i < _this.NumberList.length; i++) {
  1357. if (_this.NumberList[i] == noteNum) {
  1358. noteIndex = `${String(i)}`;
  1359. break;
  1360. }
  1361. }
  1362. this.showNoteDetail(e, noteIndex);
  1363. } else if (this.newWordList.indexOf(noteNum) > -1) {
  1364. if (_this.oldHz != noteNum) {
  1365. this.isShow = false;
  1366. _this.NNPENewWordList.forEach((items) => {
  1367. // item.forEach((items) => {
  1368. if (items.new_word === noteNum) {
  1369. this.activeWord = items;
  1370. }
  1371. // });
  1372. });
  1373. setTimeout(() => {
  1374. _this.hz = noteNum;
  1375. }, 50);
  1376. }
  1377. _this.clientY = e.clientY;
  1378. let left = e.clientX;
  1379. let width = 0;
  1380. if (noteNum.length == 1 || noteNum.length == 2) {
  1381. width = 304;
  1382. } else if (noteNum.length == 3 || noteNum.length == 4) {
  1383. width = 432;
  1384. } else if (noteNum.length > 3) {
  1385. width = 560;
  1386. }
  1387. if (left - this.bodyLeft > this.contentWidth / 2) {
  1388. _this.left = left - width + 10;
  1389. } else {
  1390. _this.left = left;
  1391. }
  1392. }
  1393. },
  1394. showNoteDetail(e, noteNum) {
  1395. let _this = this;
  1396. if (_this.oldNoteNum != noteNum) {
  1397. this.isNoteShow = false;
  1398. setTimeout(() => {
  1399. _this.noteNum = noteNum;
  1400. }, 50);
  1401. }
  1402. _this.clientY = e.clientY;
  1403. let left = e.clientX;
  1404. let width = 642;
  1405. if (left - this.bodyLeft > this.contentWidth / 2) {
  1406. _this.left = left - width + 10;
  1407. } else if (left - 200 > 500) {
  1408. _this.left = 500;
  1409. } else {
  1410. _this.left = left - 200;
  1411. }
  1412. },
  1413. // 处理注释数据
  1414. handleNote(val) {
  1415. let _this = this;
  1416. _this.isNoteShow = true;
  1417. _this.oldNoteNum = val;
  1418. let noteIndex = Number(val);
  1419. if (_this.NNPEAnnotationList && _this.NNPEAnnotationList.length > 0) {
  1420. _this.curNoteCon = _this.NNPEAnnotationList[noteIndex] ? _this.NNPEAnnotationList[noteIndex] : null;
  1421. }
  1422. },
  1423. changeCard(isShow) {
  1424. let _this = this;
  1425. _this.isNoteShow = isShow;
  1426. _this.oldNoteNum = '';
  1427. _this.noteNum = '';
  1428. },
  1429. }, // 如果页面有keep-alive缓存功能,这个函数会触发
  1430. };
  1431. </script>
  1432. <style lang="scss" scoped>
  1433. //@import url(); 引入公共css类
  1434. .NNPE-ArticleView {
  1435. width: 100%;
  1436. .aduioLine-practice-npc {
  1437. display: flex;
  1438. align-items: center;
  1439. justify-content: flex-start;
  1440. .aduioLine-content {
  1441. flex: 1;
  1442. }
  1443. .aduioLine-right {
  1444. box-sizing: border-box;
  1445. display: flex;
  1446. align-items: center;
  1447. justify-content: space-between;
  1448. width: 69px;
  1449. height: 40px;
  1450. padding: 0 12px;
  1451. border-left: 1px solid rgba(0, 0, 0, 10%);
  1452. > span {
  1453. width: 16px;
  1454. height: 16px;
  1455. cursor: pointer;
  1456. }
  1457. }
  1458. }
  1459. .NPC-sentences-list {
  1460. padding: 24px 0;
  1461. }
  1462. .multilingual {
  1463. padding: 6px 24px 12px;
  1464. word-break: break-word;
  1465. }
  1466. .NNPE-detail {
  1467. overflow: hidden;
  1468. clear: both;
  1469. color: rgba(0, 0, 0, 100%);
  1470. .NNPE-words {
  1471. float: left;
  1472. padding-bottom: 5px;
  1473. &-box {
  1474. float: left;
  1475. > span {
  1476. display: block;
  1477. &.NNPE-pinyin {
  1478. height: 22px;
  1479. font-family: 'League';
  1480. font-size: 14px;
  1481. font-weight: normal;
  1482. line-height: 1.5;
  1483. &.noFont {
  1484. font-family: initial;
  1485. }
  1486. &.textLeft {
  1487. text-align: left;
  1488. }
  1489. }
  1490. &.NNPE-chs {
  1491. font-family: '楷体';
  1492. font-size: 20px;
  1493. line-height: 1.4;
  1494. &.active {
  1495. color: #de4444;
  1496. }
  1497. }
  1498. &.padding {
  1499. padding: 0 3px;
  1500. }
  1501. }
  1502. }
  1503. &.textLeft {
  1504. text-align: left;
  1505. }
  1506. &.textCenter {
  1507. text-align: center;
  1508. }
  1509. &.textRight {
  1510. text-align: right;
  1511. }
  1512. > span {
  1513. display: block;
  1514. &.NNPE-pinyin {
  1515. height: 22px;
  1516. font-family: 'League';
  1517. font-size: 14px;
  1518. font-weight: normal;
  1519. line-height: 1.5;
  1520. &.noFont {
  1521. font-family: initial;
  1522. }
  1523. &.textLeft {
  1524. text-align: left;
  1525. }
  1526. }
  1527. &.NNPE-chs {
  1528. font-family: '楷体';
  1529. font-size: 20px;
  1530. line-height: 1.4;
  1531. &.active {
  1532. color: #de4444;
  1533. }
  1534. }
  1535. &.padding {
  1536. padding: 0 3px;
  1537. }
  1538. }
  1539. }
  1540. &.NNPE-detail-title {
  1541. .wordsList-box {
  1542. > div {
  1543. display: flex;
  1544. flex-flow: wrap;
  1545. justify-content: center;
  1546. width: 100%;
  1547. }
  1548. }
  1549. }
  1550. .index {
  1551. box-sizing: border-box;
  1552. width: 48px;
  1553. padding: 8px;
  1554. text-align: right;
  1555. border-right: 1px solid rgba(0, 0, 0, 10%);
  1556. b {
  1557. font-weight: 400;
  1558. line-height: 1.5;
  1559. color: #000;
  1560. }
  1561. }
  1562. .wordsList-box {
  1563. // display: flex;
  1564. width: 100%;
  1565. padding: 6px 24px 12px;
  1566. &-left {
  1567. justify-content: flex-start;
  1568. }
  1569. &-center {
  1570. justify-content: center;
  1571. }
  1572. &-right {
  1573. justify-content: flex-end;
  1574. }
  1575. > div {
  1576. overflow: hidden;
  1577. clear: both;
  1578. }
  1579. > img {
  1580. display: block;
  1581. max-width: 100%;
  1582. margin: 0 auto;
  1583. }
  1584. }
  1585. }
  1586. .NNPE-wordDetail {
  1587. position: fixed;
  1588. top: 50%;
  1589. left: 50%;
  1590. z-index: 116;
  1591. max-width: 100%;
  1592. margin-top: -196px;
  1593. overflow: auto;
  1594. box-shadow: 0 4px 16px rgba(0, 0, 0, 15%);
  1595. // width: 260px;
  1596. // height: 200px;
  1597. // background: #cc0;
  1598. }
  1599. .NNPE-detail-box {
  1600. box-sizing: border-box;
  1601. width: 100%;
  1602. padding: 8px 24px;
  1603. margin-bottom: 8px;
  1604. &.active {
  1605. background: rgba(222, 68, 68, 15%);
  1606. }
  1607. }
  1608. .NNPE-details {
  1609. overflow: hidden;
  1610. clear: both;
  1611. .NNPE-words {
  1612. float: left;
  1613. &-box {
  1614. float: left;
  1615. > span {
  1616. display: block;
  1617. &.NNPE-pinyin {
  1618. height: 20px;
  1619. font-family: 'League';
  1620. font-size: 14px;
  1621. font-weight: normal;
  1622. line-height: 20px;
  1623. color: rgba(0, 0, 0, 65%);
  1624. &.noFont {
  1625. font-family: initial;
  1626. }
  1627. &.textLeft {
  1628. text-align: left;
  1629. }
  1630. &.wordBlank {
  1631. color: rgba(0, 0, 0, 65%);
  1632. }
  1633. }
  1634. &.NNPE-chs {
  1635. font-family: '楷体';
  1636. font-size: 20px;
  1637. line-height: 28px;
  1638. color: rgba(0, 0, 0, 65%);
  1639. &.active {
  1640. color: #de4444;
  1641. }
  1642. &.wordBlank {
  1643. color: rgba(0, 0, 0, 65%);
  1644. }
  1645. }
  1646. // &.padding {
  1647. // padding-right: 6px;
  1648. // }
  1649. }
  1650. }
  1651. &.textLeft {
  1652. text-align: left;
  1653. }
  1654. &.textCenter {
  1655. text-align: center;
  1656. }
  1657. &.textRight {
  1658. text-align: right;
  1659. }
  1660. > span {
  1661. display: block;
  1662. &.NNPE-pinyin {
  1663. height: 20px;
  1664. font-family: 'League';
  1665. font-size: 14px;
  1666. font-weight: normal;
  1667. line-height: 20px;
  1668. color: rgba(0, 0, 0, 65%);
  1669. &.noFont {
  1670. font-family: initial;
  1671. }
  1672. &.textLeft {
  1673. text-align: left;
  1674. }
  1675. &.wordBlank {
  1676. color: rgba(0, 0, 0, 65%);
  1677. }
  1678. }
  1679. &.NNPE-chs {
  1680. font-family: '楷体';
  1681. font-size: 20px;
  1682. line-height: 28px;
  1683. color: rgba(0, 0, 0, 65%);
  1684. &.active {
  1685. color: #de4444;
  1686. }
  1687. &.wordBlank {
  1688. color: rgba(0, 0, 0, 65%);
  1689. }
  1690. }
  1691. &.padding {
  1692. padding: 0 3px;
  1693. }
  1694. }
  1695. }
  1696. }
  1697. .enwords {
  1698. padding-left: 3px;
  1699. font-family: 'Helvetica';
  1700. font-size: 14px;
  1701. font-weight: normal;
  1702. line-height: 22px;
  1703. color: rgba(0, 0, 0, 65%);
  1704. word-break: break-word;
  1705. &.wordBlank {
  1706. color: rgba(0, 0, 0, 65%);
  1707. }
  1708. }
  1709. .multilingual-para {
  1710. text-indent: 40px;
  1711. word-break: break-word;
  1712. &-center {
  1713. text-align: center;
  1714. text-indent: 0;
  1715. }
  1716. }
  1717. }
  1718. </style>