Practicechs.vue 43 KB

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