Practicechs.vue 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  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. <template v-if="resObj">
  67. <!-- -->
  68. <div class="NPC-sentences-list">
  69. <div
  70. v-for="(item, index) in resObj.sentList"
  71. :key="'detail' + index"
  72. :class="['NNPE-detail-box', sentIndex == index ? 'active' : '']"
  73. :style="{
  74. backgroundColor: sentIndex == index && attrib ? attrib.assist_color : '',
  75. }"
  76. >
  77. <div
  78. :class="['NNPE-detail']"
  79. @click="
  80. handleChangeTime(
  81. curQue.wordTime && curQue.wordTime[index] && curQue.wordTime[index].bg,
  82. index,
  83. curQue.wordTime && curQue.wordTime[index] && curQue.wordTime[index].ed,
  84. )
  85. "
  86. >
  87. <div
  88. v-if="item.enwords && config.isShowEN && curQue.enPosition && curQue.enPosition == 'top'"
  89. :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
  90. >
  91. {{ item.enwords }}
  92. </div>
  93. <div style="overflow: hidden; clear: both"></div>
  94. <div
  95. v-for="(pItem, pIndex) in item.sentArr"
  96. :key="'wordsList' + pIndex"
  97. class="NNPE-words"
  98. :class="[
  99. pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
  100. pItem.chs == '“' ? 'textRight' : '',
  101. ]"
  102. >
  103. <template v-if="!pItem.width">
  104. <template v-if="pItem.isShow">
  105. <template
  106. v-if="
  107. item.sentArr[pIndex + 1] &&
  108. item.sentArr[pIndex + 1].chs &&
  109. chsFhList.indexOf(item.sentArr[pIndex + 1].chs) > -1
  110. "
  111. >
  112. <span class="NNPE-words-box">
  113. <template v-if="curQue.property.pinyin_position == 'top'">
  114. <span
  115. v-if="config.isShowPY"
  116. class="NNPE-pinyin"
  117. :class="[
  118. pItem.className ? pItem.className : '',
  119. sentIndex == index ? 'wordBlank' : '',
  120. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  121. ]"
  122. :style="{
  123. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  124. height:
  125. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  126. }"
  127. >{{ pItem.pinyin }}</span
  128. >
  129. </template>
  130. <span
  131. class="NNPE-chs"
  132. :class="[
  133. pItem.padding && config.isShowPY ? 'padding' : '',
  134. sentIndex == index ? 'wordBlank' : '',
  135. ]"
  136. >
  137. <template>
  138. <span
  139. v-for="(wItem, wIndex) in pItem.leg"
  140. :key="'ci' + wIndex + pIndex + index"
  141. :class="[
  142. pItem.timeList[wIndex] &&
  143. curTime >= pItem.timeList[wIndex].wordBg &&
  144. curTime <= curQue.wordTime[index].ed
  145. ? 'active'
  146. : '',
  147. sentIndex == index ? 'wordBlank' : '',
  148. ]"
  149. :style="{
  150. fontFamily: pItem.config.fontFamily,
  151. height:
  152. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  153. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  154. lineHeight:
  155. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  156. display: 'inline-block',
  157. width: pItem.chs[wIndex].trim() === '' ? '6px' : '',
  158. color:
  159. pItem.timeList[wIndex] &&
  160. curTime >= pItem.timeList[wIndex].wordBg &&
  161. curTime <= curQue.wordTime[index].ed &&
  162. attrib
  163. ? attrib.topic_color
  164. : '',
  165. }"
  166. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs[wIndex] : '' }}</span
  167. >
  168. </template>
  169. </span>
  170. <template v-if="curQue.property.pinyin_position == 'bottom'">
  171. <span
  172. v-if="config.isShowPY"
  173. class="NNPE-pinyin"
  174. :class="[
  175. pItem.className ? pItem.className : '',
  176. sentIndex == index ? 'wordBlank' : '',
  177. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  178. ]"
  179. :style="{
  180. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  181. height:
  182. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  183. }"
  184. >{{ pItem.pinyin }}</span
  185. >
  186. </template>
  187. </span>
  188. <span class="NNPE-words-box">
  189. <template v-if="curQue.property.pinyin_position == 'top'">
  190. <span
  191. v-if="config.isShowPY"
  192. :class="[
  193. 'NNPE-pinyin',
  194. sentIndex == index ? 'wordBlank' : '',
  195. noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  196. ]"
  197. style="text-align: left"
  198. :style="{
  199. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  200. height:
  201. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  202. }"
  203. >{{ item.sentArr[pIndex + 1].pinyin }}</span
  204. >
  205. </template>
  206. <span class="NNPE-chs" style="text-align: left" :class="[sentIndex == index ? 'wordBlank' : '']">
  207. <span
  208. :class="[
  209. pItem.timeList[pItem.leg - 1] &&
  210. curQue.wordTime &&
  211. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  212. curTime <= curQue.wordTime[index].ed
  213. ? 'active'
  214. : '',
  215. sentIndex == index ? 'wordBlank' : '',
  216. ]"
  217. :style="{
  218. fontFamily: item.sentArr[pIndex + 1].config.fontFamily,
  219. height:
  220. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  221. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  222. lineHeight:
  223. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  224. display: 'inline-block',
  225. width: item.sentArr[pIndex + 1].chs.trim() === '' ? '6px' : '',
  226. color:
  227. pItem.timeList[pItem.leg - 1] &&
  228. curQue.wordTime &&
  229. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  230. curTime <= curQue.wordTime[index].ed &&
  231. attrib
  232. ? attrib.topic_color
  233. : '',
  234. }"
  235. >
  236. {{
  237. NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
  238. ? item.sentArr[pIndex + 1].chs
  239. : ''
  240. }}</span
  241. >
  242. </span>
  243. <template v-if="curQue.property.pinyin_position == 'bottom'">
  244. <span
  245. v-if="config.isShowPY"
  246. :class="[
  247. 'NNPE-pinyin',
  248. sentIndex == index ? 'wordBlank' : '',
  249. noFont.indexOf(item.sentArr[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  250. ]"
  251. style="text-align: left"
  252. :style="{
  253. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  254. height:
  255. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  256. }"
  257. >{{ item.sentArr[pIndex + 1].pinyin }}</span
  258. >
  259. </template>
  260. </span>
  261. <span
  262. v-if="
  263. item.sentArr[pIndex + 2] &&
  264. item.sentArr[pIndex + 2].chs &&
  265. chsFhList.indexOf(item.sentArr[pIndex + 2].chs) > -1
  266. "
  267. class="NNPE-words-box"
  268. >
  269. <template v-if="curQue.property.pinyin_position == 'top'">
  270. <span
  271. v-if="config.isShowPY"
  272. :class="[
  273. 'NNPE-pinyin',
  274. sentIndex == index ? 'wordBlank' : '',
  275. noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  276. ]"
  277. style="text-align: left"
  278. :style="{
  279. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  280. height:
  281. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  282. }"
  283. >{{ item.sentArr[pIndex + 2].pinyin }}</span
  284. >
  285. </template>
  286. <span class="NNPE-chs" style="text-align: left" :class="[sentIndex == index ? 'wordBlank' : '']">
  287. <span
  288. :class="[
  289. pItem.timeList[pItem.leg - 1] &&
  290. curQue.wordTime &&
  291. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  292. curTime <= curQue.wordTime[index].ed
  293. ? 'active'
  294. : '',
  295. sentIndex == index ? 'wordBlank' : '',
  296. ]"
  297. :style="{
  298. fontFamily: item.sentArr[pIndex + 2].config.fontFamily,
  299. height:
  300. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  301. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  302. lineHeight:
  303. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  304. display: 'inline-block',
  305. width: item.sentArr[pIndex + 2].chs.trim() === '' ? '6px' : '',
  306. color:
  307. pItem.timeList[pItem.leg - 1] &&
  308. curQue.wordTime &&
  309. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  310. curTime <= curQue.wordTime[index].ed &&
  311. attrib
  312. ? attrib.topic_color
  313. : '',
  314. }"
  315. >
  316. {{
  317. NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
  318. ? item.sentArr[pIndex + 2].chs
  319. : ''
  320. }}</span
  321. >
  322. </span>
  323. <template v-if="curQue.property.pinyin_position == 'bottom'">
  324. <span
  325. v-if="config.isShowPY"
  326. :class="[
  327. 'NNPE-pinyin',
  328. sentIndex == index ? 'wordBlank' : '',
  329. noFont.indexOf(item.sentArr[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  330. ]"
  331. style="text-align: left"
  332. :style="{
  333. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  334. height:
  335. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  336. }"
  337. >{{ item.sentArr[pIndex + 2].pinyin }}</span
  338. >
  339. </template>
  340. </span>
  341. </template>
  342. <template v-else>
  343. <template v-if="curQue.property.pinyin_position == 'top'">
  344. <span
  345. v-if="config.isShowPY"
  346. class="NNPE-pinyin"
  347. :class="[
  348. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  349. pItem.className ? pItem.className : '',
  350. sentIndex == index ? 'wordBlank' : '',
  351. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  352. ]"
  353. :style="{
  354. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  355. height:
  356. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  357. }"
  358. >{{ pItem.pinyin }}</span
  359. >
  360. </template>
  361. <span
  362. class="NNPE-chs"
  363. :class="[
  364. pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
  365. sentIndex == index ? 'wordBlank' : '',
  366. ]"
  367. >
  368. <template>
  369. <span
  370. v-for="(wItem, wIndex) in pItem.leg"
  371. :key="'ci' + wIndex + pIndex + index"
  372. :class="[
  373. pItem.timeList[wIndex] &&
  374. curQue.wordTime &&
  375. curQue.wordTime[index] &&
  376. curTime >= pItem.timeList[wIndex].wordBg &&
  377. curTime <= curQue.wordTime[index].ed
  378. ? 'active'
  379. : '',
  380. sentIndex == index ? 'wordBlank' : '',
  381. ]"
  382. :style="{
  383. fontFamily: pItem.config.fontFamily,
  384. height:
  385. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  386. fontSize: attrib && attrib.font_size ? attrib.font_size : '20px',
  387. lineHeight:
  388. attrib && attrib.font_size ? attrib.font_size.replace('pt', '') * 1.4 + 'pt' : '28px',
  389. display: 'inline-block',
  390. width: pItem.chs[wIndex].trim() === '' ? '6px' : '',
  391. color:
  392. pItem.timeList[wIndex] &&
  393. curQue.wordTime &&
  394. curQue.wordTime[index] &&
  395. curTime >= pItem.timeList[wIndex].wordBg &&
  396. curTime <= curQue.wordTime[index].ed &&
  397. attrib
  398. ? attrib.topic_color
  399. : '',
  400. }"
  401. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.chs[wIndex] : '' }}</span
  402. >
  403. </template>
  404. </span>
  405. <template v-if="curQue.property.pinyin_position == 'bottom'">
  406. <span
  407. v-if="config.isShowPY"
  408. class="NNPE-pinyin"
  409. :class="[
  410. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  411. pItem.className ? pItem.className : '',
  412. sentIndex == index ? 'wordBlank' : '',
  413. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  414. ]"
  415. :style="{
  416. fontSize: attrib && attrib.pinyin_size ? attrib.pinyin_size : '14px',
  417. height:
  418. attrib && attrib.pinyin_size ? attrib.pinyin_size.replace('pt', '') * 1.5 + 'pt' : '22px',
  419. }"
  420. >{{ pItem.pinyin }}</span
  421. >
  422. </template>
  423. </template>
  424. </template>
  425. </template>
  426. <template v-else>
  427. <span
  428. :style="{
  429. height: pItem.height + 'px',
  430. width: pItem.width + 'px',
  431. }"
  432. ></span>
  433. </template>
  434. </div>
  435. <div style="overflow: hidden; clear: both"></div>
  436. <div
  437. v-if="
  438. item.enwords &&
  439. config.isShowEN &&
  440. (!curQue.enPosition || (curQue.enPosition && curQue.enPosition == 'bottom'))
  441. "
  442. :class="['enwords', sentIndex == index ? 'wordBlank' : '']"
  443. >
  444. {{ item.enwords }}
  445. </div>
  446. </div>
  447. <div
  448. v-if="curQue.property.multilingual_position === 'para'"
  449. class="multilingual-para"
  450. :class="[item.isTitle ? 'multilingual-para-center' : '']"
  451. >
  452. {{
  453. multilingualTextList[multilingual] && multilingualTextList[multilingual][index]
  454. ? multilingualTextList[multilingual][index]
  455. : ''
  456. }}
  457. </div>
  458. <div
  459. v-show="
  460. (curQue.wordTime &&
  461. curQue.wordTime[index] &&
  462. curTime >= curQue.wordTime[index].bg &&
  463. curTime <= curQue.wordTime[index].ed) ||
  464. sentIndex == index
  465. "
  466. class="Soundrecord-content"
  467. >
  468. <div class="Soundrecord-content-inner">
  469. <Soundrecord
  470. v-if="refresh"
  471. type="promax"
  472. class="luyin-box"
  473. :TaskModel="TaskModel"
  474. :answer-record-list="
  475. curQue.Bookanswer.practiceModel[index] && curQue.Bookanswer.practiceModel[index].recordList
  476. "
  477. :tm-index="index"
  478. :sent-index="sentIndex"
  479. @getWavblob="getWavblob"
  480. @handleParentPlay="handleParentPlay"
  481. @sentPause="sentPause"
  482. @handleWav="handleWav"
  483. />
  484. <div v-if="curQue.mp3_list && curQue.mp3_list.length > 0" class="compare-box">
  485. <Audio-compare
  486. :theme-color="themeColor"
  487. :index="index"
  488. :sent-index="sentIndex"
  489. :url="curQue.mp3_list[0].id"
  490. :bg="curQue.wordTime[index].bg"
  491. :ed="curQue.wordTime[index].ed"
  492. :wavblob="wavblob"
  493. :get-cur-time="getCurTime"
  494. :sent-pause="sentPause"
  495. :is-record="isRecord"
  496. :handle-change-stop-audio="handleChangeStopAudio"
  497. :get-play-status="getPlayStatus"
  498. :attrib="attrib"
  499. />
  500. </div>
  501. </div>
  502. <span class="full-screen-icon" @click="fullScreen">
  503. <svg-icon
  504. icon-class="icon-full"
  505. size="24"
  506. :style="{
  507. color: attrib && attrib.topic_color ? attrib.topic_color : '',
  508. }"
  509. />
  510. </span>
  511. </div>
  512. </div>
  513. <!-- <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
  514. {{ items }}
  515. </div> -->
  516. </div>
  517. </template>
  518. <template v-for="(items, indexs) in curQue.detail">
  519. <div
  520. v-if="
  521. curQue.property.multilingual_position === 'all' &&
  522. items.multilingualTextList &&
  523. items.multilingualTextList[multilingual] &&
  524. items.multilingualTextList[multilingual].length > 0
  525. "
  526. :key="indexs"
  527. class="multilingual"
  528. >
  529. <div class="multilingual-para" :class="[items.isTitle ? 'multilingual-para-center' : '']">
  530. {{
  531. items.multilingualTextList && items.multilingualTextList[multilingual]
  532. ? items.multilingualTextList[multilingual].join(' ')
  533. : ''
  534. }}
  535. </div>
  536. </div>
  537. </template>
  538. <div
  539. v-if="
  540. ((curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url) ||
  541. config.isHasPY ||
  542. config.isHasEN) &&
  543. curQue.property.mp3_position === 'bottom'
  544. "
  545. class="aduioLine-box aduioLine-practice-npc aduioLine-box-bottom"
  546. >
  547. <div class="aduioLine-content">
  548. <template v-if="curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url">
  549. <AudioLine
  550. ref="audioLine"
  551. audio-id="artPraAudio"
  552. :mp3="curQue.mp3_list[0].url"
  553. :get-cur-time="getCurTime"
  554. :stop-audio="stopAudio"
  555. :width="colLength == 2 ? 175 : 700"
  556. :mp3-source="curQue.mp3_list[0].source"
  557. :ed="ed"
  558. type="audioLine"
  559. :attrib="attrib"
  560. @handleChangeStopAudio="handleChangeStopAudio"
  561. @emptyEd="emptyEd"
  562. />
  563. </template>
  564. </div>
  565. <div class="aduioLine-right">
  566. <!-- <span :class="['Repeat-16', isRepeat ? '' : 'disabled']" @click="changeRepeat"></span>
  567. <span
  568. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  569. @click="changePinyin"
  570. v-if="config.isHasPY"
  571. ></span>
  572. <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  573. <SvgIcon
  574. v-if="config.isHasPY"
  575. icon-class="repeat-1"
  576. size="16"
  577. :class="['Repeat-16', isRepeat ? '' : 'disabled']"
  578. :style="{ color: isRepeat ? (attrib ? attrib.topic_color : '') : '#DCDFE6', cursor: 'pointer' }"
  579. @click="changeRepeat"
  580. />
  581. <!-- <span
  582. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  583. @click="changePinyin"
  584. v-if="config.isHasPY"
  585. ></span>
  586. <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  587. <SvgIcon
  588. v-if="config.isHasPY"
  589. icon-class="pin-btn"
  590. size="16"
  591. :class="['pinyin-16', config.isShowPY ? '' : 'disabled']"
  592. :style="{ color: config.isShowPY ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  593. @click="changePinyin"
  594. />
  595. <!-- <span :class="['EN-16', config.isShowEN ? '' : 'disabled']" @click="changeEN" v-if="config.isHasEN"></span> -->
  596. <SvgIcon
  597. v-if="config.isHasEN"
  598. icon-class="en-btn"
  599. size="16"
  600. :class="['EN-16', config.isShowEN ? '' : 'disabled']"
  601. :style="{ color: config.isShowEN ? (attrib ? attrib.topic_color : '') : '#DCDFE6' }"
  602. @click="changeEN"
  603. />
  604. </div>
  605. </div>
  606. <div :id="'screen-' + mathNum" class="voice-full-screen">
  607. <Voicefullscreen
  608. v-if="isFull && resObj"
  609. :theme-color="themeColor"
  610. :cur-que="curQue"
  611. :sent-list="resObj.sentList"
  612. :sent-index="sentIndex"
  613. :mp3="curQue.mp3_list && curQue.mp3_list[0] ? curQue.mp3_list[0].url : ''"
  614. :no-font="noFont"
  615. :NNPENewWordList="NNPENewWordList"
  616. :current-tree-i-d="currentTreeID"
  617. :config="config"
  618. :TaskModel="TaskModel"
  619. :attrib="attrib"
  620. @handleWav="handleWav"
  621. @changePinyin="changePinyin"
  622. @changeEN="changeEN"
  623. @exitFullscreen="exitFullscreen"
  624. @changeIsFull="changeIsFull"
  625. />
  626. </div>
  627. </div>
  628. </template>
  629. <script>
  630. import AudioLine from '../voice_matrix/components/AudioLine.vue';
  631. import Soundrecord from '../../common/SoundRecord.vue';
  632. import AudioCompare from './components/AudioCompare.vue';
  633. import Voicefullscreen from './Voicefullscreen.vue';
  634. export default {
  635. name: 'ArticleView',
  636. components: {
  637. AudioLine,
  638. Soundrecord,
  639. AudioCompare,
  640. Voicefullscreen,
  641. },
  642. props: [
  643. 'curQue',
  644. 'noFont',
  645. 'themeColor',
  646. 'NNPENewWordList',
  647. 'currentTreeID',
  648. 'config',
  649. 'TaskModel',
  650. 'colLength',
  651. 'isFull',
  652. 'multilingual',
  653. 'attrib',
  654. ],
  655. data() {
  656. return {
  657. resObj: null,
  658. curTime: 0, // 单位s
  659. chsFhList: [',', '。', '”', ':', '》', '?', '!', ';', '、'],
  660. enFhList: [',', '.', ';', '?', '!', ':', '>', '<'],
  661. NumberList: ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'],
  662. stopAudio: false,
  663. sentIndex: 0,
  664. isRepeat: false,
  665. currSent: null, // 当前句子的时间
  666. isRecord: false,
  667. wavblob: null,
  668. mathNum: Math.random().toString(36).substr(2),
  669. ed: undefined,
  670. refresh: true,
  671. multilingualTextList: {},
  672. };
  673. },
  674. computed: {
  675. isPlaying() {
  676. let playing = false;
  677. if (this.$refs.audioLine) {
  678. playing = this.$refs.audioLine.audio.isPlaying;
  679. }
  680. return playing;
  681. },
  682. },
  683. watch: {
  684. sentIndex: {
  685. handler(newVal, oldVal) {
  686. let _this = this;
  687. if (newVal != oldVal) {
  688. let Bookanswer = _this.curQue.Bookanswer;
  689. if (
  690. Bookanswer &&
  691. Bookanswer.practiceModel &&
  692. Bookanswer.practiceModel[newVal] &&
  693. Bookanswer.practiceModel[newVal].recordList &&
  694. Bookanswer.practiceModel[newVal].recordList.length > 0
  695. ) {
  696. _this.wavblob = Bookanswer.practiceModel[newVal].recordList[0].wavData;
  697. } else {
  698. _this.wavblob = '';
  699. }
  700. }
  701. },
  702. deep: true,
  703. },
  704. isFull: {
  705. handler(newVal, oldVal) {
  706. let _this = this;
  707. _this.refresh = false;
  708. if (!newVal) {
  709. _this.$nextTick(() => {
  710. // 重新渲染组件
  711. _this.refresh = true;
  712. });
  713. }
  714. },
  715. deep: true,
  716. },
  717. },
  718. // 生命周期 - 创建完成(可以访问当前this实例)
  719. created() {},
  720. // 生命周期 - 挂载完成(可以访问DOM元素)
  721. mounted() {
  722. if (this.curQue) {
  723. this.handleData();
  724. }
  725. },
  726. beforeCreate() {}, // 生命周期 - 创建之前
  727. beforeMount() {}, // 生命周期 - 挂载之前
  728. beforeUpdate() {}, // 生命周期 - 更新之前
  729. updated() {}, // 生命周期 - 更新之后
  730. beforeDestroy() {}, // 生命周期 - 销毁之前
  731. destroyed() {}, // 生命周期 - 销毁完成
  732. activated() {},
  733. // 方法集合
  734. methods: {
  735. getPlayStatus(val) {
  736. // this.isPlaying = val;
  737. },
  738. // 拼音的显示和隐藏
  739. changePinyin() {
  740. if (this.config.isHasPY) {
  741. this.$emit('changeConfig', 'isShowPY');
  742. }
  743. },
  744. // 英文的显示和隐藏
  745. changeEN() {
  746. if (this.config.isHasEN) {
  747. this.$emit('changeConfig', 'isShowEN');
  748. }
  749. },
  750. pauseAudio() {
  751. let audio = document.getElementsByTagName('audio');
  752. if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && audio.forEach) {
  753. audio.forEach((item) => {
  754. item.pause();
  755. });
  756. }
  757. },
  758. pauseVideo() {
  759. let video = document.getElementsByTagName('video');
  760. if (video && video.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && video.forEach) {
  761. video.forEach((item) => {
  762. item.pause();
  763. });
  764. }
  765. },
  766. // 语音全屏
  767. fullScreen() {
  768. this.pauseAudio();
  769. this.pauseVideo();
  770. this.isFull = true;
  771. this.goFullscreen();
  772. },
  773. goFullscreen() {
  774. let id = `screen-${this.mathNum}`;
  775. let element = document.getElementById(id);
  776. if (element.requestFullscreen) {
  777. element.requestFullscreen();
  778. } else if (element.msRequestFullscreen) {
  779. element.msRequestFullscreen();
  780. } else if (element.mozRequestFullScreen) {
  781. element.mozRequestFullScreen();
  782. } else if (element.webkitRequestFullscreen) {
  783. element.webkitRequestFullscreen();
  784. }
  785. },
  786. exitFullscreen() {
  787. this.isFull = false;
  788. if (document.exitFullscreen) {
  789. document.exitFullscreen();
  790. } else if (document.msExitFullscreen) {
  791. document.msExitFullscreen();
  792. } else if (document.mozCancelFullScreen) {
  793. document.mozCancelFullScreen();
  794. } else if (document.webkitExitFullscreen) {
  795. document.webkitExitFullscreen();
  796. }
  797. },
  798. changeIsFull() {
  799. this.isFull = false;
  800. },
  801. getWavblob(wavblob) {
  802. this.wavblob = wavblob;
  803. },
  804. sentPause(isRecord) {
  805. this.isRecord = isRecord;
  806. },
  807. getCurTime(curTime) {
  808. let _this = this;
  809. if (_this.isRepeat) {
  810. let time = curTime * 1000;
  811. if (time >= _this.currSent.ed || time <= _this.currSent.bg) {
  812. _this.curTime = _this.currSent.bg;
  813. this.$refs.audioLine.onTimeupdateTime(_this.currSent.bg / 1000, true);
  814. } else {
  815. _this.curTime = curTime * 1000;
  816. }
  817. } else {
  818. _this.curTime = curTime * 1000;
  819. _this.getSentIndex(_this.curTime);
  820. }
  821. },
  822. getSentIndex(curTime) {
  823. for (let i = 0; i < this.curQue.wordTime.length; i++) {
  824. let bg = this.curQue.wordTime[i].bg;
  825. let ed = this.curQue.wordTime[i].ed;
  826. if (curTime >= bg && curTime <= ed) {
  827. this.sentIndex = i;
  828. break;
  829. }
  830. }
  831. },
  832. handleData() {
  833. this.curQue.multilingual.forEach((item) => {
  834. let trans_arr = item.translation.split('\n');
  835. this.$set(this.multilingualTextList, item.type, trans_arr);
  836. });
  837. let resArr = [];
  838. let sentArrTotal = [];
  839. let timeArr = [];
  840. let curQue = JSON.parse(JSON.stringify(this.curQue));
  841. let wordTimeList = curQue.wordTime;
  842. let dhaspinyin = false; // 每段是否有拼音
  843. let dhaspinyinArr = [];
  844. curQue.detail.forEach((dItem, dIndex) => {
  845. dhaspinyin = false;
  846. dItem.wordsList.forEach((sItem, sIndex) => {
  847. let sentArr = [];
  848. sItem.forEach((wItem, wIndex) => {
  849. let startIndex = wIndex == 0 ? 0 : sentArr[wIndex - 1].startIndex + sentArr[wIndex - 1].chs.length;
  850. let endIndex = wIndex == 0 ? wItem.chs.length : sentArr[wIndex - 1].endIndex + wItem.chs.length;
  851. // this.judgePad(sItem, wItem, wIndex);
  852. this.mergeWordSymbol(wItem);
  853. let obj = {
  854. paraIndex: dIndex, // 段落索引
  855. sentIndex: sIndex, // 在段落中句子索引
  856. wordIndex: wIndex, // 单词的索引
  857. pinyin:
  858. curQue.pinyin_type === 'pinyin'
  859. ? curQue.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true' && wIndex === 0
  860. ? wItem.pinyin_up
  861. : wItem.pinyin
  862. : wItem.pinyin_tone,
  863. chs: wItem.chs,
  864. padding: true,
  865. className: wItem.className,
  866. isShow: wItem.isShow,
  867. startIndex,
  868. endIndex,
  869. leg: wItem.chs.length,
  870. timeList: [],
  871. config: {
  872. fontFamily: wItem.fontFamily,
  873. },
  874. };
  875. sentArr.push(obj);
  876. if (wItem.pinyin) dhaspinyin = true;
  877. });
  878. let objs = {
  879. sentArr,
  880. enwords: dItem.sentencesEn && dItem.sentencesEn[sIndex] && dItem.sentencesEn[sIndex].replace(/\'/g, '’'),
  881. };
  882. sentArrTotal.push(sentArr);
  883. resArr.push(objs);
  884. });
  885. timeArr.push(dItem.timeList);
  886. dhaspinyinArr.push(dhaspinyin);
  887. });
  888. if (wordTimeList && wordTimeList.length > 0) {
  889. this.mergeWordTime(sentArrTotal, wordTimeList);
  890. }
  891. let timeList = [];
  892. timeArr.forEach((item) => {
  893. item.forEach((aItem) => {
  894. if (timeList.indexOf(aItem) < 0) {
  895. timeList.push(aItem);
  896. }
  897. });
  898. });
  899. this.resObj = {
  900. sentList: resArr,
  901. timeList,
  902. dhaspinyinArr,
  903. };
  904. },
  905. mergeWordTime(resArr, wordTimeList) {
  906. resArr.forEach((item, index) => {
  907. let wordsResultList = wordTimeList[index].wordsResultList;
  908. item.forEach((wItem) => {
  909. let startIndex = wItem.startIndex;
  910. let endIndex = wItem.endIndex;
  911. wItem.timeList = wordsResultList.slice(startIndex, endIndex);
  912. });
  913. });
  914. },
  915. // 词和标点合一起
  916. mergeWordSymbol(wItem) {
  917. if (this.chsFhList.indexOf(wItem.chs) > -1) {
  918. wItem.isShow = false;
  919. } else {
  920. wItem.isShow = true;
  921. }
  922. },
  923. // 判断是否有padding
  924. judgePad(sItem, wItem, curIndex) {
  925. let leg = sItem.length;
  926. if (curIndex < leg - 1) {
  927. let nextIndex = curIndex + 1;
  928. let chs = sItem[nextIndex].chs;
  929. if (this.chsFhList.indexOf(chs) > -1 || this.chsFhList.indexOf(wItem.chs) > -1) {
  930. wItem.padding = false;
  931. } else {
  932. wItem.padding = true;
  933. }
  934. if (this.enFhList.indexOf(wItem.pinyin) > -1) {
  935. wItem.className = 'textLeft';
  936. }
  937. }
  938. },
  939. // 转化时间
  940. handleTimeList(list) {
  941. let listRes = [];
  942. list.forEach((item) => {
  943. let res = timeStrToSen(item);
  944. listRes.push(res);
  945. });
  946. return listRes;
  947. },
  948. // 分:秒转秒
  949. timeStrToSen(time) {
  950. if (!time) {
  951. return -1;
  952. }
  953. let pos = time.indexOf(':');
  954. let min = 0;
  955. let sec = 0;
  956. if (pos > 0) {
  957. min = parseInt(time.substring(0, pos));
  958. sec = parseFloat(time.substring(pos + 1));
  959. }
  960. return min * 60 + sec;
  961. },
  962. // 计算总时间
  963. countWordTime(sentArr) {
  964. let total = 0;
  965. sentArr.forEach((item) => {
  966. total += item.endTime;
  967. });
  968. return total;
  969. },
  970. // 点击播放某个句子
  971. handleChangeTime(time, index, ed) {
  972. let _this = this;
  973. if (this.isRepeat) {
  974. _this.currSent = _this.curQue.wordTime[index];
  975. }
  976. _this.sentIndex = index;
  977. _this.ed = ed;
  978. if (time) {
  979. _this.curTime = time;
  980. _this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
  981. }
  982. },
  983. emptyEd() {
  984. this.ed = undefined;
  985. },
  986. handleWav(list, tmIndex) {
  987. tmIndex = tmIndex || 0;
  988. this.curQue.Bookanswer.practiceModel[tmIndex] = {
  989. recordList: [],
  990. };
  991. this.$set(this.curQue.Bookanswer.practiceModel[tmIndex], 'recordList', list);
  992. },
  993. // 录音时暂停音频播放
  994. handleParentPlay() {
  995. this.stopAudio = true;
  996. },
  997. // 音频播放时改变布尔值
  998. handleChangeStopAudio() {
  999. this.stopAudio = false;
  1000. },
  1001. // 单句是否重复播放
  1002. changeRepeat() {
  1003. let _this = this;
  1004. _this.isRepeat = !_this.isRepeat;
  1005. this.currSent = _this.curQue.wordTime[_this.sentIndex];
  1006. },
  1007. }, // 如果页面有keep-alive缓存功能,这个函数会触发
  1008. };
  1009. </script>
  1010. <style lang="scss" scoped>
  1011. //@import url(); 引入公共css类
  1012. .NNPE-ArticleView {
  1013. position: relative;
  1014. width: 100%;
  1015. .ArticleView-full {
  1016. position: absolute;
  1017. top: -33px;
  1018. left: 0;
  1019. z-index: 99999;
  1020. padding-left: 24px;
  1021. font-size: 14px;
  1022. font-weight: bold;
  1023. line-height: 24px;
  1024. color: #000;
  1025. background: url('@/assets/full-screen-red.png') left center no-repeat;
  1026. background-size: 16px 16px;
  1027. }
  1028. .NPC-sentences-list {
  1029. padding: 16px 0;
  1030. }
  1031. .multilingual {
  1032. padding: 6px 24px 12px;
  1033. word-break: break-word;
  1034. }
  1035. .aduioLine-content {
  1036. flex: 1;
  1037. }
  1038. .NNPE-detail-box {
  1039. box-sizing: border-box;
  1040. width: 100%;
  1041. padding: 8px 24px;
  1042. margin-bottom: 8px;
  1043. &.active {
  1044. background: rgba(222, 68, 68, 15%);
  1045. }
  1046. }
  1047. .aduioLine-practice-npc {
  1048. display: flex;
  1049. align-items: center;
  1050. justify-content: flex-start;
  1051. .aduioLine-right {
  1052. box-sizing: border-box;
  1053. display: flex;
  1054. align-items: center;
  1055. justify-content: space-between;
  1056. width: 92px;
  1057. height: 40px;
  1058. padding: 0 12px;
  1059. border-left: 1px solid rgba(0, 0, 0, 10%);
  1060. .svg-icon {
  1061. width: 16px;
  1062. height: 16px;
  1063. cursor: pointer;
  1064. }
  1065. }
  1066. }
  1067. .NNPE-detail {
  1068. overflow: hidden;
  1069. clear: both;
  1070. .NNPE-words {
  1071. float: left;
  1072. padding-bottom: 5px;
  1073. &-box {
  1074. float: left;
  1075. > span {
  1076. display: block;
  1077. &.NNPE-pinyin {
  1078. height: 20px;
  1079. font-family: 'League';
  1080. font-size: 14px;
  1081. font-weight: normal;
  1082. line-height: 1.5;
  1083. color: rgba(0, 0, 0, 45%);
  1084. &.noFont {
  1085. font-family: initial;
  1086. }
  1087. &.textLeft {
  1088. text-align: left;
  1089. }
  1090. &.wordBlank {
  1091. color: rgba(0, 0, 0, 85%);
  1092. }
  1093. }
  1094. &.NNPE-chs {
  1095. display: flex;
  1096. flex-flow: wrap;
  1097. font-family: '楷体';
  1098. font-size: 20px;
  1099. line-height: 1.4;
  1100. color: rgba(0, 0, 0, 45%);
  1101. .active {
  1102. color: #de4444;
  1103. }
  1104. &.wordBlank {
  1105. color: rgba(0, 0, 0, 85%);
  1106. }
  1107. }
  1108. // &.padding {
  1109. // padding-right: 6px;
  1110. // }
  1111. }
  1112. }
  1113. &.textLeft {
  1114. text-align: left;
  1115. }
  1116. &.textCenter {
  1117. text-align: center;
  1118. .NNPE-chs {
  1119. justify-content: center;
  1120. }
  1121. }
  1122. &.textRight {
  1123. text-align: right;
  1124. }
  1125. > span {
  1126. display: block;
  1127. &.NNPE-pinyin {
  1128. height: 20px;
  1129. font-family: 'League';
  1130. font-size: 14px;
  1131. font-weight: normal;
  1132. line-height: 1.5;
  1133. color: rgba(0, 0, 0, 45%);
  1134. &.noFont {
  1135. font-family: initial;
  1136. }
  1137. &.textLeft {
  1138. text-align: left;
  1139. }
  1140. &.wordBlank {
  1141. color: rgba(0, 0, 0, 85%);
  1142. }
  1143. }
  1144. &.NNPE-chs {
  1145. display: flex;
  1146. flex-flow: wrap;
  1147. font-family: '楷体';
  1148. font-size: 20px;
  1149. line-height: 1.4;
  1150. color: rgba(0, 0, 0, 45%);
  1151. .active {
  1152. color: #de4444;
  1153. }
  1154. &.wordBlank {
  1155. color: rgba(0, 0, 0, 85%);
  1156. }
  1157. }
  1158. &.padding {
  1159. padding: 0 3px;
  1160. }
  1161. }
  1162. }
  1163. }
  1164. .Soundrecord-content {
  1165. display: flex;
  1166. align-items: center;
  1167. justify-content: space-between;
  1168. margin-top: 8px;
  1169. &-inner {
  1170. display: flex;
  1171. align-items: center;
  1172. justify-content: flex-start;
  1173. width: 304px;
  1174. padding: 4px 12px;
  1175. background: #fff;
  1176. border: 1px solid rgba(0, 0, 0, 10%);
  1177. border-radius: 8px;
  1178. .luyin-box {
  1179. width: 280px;
  1180. max-width: 280px;
  1181. }
  1182. .compare-box {
  1183. display: flex;
  1184. align-items: center;
  1185. justify-content: center;
  1186. height: 32px;
  1187. }
  1188. }
  1189. .full-screen-icon {
  1190. width: 24px;
  1191. height: 24px;
  1192. cursor: pointer;
  1193. // background: url('@/assets/full-screen-red.png') no-repeat left top;
  1194. // background-size: 100% 100%;
  1195. }
  1196. }
  1197. .enwords {
  1198. padding-left: 3px;
  1199. font-family: 'Helvetica';
  1200. font-size: 14px;
  1201. font-weight: normal;
  1202. line-height: 22px;
  1203. color: rgba(0, 0, 0, 45%);
  1204. word-break: break-word;
  1205. &.wordBlank {
  1206. color: rgba(0, 0, 0, 85%);
  1207. }
  1208. }
  1209. .multilingual-para {
  1210. word-break: break-word;
  1211. &-center {
  1212. text-align: center;
  1213. text-indent: 0;
  1214. }
  1215. }
  1216. }
  1217. </style>