Practicechs.vue 60 KB

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