PhraseModelChs.vue 58 KB

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