WordModelChs.vue 58 KB

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