Practicechs.vue 59 KB

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