Practicechs.vue 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765
  1. <!-- -->
  2. <template>
  3. <div v-if="curQue" class="NNPE-ArticleView">
  4. <!-- <a class="ArticleView-full" @click="fullScreen">全屏模式</a> -->
  5. <div
  6. v-if="
  7. ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
  8. config.isHasPY ||
  9. config.isHasEN) &&
  10. curQue.property.mp3_position === 'top'
  11. "
  12. class="aduioLine-box aduioLine-practice-npc"
  13. >
  14. <div class="aduioLine-content">
  15. <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
  16. <AudioLine
  17. ref="audioLine"
  18. audio-id="artPraAudio"
  19. :mp3="curQue.mp3_list[0].url"
  20. :get-cur-time="getCurTime"
  21. :stop-audio="stopAudio"
  22. :width="colLength == 2 ? 175 : 700"
  23. :mp3-source="curQue.mp3_list[0].source"
  24. :ed="ed"
  25. type="audioLine"
  26. :attrib="attrib"
  27. @handleChangeStopAudio="handleChangeStopAudio"
  28. @emptyEd="emptyEd"
  29. />
  30. </template>
  31. </div>
  32. <div class="aduioLine-right">
  33. <SvgIcon
  34. v-if="config.isHasPY"
  35. icon-class="repeat-1"
  36. size="16"
  37. :class="['Repeat-16', isRepeat ? '' : 'disabled']"
  38. :style="{ color: isRepeat ? (attrib ? attrib.topic_color : '') : '#DCDFE6', cursor: 'pointer' }"
  39. @click="changeRepeat"
  40. />
  41. <!-- <span
  42. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  43. @click="changePinyin"
  44. v-if="config.isHasPY"
  45. ></span>
  46. <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  47. <SvgIcon
  48. v-if="config.isHasPY"
  49. icon-class="pin-btn"
  50. size="16"
  51. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  52. :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  53. @click="changePinyin"
  54. />
  55. <!-- <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  56. <SvgIcon
  57. v-if="config.isHasEN"
  58. icon-class="en-btn"
  59. size="16"
  60. :class="['EN-16', config.isShowEN ? '' : 'disabled']"
  61. :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  62. @click="changeEN"
  63. />
  64. </div>
  65. </div>
  66. <div
  67. :style="{
  68. height: curQue.property.content_height ? curQue.property.content_height + 'px' : '',
  69. overflow: 'auto',
  70. }"
  71. >
  72. <template v-if="resObj">
  73. <!-- -->
  74. <div class="NPC-sentences-list">
  75. <div
  76. v-for="(item, index) in resObj.sentList"
  77. :key="'detail' + index"
  78. :class="['NNPE-detail-box', sentIndex == index ? 'active' : '']"
  79. :style="{
  80. backgroundColor: sentIndex == index && attrib ? attrib.assist_color : '',
  81. }"
  82. >
  83. <div
  84. :class="['NNPE-detail']"
  85. @click="
  86. handleChangeTime(
  87. curQue.wordTime && curQue.wordTime[index] && curQue.wordTime[index].bg,
  88. index,
  89. curQue.wordTime && curQue.wordTime[index] && curQue.wordTime[index].ed,
  90. )
  91. "
  92. >
  93. <div
  94. v-if="item.enwords && config.isShowEN && curQue.enPosition && curQue.enPosition == 'top'"
  95. :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
  96. >
  97. {{ convertText(item.enwords) }}
  98. </div>
  99. <div style="overflow: hidden; clear: both"></div>
  100. <div
  101. v-for="(pItem, pIndex) in item.sentArr"
  102. :key="'wordsList' + pIndex"
  103. class="NNPE-words"
  104. :class="[
  105. pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
  106. pItem.chs == '“' ? 'textRight' : '',
  107. ]"
  108. >
  109. <template v-if="!pItem.width">
  110. <template v-if="pItem.isShow">
  111. <span
  112. v-if="
  113. item.sentArr[pIndex - 1] &&
  114. item.sentArr[pIndex - 1].chs &&
  115. firstFhlist.indexOf(item.sentArr[pIndex - 1].chs) > -1 &&
  116. item.sentArr[pIndex - 2] &&
  117. item.sentArr[pIndex - 2].chs &&
  118. firstFhlist.indexOf(item.sentArr[pIndex - 2].chs) > -1
  119. "
  120. class="NNPE-words-box"
  121. >
  122. <template v-if="curQue.property.pinyin_position == 'top'">
  123. <span
  124. v-if="config.isShowPY"
  125. :class="[
  126. 'NNPE-pinyin',
  127. sentIndex == index ? 'wordBlank' : '',
  128. noFont.indexOf(item.sentArr[pIndex - 2].pinyin) > -1 ? 'noFont' : '',
  129. ]"
  130. style="text-align: left"
  131. :style="{
  132. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  133. height:
  134. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  135. }"
  136. >{{
  137. NumberList.indexOf(item.sentArr[pIndex - 2].pinyin) == -1
  138. ? item.sentArr[pIndex - 2].pinyin
  139. : ''
  140. }}</span
  141. >
  142. </template>
  143. <span class="NNPE-chs" style="text-align: left" :class="[sentIndex == index ? 'wordBlank' : '']">
  144. <span
  145. :class="[
  146. pItem.timeList[0] &&
  147. curQue.wordTime &&
  148. curTime >= pItem.timeList[0].wordBg &&
  149. curTime <= curQue.wordTime[index].ed
  150. ? 'active'
  151. : '',
  152. sentIndex == index ? 'wordBlank' : '',
  153. ]"
  154. :style="{
  155. fontFamily: item.sentArr[pIndex - 2].config.fontFamily,
  156. textDecoration: item.sentArr[pIndex - 2].config.textDecoration,
  157. borderBottom: item.sentArr[pIndex - 2].config.border === 'dotted' ? '1px dotted' : '',
  158. fontWeight: item.sentArr[pIndex - 2].config.fontWeight,
  159. height:
  160. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  161. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  162. lineHeight:
  163. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  164. display: 'inline-block',
  165. width: item.sentArr[pIndex - 2].chs.trim() === '' ? '6px' : '',
  166. color:
  167. pItem.timeList[0] &&
  168. curQue.wordTime &&
  169. curTime >= pItem.timeList[0].wordBg &&
  170. curTime <= curQue.wordTime[index].ed &&
  171. attrib
  172. ? attrib.topic_color
  173. : item.sentArr[pIndex - 2].config.color,
  174. }"
  175. >
  176. {{
  177. NumberList.indexOf(item.sentArr[pIndex - 2].pinyin) == -1
  178. ? convertText(item.sentArr[pIndex - 2].chs)
  179. : ''
  180. }}</span
  181. >
  182. <img
  183. v-if="
  184. item.sentArr[pIndex - 2].img &&
  185. item.sentArr[pIndex - 2].img.length > 0 &&
  186. item.sentArr[pIndex - 2].imgPosition === 'after'
  187. "
  188. :src="item.sentArr[pIndex - 2].img[0].file_url"
  189. :style="{
  190. height: attrib && attrib.font_size ? attrib.font_size : '20px',
  191. }"
  192. />
  193. </span>
  194. <template v-if="curQue.property.pinyin_position == 'bottom'">
  195. <span
  196. v-if="config.isShowPY"
  197. :class="[
  198. 'NNPE-pinyin',
  199. sentIndex == index ? 'wordBlank' : '',
  200. noFont.indexOf(item.sentArr[pIndex - 2].pinyin) > -1 ? 'noFont' : '',
  201. ]"
  202. style="text-align: left"
  203. :style="{
  204. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  205. height:
  206. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  207. }"
  208. >{{
  209. NumberList.indexOf(item.sentArr[pIndex - 2].pinyin) == -1
  210. ? item.sentArr[pIndex - 2].pinyin
  211. : ''
  212. }}</span
  213. >
  214. </template>
  215. </span>
  216. <span
  217. v-if="
  218. item.sentArr[pIndex - 1] &&
  219. item.sentArr[pIndex - 1].chs &&
  220. firstFhlist.indexOf(item.sentArr[pIndex - 1].chs) > -1
  221. "
  222. class="NNPE-words-box"
  223. >
  224. <template v-if="curQue.property.pinyin_position == 'top'">
  225. <span
  226. v-if="config.isShowPY"
  227. :class="[
  228. 'NNPE-pinyin',
  229. sentIndex == index ? 'wordBlank' : '',
  230. noFont.indexOf(item.sentArr[pIndex - 1].pinyin) > -1 ? 'noFont' : '',
  231. ]"
  232. style="text-align: left"
  233. :style="{
  234. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  235. height:
  236. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  237. }"
  238. >{{
  239. NumberList.indexOf(item.sentArr[pIndex - 1].pinyin) == -1
  240. ? item.sentArr[pIndex - 1].pinyin
  241. : ''
  242. }}</span
  243. >
  244. </template>
  245. <span class="NNPE-chs" style="text-align: left" :class="[sentIndex == index ? 'wordBlank' : '']">
  246. <span
  247. :class="[
  248. pItem.timeList[0] &&
  249. curQue.wordTime &&
  250. curTime >= pItem.timeList[0].wordBg &&
  251. curTime <= curQue.wordTime[index].ed
  252. ? 'active'
  253. : '',
  254. sentIndex == index ? 'wordBlank' : '',
  255. ]"
  256. :style="{
  257. fontFamily: item.sentArr[pIndex - 1].config.fontFamily,
  258. textDecoration: item.sentArr[pIndex - 1].config.textDecoration,
  259. borderBottom: item.sentArr[pIndex - 1].config.border === 'dotted' ? '1px dotted' : '',
  260. fontWeight: item.sentArr[pIndex - 1].config.fontWeight,
  261. height:
  262. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  263. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  264. lineHeight:
  265. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  266. display: 'inline-block',
  267. width: item.sentArr[pIndex - 1].chs.trim() === '' ? '6px' : '',
  268. color:
  269. pItem.timeList[0] &&
  270. curQue.wordTime &&
  271. curTime >= pItem.timeList[0].wordBg &&
  272. curTime <= curQue.wordTime[index].ed &&
  273. attrib
  274. ? attrib.topic_color
  275. : item.sentArr[pIndex - 1].config.color,
  276. }"
  277. >
  278. {{
  279. NumberList.indexOf(item.sentArr[pIndex - 1].pinyin) == -1
  280. ? convertText(item.sentArr[pIndex - 1].chs)
  281. : ''
  282. }}</span
  283. >
  284. <img
  285. v-if="
  286. item.sentArr[pIndex - 1].img &&
  287. item.sentArr[pIndex - 1].img.length > 0 &&
  288. item.sentArr[pIndex - 1].imgPosition === 'after'
  289. "
  290. :src="item.sentArr[pIndex - 1].img[0].file_url"
  291. :style="{
  292. height: attrib && attrib.font_size ? attrib.font_size : '20px',
  293. }"
  294. />
  295. </span>
  296. <template v-if="curQue.property.pinyin_position == 'bottom'">
  297. <span
  298. v-if="config.isShowPY"
  299. :class="[
  300. 'NNPE-pinyin',
  301. sentIndex == index ? 'wordBlank' : '',
  302. noFont.indexOf(item.sentArr[pIndex - 1].pinyin) > -1 ? 'noFont' : '',
  303. ]"
  304. style="text-align: left"
  305. :style="{
  306. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  307. height:
  308. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  309. }"
  310. >{{
  311. NumberList.indexOf(item.sentArr[pIndex - 1].pinyin) == -1
  312. ? item.sentArr[pIndex - 1].pinyin
  313. : ''
  314. }}</span
  315. >
  316. </template>
  317. </span>
  318. <template
  319. v-if="
  320. item.sentArr[pIndex + 1] &&
  321. item.sentArr[pIndex + 1].chs &&
  322. chsFhList.indexOf(item.sentArr[pIndex + 1].chs) > -1
  323. "
  324. >
  325. <span class="NNPE-words-box">
  326. <template v-if="curQue.property.pinyin_position == 'top'">
  327. <span
  328. v-if="config.isShowPY"
  329. class="NNPE-pinyin"
  330. :class="[
  331. pItem.className ? pItem.className : '',
  332. sentIndex == index ? 'wordBlank' : '',
  333. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  334. ]"
  335. :style="{
  336. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  337. height:
  338. attrib && attrib.pinyin_size
  339. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  340. : '22px',
  341. }"
  342. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  343. >
  344. </template>
  345. <span
  346. class="NNPE-chs"
  347. :class="[
  348. pItem.padding && config.isShowPY ? 'padding' : '',
  349. sentIndex == index ? 'wordBlank' : '',
  350. ]"
  351. >
  352. <template v-for="(wItem, wIndex) in pItem.leg">
  353. <span
  354. :key="'ci' + wIndex + pIndex + index"
  355. :class="[
  356. pItem.timeList[wIndex] &&
  357. curTime >= pItem.timeList[wIndex].wordBg &&
  358. curTime <= curQue.wordTime[index].ed
  359. ? 'active'
  360. : '',
  361. sentIndex == index ? 'wordBlank' : '',
  362. ]"
  363. :style="{
  364. fontFamily: pItem.config.fontFamily,
  365. textDecoration: pItem.config.textDecoration,
  366. borderBottom: pItem.config.border === 'dotted' ? '1px dotted' : '',
  367. fontWeight: pItem.config.fontWeight,
  368. height:
  369. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  370. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  371. lineHeight:
  372. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  373. display: 'inline-block',
  374. width: pItem.chs[wIndex].trim() === '' ? '6px' : '',
  375. color:
  376. pItem.timeList[wIndex] &&
  377. curTime >= pItem.timeList[wIndex].wordBg &&
  378. curTime <= curQue.wordTime[index].ed &&
  379. attrib
  380. ? attrib.topic_color
  381. : pItem.config.color,
  382. }"
  383. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? convertText(pItem.chs[wIndex]) : '' }}</span
  384. >
  385. </template>
  386. <img
  387. v-if="pItem.img && pItem.img.length > 0 && pItem.imgPosition === 'after'"
  388. :src="pItem.img[0].file_url"
  389. :style="{
  390. height: attrib && attrib.font_size ? attrib.font_size : '20px',
  391. }"
  392. />
  393. </span>
  394. <template v-if="curQue.property.pinyin_position == 'bottom'">
  395. <span
  396. v-if="config.isShowPY"
  397. class="NNPE-pinyin"
  398. :class="[
  399. pItem.className ? pItem.className : '',
  400. sentIndex == index ? 'wordBlank' : '',
  401. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  402. ]"
  403. :style="{
  404. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  405. height:
  406. attrib && attrib.pinyin_size
  407. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  408. : '22px',
  409. }"
  410. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  411. >
  412. </template>
  413. </span>
  414. <span class="NNPE-words-box">
  415. <template v-if="curQue.property.pinyin_position == 'top'">
  416. <span
  417. v-if="config.isShowPY"
  418. :class="[
  419. 'NNPE-pinyin',
  420. sentIndex == index ? 'wordBlank' : '',
  421. noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  422. ]"
  423. style="text-align: left"
  424. :style="{
  425. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  426. height:
  427. attrib && attrib.pinyin_size
  428. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  429. : '22px',
  430. }"
  431. >{{
  432. NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
  433. ? item.sentArr[pIndex + 1].pinyin
  434. : ''
  435. }}</span
  436. >
  437. </template>
  438. <span
  439. class="NNPE-chs"
  440. style="text-align: left"
  441. :class="[sentIndex == index ? 'wordBlank' : '']"
  442. >
  443. <span
  444. :class="[
  445. pItem.timeList[pItem.leg - 1] &&
  446. curQue.wordTime &&
  447. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  448. curTime <= curQue.wordTime[index].ed
  449. ? 'active'
  450. : '',
  451. sentIndex == index ? 'wordBlank' : '',
  452. ]"
  453. :style="{
  454. fontFamily: item.sentArr[pIndex + 1].config.fontFamily,
  455. textDecoration: item.sentArr[pIndex + 1].config.textDecoration,
  456. borderBottom: item.sentArr[pIndex + 1].config.border === 'dotted' ? '1px dotted' : '',
  457. fontWeight: item.sentArr[pIndex + 1].config.fontWeight,
  458. height:
  459. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  460. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  461. lineHeight:
  462. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  463. display: 'inline-block',
  464. width: item.sentArr[pIndex + 1].chs.trim() === '' ? '6px' : '',
  465. color:
  466. pItem.timeList[pItem.leg - 1] &&
  467. curQue.wordTime &&
  468. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  469. curTime <= curQue.wordTime[index].ed &&
  470. attrib
  471. ? attrib.topic_color
  472. : item.sentArr[pIndex + 1].config.color,
  473. }"
  474. >
  475. {{
  476. NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
  477. ? convertText(item.sentArr[pIndex + 1].chs)
  478. : ''
  479. }}</span
  480. >
  481. <img
  482. v-if="
  483. item.sentArr[pIndex + 1].img &&
  484. item.sentArr[pIndex + 1].img.length > 0 &&
  485. item.sentArr[pIndex + 1].imgPosition === 'after'
  486. "
  487. :src="item.sentArr[pIndex + 1].img[0].file_url"
  488. :style="{
  489. height: attrib && attrib.font_size ? attrib.font_size : '20px',
  490. }"
  491. />
  492. </span>
  493. <template v-if="curQue.property.pinyin_position == 'bottom'">
  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. >{{
  510. NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
  511. ? item.sentArr[pIndex + 1].pinyin
  512. : ''
  513. }}</span
  514. >
  515. </template>
  516. </span>
  517. <span
  518. v-if="
  519. item.sentArr[pIndex + 2] &&
  520. item.sentArr[pIndex + 2].chs &&
  521. chsFhList.indexOf(item.sentArr[pIndex + 2].chs) > -1
  522. "
  523. class="NNPE-words-box"
  524. >
  525. <template v-if="curQue.property.pinyin_position == 'top'">
  526. <span
  527. v-if="config.isShowPY"
  528. :class="[
  529. 'NNPE-pinyin',
  530. sentIndex == index ? 'wordBlank' : '',
  531. noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  532. ]"
  533. style="text-align: left"
  534. :style="{
  535. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  536. height:
  537. attrib && attrib.pinyin_size
  538. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  539. : '22px',
  540. }"
  541. >{{
  542. NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
  543. ? item.sentArr[pIndex + 2].pinyin
  544. : ''
  545. }}</span
  546. >
  547. </template>
  548. <span
  549. class="NNPE-chs"
  550. style="text-align: left"
  551. :class="[sentIndex == index ? 'wordBlank' : '']"
  552. >
  553. <span
  554. :class="[
  555. pItem.timeList[pItem.leg - 1] &&
  556. curQue.wordTime &&
  557. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  558. curTime <= curQue.wordTime[index].ed
  559. ? 'active'
  560. : '',
  561. sentIndex == index ? 'wordBlank' : '',
  562. ]"
  563. :style="{
  564. fontFamily: item.sentArr[pIndex + 2].config.fontFamily,
  565. textDecoration: item.sentArr[pIndex + 2].config.textDecoration,
  566. borderBottom: item.sentArr[pIndex + 2].config.border === 'dotted' ? '1px dotted' : '',
  567. fontWeight: item.sentArr[pIndex + 2].config.fontWeight,
  568. height:
  569. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  570. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  571. lineHeight:
  572. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  573. display: 'inline-block',
  574. width: item.sentArr[pIndex + 2].chs.trim() === '' ? '6px' : '',
  575. color:
  576. pItem.timeList[pItem.leg - 1] &&
  577. curQue.wordTime &&
  578. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  579. curTime <= curQue.wordTime[index].ed &&
  580. attrib
  581. ? attrib.topic_color
  582. : item.sentArr[pIndex + 2].config.color,
  583. }"
  584. >
  585. {{
  586. NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
  587. ? convertText(item.sentArr[pIndex + 2].chs)
  588. : ''
  589. }}</span
  590. >
  591. <img
  592. v-if="
  593. item.sentArr[pIndex + 2].img &&
  594. item.sentArr[pIndex + 2].img.length > 0 &&
  595. item.sentArr[pIndex + 2].imgPosition === 'after'
  596. "
  597. :src="item.sentArr[pIndex + 2].img[0].file_url"
  598. :style="{
  599. height: attrib && attrib.font_size ? attrib.font_size : '20px',
  600. }"
  601. />
  602. </span>
  603. <template v-if="curQue.property.pinyin_position == 'bottom'">
  604. <span
  605. v-if="config.isShowPY"
  606. :class="[
  607. 'NNPE-pinyin',
  608. sentIndex == index ? 'wordBlank' : '',
  609. noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  610. ]"
  611. style="text-align: left"
  612. :style="{
  613. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  614. height:
  615. attrib && attrib.pinyin_size
  616. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  617. : '22px',
  618. }"
  619. >{{
  620. NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
  621. ? item.sentArr[pIndex + 2].pinyin
  622. : ''
  623. }}</span
  624. >
  625. </template>
  626. </span>
  627. <span
  628. v-if="
  629. item.sentArr[pIndex + 2] &&
  630. item.sentArr[pIndex + 2].chs &&
  631. chsFhList.indexOf(item.sentArr[pIndex + 2].chs) > -1 &&
  632. item.sentArr[pIndex + 3] &&
  633. item.sentArr[pIndex + 3].chs &&
  634. chsFhList.indexOf(item.sentArr[pIndex + 3].chs) > -1
  635. "
  636. class="NNPE-words-box"
  637. >
  638. <template v-if="curQue.property.pinyin_position == 'top'">
  639. <span
  640. v-if="config.isShowPY"
  641. :class="[
  642. 'NNPE-pinyin',
  643. sentIndex == index ? 'wordBlank' : '',
  644. noFont.indexOf(item.sentArr[pIndex + 3].pinyin) > -1 ? 'noFont' : '',
  645. ]"
  646. style="text-align: left"
  647. :style="{
  648. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  649. height:
  650. attrib && attrib.pinyin_size
  651. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  652. : '22px',
  653. }"
  654. >{{
  655. NumberList.indexOf(item.sentArr[pIndex + 3].pinyin) == -1
  656. ? item.sentArr[pIndex + 3].pinyin
  657. : ''
  658. }}</span
  659. >
  660. </template>
  661. <span
  662. class="NNPE-chs"
  663. style="text-align: left"
  664. :class="[sentIndex == index ? 'wordBlank' : '']"
  665. >
  666. <span
  667. :class="[
  668. pItem.timeList[pItem.leg - 1] &&
  669. curQue.wordTime &&
  670. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  671. curTime <= curQue.wordTime[index].ed
  672. ? 'active'
  673. : '',
  674. sentIndex == index ? 'wordBlank' : '',
  675. ]"
  676. :style="{
  677. fontFamily: item.sentArr[pIndex + 3].config.fontFamily,
  678. textDecoration: item.sentArr[pIndex + 3].config.textDecoration,
  679. borderBottom: item.sentArr[pIndex + 3].config.border === 'dotted' ? '1px dotted' : '',
  680. fontWeight: item.sentArr[pIndex + 3].config.fontWeight,
  681. height:
  682. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  683. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  684. lineHeight:
  685. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  686. display: 'inline-block',
  687. width: item.sentArr[pIndex + 3].chs.trim() === '' ? '6px' : '',
  688. color:
  689. pItem.timeList[pItem.leg - 1] &&
  690. curQue.wordTime &&
  691. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  692. curTime <= curQue.wordTime[index].ed &&
  693. attrib
  694. ? attrib.topic_color
  695. : item.sentArr[pIndex + 3].config.color,
  696. }"
  697. >
  698. {{
  699. NumberList.indexOf(item.sentArr[pIndex + 3].pinyin) == -1
  700. ? convertText(item.sentArr[pIndex + 3].chs)
  701. : ''
  702. }}</span
  703. >
  704. <img
  705. v-if="
  706. item.sentArr[pIndex + 3].img &&
  707. item.sentArr[pIndex + 3].img.length > 0 &&
  708. item.sentArr[pIndex + 3].imgPosition === 'after'
  709. "
  710. :src="item.sentArr[pIndex + 3].img[0].file_url"
  711. :style="{
  712. height: attrib && attrib.font_size ? attrib.font_size : '20px',
  713. }"
  714. />
  715. </span>
  716. <template v-if="curQue.property.pinyin_position == 'bottom'">
  717. <span
  718. v-if="config.isShowPY"
  719. :class="[
  720. 'NNPE-pinyin',
  721. sentIndex == index ? 'wordBlank' : '',
  722. noFont.indexOf(item.sentArr[pIndex + 3].pinyin) > -1 ? 'noFont' : '',
  723. ]"
  724. style="text-align: left"
  725. :style="{
  726. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  727. height:
  728. attrib && attrib.pinyin_size
  729. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  730. : '22px',
  731. }"
  732. >{{
  733. NumberList.indexOf(item.sentArr[pIndex + 3].pinyin) == -1
  734. ? item.sentArr[pIndex + 3].pinyin
  735. : ''
  736. }}</span
  737. >
  738. </template>
  739. </span>
  740. </template>
  741. <template v-else>
  742. <span class="NNPE-words-box">
  743. <template v-if="curQue.property.pinyin_position == 'top'">
  744. <span
  745. v-if="config.isShowPY"
  746. class="NNPE-pinyin"
  747. :class="[
  748. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  749. pItem.className ? pItem.className : '',
  750. sentIndex == index ? 'wordBlank' : '',
  751. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  752. ]"
  753. :style="{
  754. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  755. height:
  756. attrib && attrib.pinyin_size
  757. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  758. : '22px',
  759. }"
  760. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  761. >
  762. </template>
  763. <span
  764. class="NNPE-chs"
  765. :class="[
  766. pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
  767. sentIndex == index ? 'wordBlank' : '',
  768. ]"
  769. >
  770. <template v-for="(wItem, wIndex) in pItem.leg">
  771. <span
  772. :key="'ci' + wIndex + pIndex + index"
  773. :class="[
  774. pItem.timeList[wIndex] &&
  775. curQue.wordTime &&
  776. curQue.wordTime[index] &&
  777. curTime >= pItem.timeList[wIndex].wordBg &&
  778. curTime <= curQue.wordTime[index].ed
  779. ? 'active'
  780. : '',
  781. sentIndex == index ? 'wordBlank' : '',
  782. ]"
  783. :style="{
  784. fontFamily: pItem.config.fontFamily,
  785. textDecoration: pItem.config.textDecoration,
  786. borderBottom: pItem.config.border === 'dotted' ? '1px dotted' : '',
  787. fontWeight: pItem.config.fontWeight,
  788. height:
  789. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  790. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  791. lineHeight:
  792. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  793. display: 'inline-block',
  794. width: pItem.chs[wIndex].trim() === '' ? '6px' : '',
  795. color:
  796. pItem.timeList[wIndex] &&
  797. curQue.wordTime &&
  798. curQue.wordTime[index] &&
  799. curTime >= pItem.timeList[wIndex].wordBg &&
  800. curTime <= curQue.wordTime[index].ed &&
  801. attrib
  802. ? attrib.topic_color
  803. : pItem.config.color,
  804. }"
  805. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? convertText(pItem.chs[wIndex]) : '' }}
  806. </span>
  807. </template>
  808. <img
  809. v-if="pItem.img && pItem.img.length > 0 && pItem.imgPosition === 'after'"
  810. :src="pItem.img[0].file_url"
  811. :style="{
  812. height: attrib && attrib.font_size ? attrib.font_size : '20px',
  813. }"
  814. />
  815. </span>
  816. <template v-if="curQue.property.pinyin_position == 'bottom'">
  817. <span
  818. v-if="config.isShowPY"
  819. class="NNPE-pinyin"
  820. :class="[
  821. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  822. pItem.className ? pItem.className : '',
  823. sentIndex == index ? 'wordBlank' : '',
  824. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  825. ]"
  826. :style="{
  827. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  828. height:
  829. attrib && attrib.pinyin_size
  830. ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt'
  831. : '22px',
  832. }"
  833. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  834. >
  835. </template>
  836. </span>
  837. </template>
  838. </template>
  839. </template>
  840. <template v-else>
  841. <span
  842. :style="{
  843. height: pItem.height + 'px',
  844. width: pItem.width + 'px',
  845. }"
  846. ></span>
  847. </template>
  848. </div>
  849. <div style="overflow: hidden; clear: both"></div>
  850. <div
  851. v-if="
  852. item.enwords &&
  853. config.isShowEN &&
  854. (!curQue.enPosition || (curQue.enPosition && curQue.enPosition == 'bottom'))
  855. "
  856. :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
  857. >
  858. {{ convertText(item.enwords) }}
  859. </div>
  860. </div>
  861. <div
  862. v-if="curQue.property.multilingual_position === 'para'"
  863. class="multilingual-para"
  864. :class="[item.isTitle ? 'multilingual-para-center' : '']"
  865. >
  866. {{
  867. multilingualTextList[multilingual] && multilingualTextList[multilingual][index]
  868. ? multilingualTextList[multilingual][index]
  869. : ''
  870. }}
  871. </div>
  872. <div
  873. v-show="
  874. (curQue.wordTime &&
  875. curQue.wordTime[index] &&
  876. curTime >= curQue.wordTime[index].bg &&
  877. curTime <= curQue.wordTime[index].ed) ||
  878. sentIndex == index
  879. "
  880. class="Soundrecord-content"
  881. >
  882. <div class="Soundrecord-content-inner">
  883. <Soundrecord
  884. v-if="refresh"
  885. type="promax"
  886. class="luyin-box"
  887. :TaskModel="TaskModel"
  888. :answer-record-list="
  889. curQue.Bookanswer.practiceModel[index] && curQue.Bookanswer.practiceModel[index].recordList
  890. "
  891. :tm-index="index"
  892. :sent-index="sentIndex"
  893. :attrib="attrib"
  894. @getWavblob="getWavblob"
  895. @handleParentPlay="handleParentPlay"
  896. @sentPause="sentPause"
  897. @handleWav="handleWav"
  898. />
  899. <div v-if="curQue.mp3_list && curQue.mp3_list.length > 0" class="compare-box">
  900. <Audio-compare
  901. :theme-color="themeColor"
  902. :index="index"
  903. :sent-index="sentIndex"
  904. :url="curQue.mp3_list[0].url"
  905. :bg="curQue.wordTime[index].bg"
  906. :ed="curQue.wordTime[index].ed"
  907. :wavblob="wavblob"
  908. :get-cur-time="getCurTime"
  909. :sent-pause="sentPause"
  910. :is-record="isRecord"
  911. :handle-change-stop-audio="handleChangeStopAudio"
  912. :get-play-status="getPlayStatus"
  913. :attrib="attrib"
  914. />
  915. </div>
  916. </div>
  917. <span class="full-screen-icon" @click="fullScreen">
  918. <svg-icon
  919. icon-class="icon-full"
  920. size="24"
  921. :style="{
  922. color: attrib && attrib.topic_color ? attrib.topic_color : '',
  923. }"
  924. />
  925. </span>
  926. </div>
  927. </div>
  928. <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
  929. {{ items }}
  930. </div> -->
  931. </div>
  932. </template>
  933. <template v-for="(items, indexs) in curQue.detail">
  934. <div
  935. v-if="
  936. curQue.property.multilingual_position === 'all' &&
  937. items.multilingualTextList &&
  938. items.multilingualTextList[multilingual] &&
  939. items.multilingualTextList[multilingual].length > 0
  940. "
  941. :key="indexs"
  942. class="multilingual"
  943. >
  944. <div class="multilingual-para" :class="[items.isTitle ? 'multilingual-para-center' : '']">
  945. {{
  946. items.multilingualTextList && items.multilingualTextList[multilingual]
  947. ? items.multilingualTextList[multilingual].join(' ')
  948. : ''
  949. }}
  950. </div>
  951. </div>
  952. </template>
  953. </div>
  954. <div
  955. v-if="
  956. ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
  957. config.isHasPY ||
  958. config.isHasEN) &&
  959. curQue.property.mp3_position === 'bottom'
  960. "
  961. class="aduioLine-box aduioLine-practice-npc aduioLine-box-bottom"
  962. >
  963. <div class="aduioLine-content">
  964. <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
  965. <AudioLine
  966. ref="audioLine"
  967. audio-id="artPraAudio"
  968. :mp3="curQue.mp3_list[0].url"
  969. :get-cur-time="getCurTime"
  970. :stop-audio="stopAudio"
  971. :width="colLength == 2 ? 175 : 700"
  972. :mp3-source="curQue.mp3_list[0].source"
  973. :ed="ed"
  974. type="audioLine"
  975. :attrib="attrib"
  976. @handleChangeStopAudio="handleChangeStopAudio"
  977. @emptyEd="emptyEd"
  978. />
  979. </template>
  980. </div>
  981. <div class="aduioLine-right">
  982. <!-- <span :class="['Repeat-16', isRepeat ? '' : 'disabled']" @click="changeRepeat"></span>
  983. <span
  984. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  985. @click="changePinyin"
  986. v-if="config.isHasPY"
  987. ></span>
  988. <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  989. <SvgIcon
  990. v-if="config.isHasPY"
  991. icon-class="repeat-1"
  992. size="16"
  993. :class="['Repeat-16', isRepeat ? '' : 'disabled']"
  994. :style="{ color: isRepeat ? (attrib ? attrib.topic_color : '') : '#DCDFE6', cursor: 'pointer' }"
  995. @click="changeRepeat"
  996. />
  997. <!-- <span
  998. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  999. @click="changePinyin"
  1000. v-if="config.isHasPY"
  1001. ></span>
  1002. <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  1003. <SvgIcon
  1004. v-if="config.isHasPY"
  1005. icon-class="pin-btn"
  1006. size="16"
  1007. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  1008. :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  1009. @click="changePinyin"
  1010. />
  1011. <!-- <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  1012. <SvgIcon
  1013. v-if="config.isHasEN"
  1014. icon-class="en-btn"
  1015. size="16"
  1016. :class="['EN-16', config.isShowEN ? '' : 'disabled']"
  1017. :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  1018. @click="changeEN"
  1019. />
  1020. </div>
  1021. </div>
  1022. <div :id="'screen-' + mathNum" class="voice-full-screen">
  1023. <Voicefullscreen
  1024. v-if="isFull && resObj"
  1025. :theme-color="themeColor"
  1026. :cur-que="curQue"
  1027. :sent-list="resObj.sentList"
  1028. :sent-index="sentIndex"
  1029. :mp3="curQue.mp3_list && curQue.mp3_list[0] ? curQue.mp3_list[0].url : ''"
  1030. :no-font="noFont"
  1031. :NNPENewWordList="NNPENewWordList"
  1032. :NNPEAnnotationList="NNPEAnnotationList"
  1033. :current-tree-i-d="currentTreeID"
  1034. :config="config"
  1035. :TaskModel="TaskModel"
  1036. :attrib="attrib"
  1037. @handleWav="handleWav"
  1038. @changePinyin="changePinyin"
  1039. @changeEN="changeEN"
  1040. @exitFullscreen="exitFullscreen"
  1041. @changeIsFull="changeIsFull"
  1042. />
  1043. </div>
  1044. </div>
  1045. </template>
  1046. <script>
  1047. import AudioLine from '../voice_matrix/components/AudioLine.vue';
  1048. import Soundrecord from '../../common/SoundRecord.vue';
  1049. import AudioCompare from './components/AudioCompare.vue';
  1050. import Voicefullscreen from './Voicefullscreen.vue';
  1051. export default {
  1052. name: 'ArticleView',
  1053. components: {
  1054. AudioLine,
  1055. Soundrecord,
  1056. AudioCompare,
  1057. Voicefullscreen,
  1058. },
  1059. inject: ['convertText'],
  1060. props: [
  1061. 'curQue',
  1062. 'noFont',
  1063. 'themeColor',
  1064. 'NNPENewWordList',
  1065. 'NNPEAnnotationList',
  1066. 'currentTreeID',
  1067. 'config',
  1068. 'TaskModel',
  1069. 'colLength',
  1070. 'isFull',
  1071. 'multilingual',
  1072. 'attrib',
  1073. ],
  1074. data() {
  1075. return {
  1076. resObj: null,
  1077. curTime: 0, // 单位s
  1078. chsFhList: [',', '。', '”', ':', '》', '?', '!', ';', '#', '、', '’', ')', '〕', '〕〕', '〉'],
  1079. enFhList: [',', '.', ';', '?', '!', ':', '>', '<'],
  1080. firstFhlist: ['(', '“', '‘', '〔', '〔〔', '〈', '《'],
  1081. NumberList: ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'],
  1082. stopAudio: false,
  1083. sentIndex: 0,
  1084. isRepeat: false,
  1085. currSent: null, // 当前句子的时间
  1086. isRecord: false,
  1087. wavblob: null,
  1088. mathNum: Math.random().toString(36).substr(2),
  1089. ed: undefined,
  1090. refresh: true,
  1091. highWords: null,
  1092. newWordList: [],
  1093. multilingualTextList: {},
  1094. };
  1095. },
  1096. computed: {
  1097. isPlaying() {
  1098. let playing = false;
  1099. if (this.$refs.audioLine) {
  1100. playing = this.$refs.audioLine.audio.isPlaying;
  1101. }
  1102. return playing;
  1103. },
  1104. },
  1105. watch: {
  1106. sentIndex: {
  1107. handler(newVal, oldVal) {
  1108. let _this = this;
  1109. if (newVal !== oldVal) {
  1110. let Bookanswer = _this.curQue.Bookanswer;
  1111. if (
  1112. Bookanswer &&
  1113. Bookanswer.practiceModel &&
  1114. Bookanswer.practiceModel[newVal] &&
  1115. Bookanswer.practiceModel[newVal].recordList &&
  1116. Bookanswer.practiceModel[newVal].recordList.length > 0
  1117. ) {
  1118. _this.wavblob = Bookanswer.practiceModel[newVal].recordList[0].wavData;
  1119. } else {
  1120. _this.wavblob = '';
  1121. }
  1122. }
  1123. },
  1124. deep: true,
  1125. },
  1126. isFull: {
  1127. handler(newVal) {
  1128. let _this = this;
  1129. _this.refresh = false;
  1130. if (!newVal) {
  1131. _this.$nextTick(() => {
  1132. // 重新渲染组件
  1133. _this.refresh = true;
  1134. });
  1135. }
  1136. },
  1137. deep: true,
  1138. },
  1139. },
  1140. // 生命周期 - 创建完成(可以访问当前this实例)
  1141. created() {},
  1142. // 生命周期 - 挂载完成(可以访问DOM元素)
  1143. mounted() {
  1144. if (this.curQue) {
  1145. this.handleData();
  1146. }
  1147. },
  1148. beforeCreate() {}, // 生命周期 - 创建之前
  1149. beforeMount() {}, // 生命周期 - 挂载之前
  1150. beforeUpdate() {}, // 生命周期 - 更新之前
  1151. updated() {}, // 生命周期 - 更新之后
  1152. beforeDestroy() {}, // 生命周期 - 销毁之前
  1153. destroyed() {}, // 生命周期 - 销毁完成
  1154. activated() {},
  1155. // 方法集合
  1156. methods: {
  1157. getPlayStatus(val) {
  1158. // this.isPlaying = val;
  1159. },
  1160. // 拼音的显示和隐藏
  1161. changePinyin() {
  1162. if (this.config.isHasPY) {
  1163. this.$emit('changeConfig', 'isShowPY');
  1164. }
  1165. },
  1166. // 英文的显示和隐藏
  1167. changeEN() {
  1168. if (this.config.isHasEN) {
  1169. this.$emit('changeConfig', 'isShowEN');
  1170. }
  1171. },
  1172. pauseAudio() {
  1173. let audio = document.getElementsByTagName('audio');
  1174. if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') === -1 && audio.forEach) {
  1175. audio.forEach((item) => {
  1176. item.pause();
  1177. });
  1178. }
  1179. },
  1180. pauseVideo() {
  1181. let video = document.getElementsByTagName('video');
  1182. if (video && video.length > 0 && window.location.href.indexOf('GCLS-Learn') === -1 && video.forEach) {
  1183. video.forEach((item) => {
  1184. item.pause();
  1185. });
  1186. }
  1187. },
  1188. // 语音全屏
  1189. fullScreen() {
  1190. this.pauseAudio();
  1191. this.pauseVideo();
  1192. this.isFull = true;
  1193. // this.goFullscreen();
  1194. },
  1195. goFullscreen() {
  1196. let id = `screen-${this.mathNum}`;
  1197. let element = document.getElementById(id);
  1198. if (element.requestFullscreen) {
  1199. element.requestFullscreen();
  1200. } else if (element.msRequestFullscreen) {
  1201. element.msRequestFullscreen();
  1202. } else if (element.mozRequestFullScreen) {
  1203. element.mozRequestFullScreen();
  1204. } else if (element.webkitRequestFullscreen) {
  1205. element.webkitRequestFullscreen();
  1206. }
  1207. },
  1208. exitFullscreen() {
  1209. this.isFull = false;
  1210. // if (document.exitFullscreen) {
  1211. // document.exitFullscreen();
  1212. // } else if (document.msExitFullscreen) {
  1213. // document.msExitFullscreen();
  1214. // } else if (document.mozCancelFullScreen) {
  1215. // document.mozCancelFullScreen();
  1216. // } else if (document.webkitExitFullscreen) {
  1217. // document.webkitExitFullscreen();
  1218. // }
  1219. },
  1220. changeIsFull() {
  1221. this.isFull = false;
  1222. },
  1223. getWavblob(wavblob) {
  1224. this.wavblob = wavblob;
  1225. },
  1226. sentPause(isRecord) {
  1227. this.isRecord = isRecord;
  1228. },
  1229. getCurTime(curTime) {
  1230. let _this = this;
  1231. if (_this.isRepeat) {
  1232. let time = curTime * 1000;
  1233. if (time >= _this.currSent.ed || time <= _this.currSent.bg) {
  1234. _this.curTime = _this.currSent.bg;
  1235. this.$refs.audioLine.onTimeupdateTime(_this.currSent.bg / 1000, true);
  1236. } else {
  1237. _this.curTime = curTime * 1000;
  1238. }
  1239. } else {
  1240. _this.curTime = curTime * 1000;
  1241. _this.getSentIndex(_this.curTime);
  1242. }
  1243. },
  1244. getSentIndex(curTime) {
  1245. for (let i = 0; i < this.curQue.wordTime.length; i++) {
  1246. let bg = this.curQue.wordTime[i].bg;
  1247. let ed = this.curQue.wordTime[i].ed;
  1248. if (curTime >= bg && curTime <= ed) {
  1249. this.sentIndex = i;
  1250. break;
  1251. }
  1252. }
  1253. },
  1254. handleData() {
  1255. this.curQue.multilingual.forEach((item) => {
  1256. let trans_arr = item.translation.split('\n');
  1257. this.$set(this.multilingualTextList, item.type, trans_arr);
  1258. });
  1259. let resArr = [];
  1260. let sentArrTotal = [];
  1261. let timeArr = [];
  1262. let curQue = JSON.parse(JSON.stringify(this.curQue));
  1263. let wordTimeList = curQue.wordTime;
  1264. let dhaspinyin = false; // 每段是否有拼音
  1265. let dhaspinyinArr = [];
  1266. this.handleNewword();
  1267. curQue.detail.forEach((dItem, dIndex) => {
  1268. dhaspinyin = false;
  1269. dItem.wordsList.forEach((sItem, sIndex) => {
  1270. let sentArr = [];
  1271. sItem.forEach((wItem, wIndex) => {
  1272. let startIndex = wIndex === 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
  1273. let endIndex = wIndex === 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
  1274. // this.judgePad(sItem, wItem, wIndex);
  1275. let sentence = dItem.sentences[sIndex];
  1276. this.mergeWordSymbol(wItem);
  1277. let words = '';
  1278. if (this.newWordList.length > 0) {
  1279. if (!this.highWords) {
  1280. this.findLightWord(wItem, wIndex, sentence, sItem);
  1281. words = this.highWords ? this.highWords.words : '';
  1282. } else if (wIndex > this.highWords.endIndex - 1) {
  1283. this.highWords = null;
  1284. this.findLightWord(wItem, wIndex, sentence, sItem);
  1285. words = this.highWords ? this.highWords.words : '';
  1286. } else {
  1287. words = this.highWords ? this.highWords.words : '';
  1288. }
  1289. }
  1290. let obj = {
  1291. paraIndex: dIndex, // 段落索引
  1292. sentIndex: sIndex, // 在段落中句子索引
  1293. wordIndex: wIndex, // 单词的索引
  1294. pinyin:
  1295. curQue.pinyin_type === 'pinyin'
  1296. ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
  1297. ? wItem.pinyin_up
  1298. : wItem.pinyin
  1299. : wItem.pinyin_tone,
  1300. chs: wItem.chs,
  1301. padding: true,
  1302. className: wItem.className,
  1303. isShow: wItem.isShow,
  1304. startIndex,
  1305. endIndex,
  1306. leg: wItem.chs.length,
  1307. words,
  1308. timeList: [],
  1309. config: {
  1310. fontFamily: wItem.fontFamily,
  1311. color: wItem.color,
  1312. textDecoration: wItem.textDecoration,
  1313. border: wItem.border,
  1314. fontWeight: wItem.fontWeight,
  1315. },
  1316. matchWords: wItem.matchWords,
  1317. matchNotes: wItem.matchNotes,
  1318. notesColor: wItem.notesColor,
  1319. matchNotesObj: wItem.matchNotesObj,
  1320. img: wItem.img,
  1321. imgPosition: wItem.imgPosition,
  1322. };
  1323. sentArr.push(obj);
  1324. if (wItem.pinyin) dhaspinyin = true;
  1325. });
  1326. let objs = {
  1327. sentArr,
  1328. enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/'/g, '’'),
  1329. };
  1330. sentArrTotal.push(sentArr);
  1331. resArr.push(objs);
  1332. });
  1333. timeArr.push(dItem.timeList);
  1334. dhaspinyinArr.push(dhaspinyin);
  1335. });
  1336. if (wordTimeList && wordTimeList.length > 0) {
  1337. this.mergeWordTime(sentArrTotal, wordTimeList);
  1338. }
  1339. let timeList = [];
  1340. timeArr.forEach((item) => {
  1341. item.forEach((aItem) => {
  1342. if (timeList.indexOf(aItem) < 0) {
  1343. timeList.push(aItem);
  1344. }
  1345. });
  1346. });
  1347. this.resObj = {
  1348. sentList: resArr,
  1349. timeList,
  1350. dhaspinyinArr,
  1351. };
  1352. },
  1353. mergeWordTime(resArr, wordTimeList) {
  1354. resArr.forEach((item, index) => {
  1355. let wordsResultList = wordTimeList[index].wordsResultList;
  1356. item.forEach((wItem) => {
  1357. let startIndex = wItem.startIndex;
  1358. let endIndex = wItem.endIndex;
  1359. wItem.timeList = wordsResultList.slice(startIndex, endIndex);
  1360. });
  1361. });
  1362. },
  1363. // 词和标点合一起
  1364. mergeWordSymbol(wItem) {
  1365. if (this.chsFhList.indexOf(wItem.chs) > -1 || this.firstFhlist.indexOf(wItem.chs) > -1) {
  1366. wItem.isShow = false;
  1367. } else {
  1368. wItem.isShow = true;
  1369. }
  1370. },
  1371. findLightWord(wItem, startIndex, sentence, sItem) {
  1372. let endIndex = 0;
  1373. let words = '';
  1374. this.newWordList.forEach((item) => {
  1375. if (item.length === 1) {
  1376. if (item === wItem.chs && !wItem.banLight) {
  1377. words = wItem.chs;
  1378. endIndex = startIndex + 1;
  1379. }
  1380. } else if (item.substring(0, wItem.chs.length) === wItem.chs && sentence.indexOf(item) > -1) {
  1381. let index = null;
  1382. let chsStr = '';
  1383. for (let i = startIndex; i < sItem.length + 1; i++) {
  1384. index = i;
  1385. if (chsStr.length === item.length) {
  1386. break;
  1387. } else {
  1388. chsStr += sItem[i] ? sItem[i].chs : '';
  1389. }
  1390. }
  1391. if (chsStr === item && !wItem.banLight) {
  1392. words = item;
  1393. endIndex = index;
  1394. }
  1395. } else if (wItem.new_word && wItem.new_word === item && !wItem.banLight) {
  1396. words = item;
  1397. endIndex = startIndex + 1;
  1398. }
  1399. });
  1400. if (words) {
  1401. this.highWords = { words, endIndex };
  1402. } else {
  1403. this.highWords = null;
  1404. }
  1405. },
  1406. handleNewword() {
  1407. let NewWordList = [];
  1408. this.NNPENewWordList.forEach((wItem) => {
  1409. // item.forEach((wItem) => {
  1410. if (wItem.new_word) {
  1411. NewWordList.push(wItem.new_word);
  1412. } else if (wItem.detail && wItem.detail.sentence) {
  1413. NewWordList.push(wItem.detail.sentence);
  1414. }
  1415. // });
  1416. });
  1417. this.newWordList = JSON.parse(JSON.stringify(NewWordList));
  1418. },
  1419. // 判断是否有padding
  1420. judgePad(sItem, wItem, curIndex) {
  1421. let leg = sItem.length;
  1422. if (curIndex < leg - 1) {
  1423. let nextIndex = curIndex + 1;
  1424. let chs = sItem[nextIndex].chs;
  1425. if (this.chsFhList.indexOf(chs) > -1 || this.chsFhList.indexOf(wItem.chs) > -1) {
  1426. wItem.padding = false;
  1427. } else {
  1428. wItem.padding = true;
  1429. }
  1430. if (this.enFhList.indexOf(wItem.pinyin) > -1) {
  1431. wItem.className = 'textLeft';
  1432. }
  1433. }
  1434. },
  1435. // 转化时间
  1436. handleTimeList(list) {
  1437. let listRes = [];
  1438. list.forEach((item) => {
  1439. let res = this.timeStrToSen(item);
  1440. listRes.push(res);
  1441. });
  1442. return listRes;
  1443. },
  1444. // 分:秒转秒
  1445. timeStrToSen(time) {
  1446. if (!time) {
  1447. return -1;
  1448. }
  1449. let pos = time.indexOf(':');
  1450. let min = 0;
  1451. let sec = 0;
  1452. if (pos > 0) {
  1453. min = parseInt(time.substring(0, pos));
  1454. sec = parseFloat(time.substring(pos + 1));
  1455. }
  1456. return min * 60 + sec;
  1457. },
  1458. // 计算总时间
  1459. countWordTime(sentArr) {
  1460. let total = 0;
  1461. sentArr.forEach((item) => {
  1462. total += item.endTime;
  1463. });
  1464. return total;
  1465. },
  1466. // 点击播放某个句子
  1467. handleChangeTime(time, index, ed) {
  1468. let _this = this;
  1469. if (this.isRepeat) {
  1470. _this.currSent = _this.curQue.wordTime[index];
  1471. }
  1472. _this.sentIndex = index;
  1473. _this.ed = ed;
  1474. if (time !== null && time !== undefined) {
  1475. _this.curTime = time;
  1476. _this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
  1477. }
  1478. },
  1479. emptyEd() {
  1480. this.ed = undefined;
  1481. },
  1482. handleWav(list, tmIndex) {
  1483. let _tmIndex = tmIndex || 0;
  1484. this.curQue.Bookanswer.practiceModel[_tmIndex] = {
  1485. recordList: [],
  1486. };
  1487. this.$set(this.curQue.Bookanswer.practiceModel[_tmIndex], 'recordList', list);
  1488. },
  1489. // 录音时暂停音频播放
  1490. handleParentPlay() {
  1491. this.stopAudio = true;
  1492. },
  1493. // 音频播放时改变布尔值
  1494. handleChangeStopAudio() {
  1495. this.stopAudio = false;
  1496. },
  1497. // 单句是否重复播放
  1498. changeRepeat() {
  1499. let _this = this;
  1500. _this.isRepeat = !_this.isRepeat;
  1501. this.currSent = _this.curQue.wordTime[_this.sentIndex];
  1502. },
  1503. }, // 如果页面有keep-alive缓存功能,这个函数会触发
  1504. };
  1505. </script>
  1506. <style lang="scss" scoped>
  1507. //@import url(); 引入公共css类
  1508. .NNPE-ArticleView {
  1509. position: relative;
  1510. width: 100%;
  1511. .ArticleView-full {
  1512. position: absolute;
  1513. top: -33px;
  1514. left: 0;
  1515. z-index: 99999;
  1516. padding-left: 24px;
  1517. font-size: 14px;
  1518. font-weight: bold;
  1519. line-height: 24px;
  1520. color: #000;
  1521. background: url('@/assets/full-screen-red.png') left center no-repeat;
  1522. background-size: 16px 16px;
  1523. }
  1524. .NPC-sentences-list {
  1525. padding: 16px 0;
  1526. overflow: auto;
  1527. }
  1528. .multilingual {
  1529. padding: 6px 24px 12px;
  1530. word-break: break-word;
  1531. }
  1532. .aduioLine-content {
  1533. flex: 1;
  1534. }
  1535. .NNPE-detail-box {
  1536. box-sizing: border-box;
  1537. width: 100%;
  1538. padding: 8px 24px;
  1539. margin-bottom: 8px;
  1540. &.active {
  1541. background: rgba(222, 68, 68, 15%);
  1542. }
  1543. }
  1544. .aduioLine-practice-npc {
  1545. display: flex;
  1546. align-items: center;
  1547. justify-content: flex-start;
  1548. .aduioLine-right {
  1549. box-sizing: border-box;
  1550. display: flex;
  1551. align-items: center;
  1552. justify-content: space-between;
  1553. width: 92px;
  1554. height: 40px;
  1555. padding: 0 12px;
  1556. border-left: 1px solid rgba(0, 0, 0, 10%);
  1557. .svg-icon {
  1558. width: 16px;
  1559. height: 16px;
  1560. cursor: pointer;
  1561. }
  1562. }
  1563. }
  1564. .NNPE-detail {
  1565. overflow: hidden;
  1566. clear: both;
  1567. .NNPE-words {
  1568. float: left;
  1569. padding-bottom: 5px;
  1570. &-box {
  1571. float: left;
  1572. > span {
  1573. display: block;
  1574. &.NNPE-pinyin {
  1575. height: 20px;
  1576. font-family: 'League';
  1577. font-size: 14px;
  1578. font-weight: normal;
  1579. line-height: 1.5;
  1580. color: rgba(0, 0, 0, 45%);
  1581. &.noFont {
  1582. font-family: initial;
  1583. }
  1584. &.textLeft {
  1585. text-align: left;
  1586. }
  1587. &.wordBlank {
  1588. color: rgba(0, 0, 0, 85%);
  1589. }
  1590. }
  1591. &.NNPE-chs {
  1592. display: flex;
  1593. flex-flow: wrap;
  1594. align-items: center;
  1595. font-family: '楷体';
  1596. font-size: 20px;
  1597. line-height: 1.4;
  1598. color: rgba(0, 0, 0, 45%);
  1599. .active {
  1600. color: #de4444;
  1601. }
  1602. &.wordBlank {
  1603. color: rgba(0, 0, 0, 85%);
  1604. }
  1605. }
  1606. // &.padding {
  1607. // padding-right: 6px;
  1608. // }
  1609. }
  1610. }
  1611. &.textLeft {
  1612. text-align: left;
  1613. }
  1614. &.textCenter {
  1615. text-align: center;
  1616. .NNPE-chs {
  1617. justify-content: center;
  1618. }
  1619. }
  1620. &.textRight {
  1621. text-align: right;
  1622. }
  1623. > span {
  1624. display: block;
  1625. &.NNPE-pinyin {
  1626. height: 20px;
  1627. font-family: 'League';
  1628. font-size: 14px;
  1629. font-weight: normal;
  1630. line-height: 1.5;
  1631. color: rgba(0, 0, 0, 45%);
  1632. &.noFont {
  1633. font-family: initial;
  1634. }
  1635. &.textLeft {
  1636. text-align: left;
  1637. }
  1638. &.wordBlank {
  1639. color: rgba(0, 0, 0, 85%);
  1640. }
  1641. }
  1642. &.NNPE-chs {
  1643. display: flex;
  1644. flex-flow: wrap;
  1645. align-items: center;
  1646. font-family: '楷体';
  1647. font-size: 20px;
  1648. line-height: 1.4;
  1649. color: rgba(0, 0, 0, 45%);
  1650. .active {
  1651. color: #de4444;
  1652. }
  1653. &.wordBlank {
  1654. color: rgba(0, 0, 0, 85%);
  1655. }
  1656. }
  1657. &.padding {
  1658. padding: 0 3px;
  1659. }
  1660. }
  1661. }
  1662. }
  1663. .Soundrecord-content {
  1664. display: flex;
  1665. align-items: center;
  1666. justify-content: space-between;
  1667. margin-top: 8px;
  1668. &-inner {
  1669. display: flex;
  1670. align-items: center;
  1671. justify-content: flex-start;
  1672. // width: 304px;
  1673. padding: 4px 12px;
  1674. background: #fff;
  1675. border: 1px solid rgba(0, 0, 0, 10%);
  1676. border-radius: 8px;
  1677. .luyin-box {
  1678. width: 280px;
  1679. // max-width: 280px;
  1680. }
  1681. .compare-box {
  1682. display: flex;
  1683. align-items: center;
  1684. justify-content: center;
  1685. height: 32px;
  1686. }
  1687. }
  1688. .full-screen-icon {
  1689. width: 24px;
  1690. height: 24px;
  1691. cursor: pointer;
  1692. // background: url('@/assets/full-screen-red.png') no-repeat left top;
  1693. // background-size: 100% 100%;
  1694. }
  1695. }
  1696. .enwords {
  1697. padding-left: 3px;
  1698. font-family: 'Helvetica';
  1699. font-size: 14px;
  1700. font-weight: normal;
  1701. line-height: 22px;
  1702. color: rgba(0, 0, 0, 45%);
  1703. word-break: break-word;
  1704. &.wordBlank {
  1705. color: rgba(0, 0, 0, 85%);
  1706. }
  1707. }
  1708. .multilingual-para {
  1709. word-break: break-word;
  1710. &-center {
  1711. text-align: center;
  1712. text-indent: 0;
  1713. }
  1714. }
  1715. }
  1716. </style>