WordModelChs.vue 59 KB

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