WordModelChs.vue 57 KB

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