WordModelChs.vue 58 KB

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