Voicefullscreen.vue 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952
  1. <!-- -->
  2. <template>
  3. <div v-if="sentList" :class="['voicefull', bgIndex == 0 ? 'bg1' : 'bg2']">
  4. <div class="voicefull-bottom" @mouseover="setTopShow(true)" @mouseleave="setTopShow(false)">
  5. <div :class="[isTopShow ? 'voicefull-bottom-show' : 'voicefull-bottom-hidden']">
  6. <div :class="['bottom-left', TaskModel == 'ANSWER' ? 'bottom-left-margin' : '']"></div>
  7. <div :class="['page-count', bgIndex == 0 ? 'page-count-white' : 'page-count-green']">
  8. {{ curSentIndex + 1 }}/{{ sentList.length }}
  9. </div>
  10. </div>
  11. </div>
  12. <div v-if="item" class="voicefull-content">
  13. <div class="vc-box">
  14. <div
  15. :class="[
  16. 'vc-left vc-left-grey',
  17. isShowLeft && bgIndex == 0 ? 'vc-left-black' : '',
  18. isShowLeft && bgIndex == 1 ? 'vc-left-white' : '',
  19. curSentIndex == 0 ? 'hidden' : '',
  20. ]"
  21. @click="prevSentence"
  22. ></div>
  23. </div>
  24. <div class="vc-main">
  25. <div class="NNPE-words-box">
  26. <div style="overflow: hidden; clear: both"></div>
  27. <div
  28. v-if="enwords && config.isShowEN && curQue.enPosition && curQue.enPosition == 'top'"
  29. :class="['enwords', bgIndex == 1 ? 'enwords-green' : '']"
  30. :style="{ fontSize: enSize + 'px' }"
  31. >
  32. {{ enwords }}
  33. </div>
  34. <div
  35. v-for="(pItem, pIndex) in item"
  36. :key="'wordsList' + pIndex"
  37. class="NNPE-words"
  38. :class="[
  39. pItem.chs != '“' && pItem.wordIndex == 0 ? 'textLeft' : 'textCenter',
  40. pItem.chs == '“' ? 'textRight' : '',
  41. ]"
  42. @dblclick="showWordDetail($event, pItem)"
  43. @click="playWord(pItem)"
  44. >
  45. <template>
  46. <template v-if="!pItem.width">
  47. <template v-if="pItem.isShow">
  48. <template
  49. v-if="item[pIndex + 1] && item[pIndex + 1].chs && chsFhList.indexOf(item[pIndex + 1].chs) > -1"
  50. >
  51. <span class="NNPE-words-box">
  52. <template v-if="curQue.property.pinyin_position == 'top'">
  53. <span
  54. v-if="config.isShowPY"
  55. class="NNPE-pinyin"
  56. :class="[
  57. pItem.className ? pItem.className : '',
  58. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  59. bgIndex == 1 ? 'font-white' : '',
  60. ]"
  61. :style="{
  62. fontSize: pySize + 'px',
  63. height: pySize * 1.25 + 'px',
  64. }"
  65. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  66. >
  67. </template>
  68. <span
  69. class="NNPE-chs"
  70. :class="[
  71. pItem.padding && config.isShowPY ? 'padding' : '',
  72. curQue.property.pinyin_position == 'top' ? 'bottom' : '',
  73. ]"
  74. :style="{
  75. height: hzSize * 1.17 + 'px',
  76. }"
  77. >
  78. <template>
  79. <span
  80. v-for="(wItem, wIndex) in pItem.leg"
  81. :key="'ci' + wIndex + pIndex"
  82. :class="[
  83. pItem.timeList &&
  84. pItem.timeList[wIndex] &&
  85. curTime >= pItem.timeList[wIndex].wordBg &&
  86. curQue.wordTime &&
  87. curQue.wordTime[curSentIndex] &&
  88. curTime <= curQue.wordTime[curSentIndex].ed
  89. ? bgIndex == 0
  90. ? 'active'
  91. : 'active-yellow'
  92. : '',
  93. bgIndex == 1 ? 'font-white' : '',
  94. bgIndex == 0 && wordIndex == pItem.wordIndex ? 'wordActive' : '',
  95. bgIndex == 1 && wordIndex == pItem.wordIndex ? 'wordActive-blue' : '',
  96. newWordList.indexOf(pItem.chs) > -1 && !isPlaying ? 'newActive' : '',
  97. pItem.words && !isPlaying ? 'newActive' : '',
  98. ]"
  99. :style="{
  100. fontSize: hzSize + 'px',
  101. fontFamily: pItem.config && pItem.config.fontFamily ? pItem.config.fontFamily : '',
  102. height: hzSize * 1.17 + 'px',
  103. display: 'inline-block',
  104. width: pItem.chs[wIndex].trim() === '' ? '10px' : '',
  105. }"
  106. >{{ pItem.chs[wIndex] }}</span
  107. >
  108. </template>
  109. </span>
  110. <template v-if="curQue.property.pinyin_position == 'bottom'">
  111. <span
  112. v-if="config.isShowPY"
  113. class="NNPE-pinyin bottom"
  114. :class="[
  115. pItem.className ? pItem.className : '',
  116. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  117. bgIndex == 1 ? 'font-white' : '',
  118. ]"
  119. :style="{
  120. fontSize: pySize + 'px',
  121. height: pySize * 1.25 + 'px',
  122. }"
  123. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  124. >
  125. </template>
  126. </span>
  127. <span class="NNPE-words-box">
  128. <template v-if="curQue.property.pinyin_position == 'top'">
  129. <span
  130. v-if="config.isShowPY"
  131. :class="[
  132. 'NNPE-pinyin',
  133. noFont.indexOf(item[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  134. bgIndex == 1 ? 'font-white' : '',
  135. ]"
  136. :style="{
  137. fontSize: pySize + 'px',
  138. textAlign: left,
  139. height: pySize * 1.25 + 'px',
  140. }"
  141. >{{ NumberList.indexOf(item[pIndex + 1].pinyin) == -1 ? item[pIndex + 1].pinyin : '' }}</span
  142. >
  143. </template>
  144. <span
  145. :class="['NNPE-chs', curQue.property.pinyin_position == 'top' ? 'bottom' : '']"
  146. :style="{
  147. fontSize: hzSize + 'px',
  148. textAlign: left,
  149. height: hzSize * 1.17 + 'px',
  150. }"
  151. >
  152. <span
  153. :class="[
  154. pItem.timeList[pItem.leg - 1] &&
  155. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  156. curQue.wordTime &&
  157. curQue.wordTime[curSentIndex] &&
  158. curTime <= curQue.wordTime[curSentIndex].ed
  159. ? bgIndex == 0
  160. ? 'active'
  161. : 'active-yellow'
  162. : '',
  163. bgIndex == 1 ? 'font-white' : '',
  164. newWordList.indexOf(item[pIndex + 1].chs) > -1 && !isPlaying ? 'newActive' : '',
  165. item[pIndex + 1].words && !isPlaying ? 'newActive' : '',
  166. ]"
  167. :style="{
  168. fontSize: hzSize + 'px',
  169. fontFamily:
  170. item[pIndex + 1].config && item[pIndex + 1].config.fontFamily
  171. ? item[pIndex + 1].config.fontFamily
  172. : '',
  173. height: hzSize * 1.17 + 'px',
  174. display: 'inline-block',
  175. width: item[pIndex + 1].chs.trim() === '' ? '10px' : '',
  176. }"
  177. >{{ item[pIndex + 1].chs }}</span
  178. >
  179. </span>
  180. <template v-if="curQue.property.pinyin_position == 'bottom'">
  181. <span
  182. v-if="config.isShowPY"
  183. :class="[
  184. 'NNPE-pinyin',
  185. noFont.indexOf(item[pIndex + 1].pinyin) > -1 ? 'noFont' : '',
  186. bgIndex == 1 ? 'font-white' : '',
  187. 'bottom',
  188. ]"
  189. :style="{
  190. fontSize: pySize + 'px',
  191. textAlign: left,
  192. height: pySize * 1.25 + 'px',
  193. }"
  194. >{{ NumberList.indexOf(item[pIndex + 1].pinyin) == -1 ? item[pIndex + 1].pinyin : '' }}</span
  195. >
  196. </template>
  197. </span>
  198. <span
  199. v-if="item[pIndex + 2] && item[pIndex + 2].chs && chsFhList.indexOf(item[pIndex + 2].chs) > -1"
  200. class="NNPE-words-box"
  201. >
  202. <template v-if="curQue.property.pinyin_position == 'top'">
  203. <span
  204. v-if="config.isShowPY"
  205. :class="[
  206. 'NNPE-pinyin',
  207. noFont.indexOf(item[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  208. bgIndex == 1 ? 'font-white' : '',
  209. ]"
  210. :style="{
  211. fontSize: pySize + 'px',
  212. textAlign: left,
  213. height: pySize * 1.25 + 'px',
  214. }"
  215. >{{ NumberList.indexOf(item[pIndex + 2].pinyin) == -1 ? item[pIndex + 2].pinyin : '' }}</span
  216. >
  217. </template>
  218. <span
  219. :class="['NNPE-chs', curQue.property.pinyin_position == 'top' ? 'bottom' : '']"
  220. :style="{
  221. fontSize: hzSize + 'px',
  222. textAlign: left,
  223. height: hzSize * 1.17 + 'px',
  224. }"
  225. >
  226. <span
  227. :class="[
  228. pItem.timeList[pItem.leg - 1] &&
  229. curTime >= pItem.timeList[pItem.leg - 1].wordBg &&
  230. curQue.wordTime &&
  231. curQue.wordTime[curSentIndex] &&
  232. curTime <= curQue.wordTime[curSentIndex].ed
  233. ? bgIndex == 0
  234. ? 'active'
  235. : 'active-yellow'
  236. : '',
  237. bgIndex == 1 ? 'font-white' : '',
  238. newWordList.indexOf(item[pIndex + 2].chs) > -1 && !isPlaying ? 'newActive' : '',
  239. item[pIndex + 2].words && !isPlaying ? 'newActive' : '',
  240. ]"
  241. :style="{
  242. fontSize: hzSize + 'px',
  243. fontFamily:
  244. item[pIndex + 2].config && item[pIndex + 2].config.fontFamily
  245. ? item[pIndex + 2].config.fontFamily
  246. : '',
  247. height: hzSize * 1.17 + 'px',
  248. display: 'inline-block',
  249. width: item[pIndex + 2].chs.trim() === '' ? '10px' : '',
  250. }"
  251. >{{ item[pIndex + 2].chs }}</span
  252. >
  253. </span>
  254. <template v-if="curQue.property.pinyin_position == 'bottom'">
  255. <span
  256. v-if="config.isShowPY"
  257. :class="[
  258. 'NNPE-pinyin',
  259. noFont.indexOf(item[pIndex + 2].pinyin) > -1 ? 'noFont' : '',
  260. bgIndex == 1 ? 'font-white' : '',
  261. 'bottom',
  262. ]"
  263. :style="{
  264. fontSize: pySize + 'px',
  265. textAlign: left,
  266. height: pySize * 1.25 + 'px',
  267. }"
  268. >{{ NumberList.indexOf(item[pIndex + 2].pinyin) == -1 ? item[pIndex + 2].pinyin : '' }}</span
  269. >
  270. </template>
  271. </span>
  272. </template>
  273. <template v-else>
  274. <template v-if="curQue.property.pinyin_position == 'top'">
  275. <span
  276. v-if="config.isShowPY"
  277. class="NNPE-pinyin"
  278. :class="[
  279. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  280. pItem.className ? pItem.className : '',
  281. noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
  282. bgIndex == 1 ? 'font-white' : '',
  283. ]"
  284. :style="{
  285. fontSize: pySize + 'px',
  286. height: pySize * 1.25 + 'px',
  287. }"
  288. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  289. >
  290. </template>
  291. <span
  292. v-if="pItem.chs != '#'"
  293. class="NNPE-chs"
  294. :class="[
  295. pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
  296. curQue.property.pinyin_position == 'top' ? 'bottom' : '',
  297. ]"
  298. :style="{
  299. height: hzSize * 1.17 + 'px',
  300. }"
  301. >
  302. <template>
  303. <span
  304. v-for="(wItem, wIndex) in pItem.leg"
  305. :key="'ci' + wIndex + pIndex + curSentIndex"
  306. :class="[
  307. pItem.timeList &&
  308. pItem.timeList[wIndex] &&
  309. curTime >= pItem.timeList[wIndex].wordBg &&
  310. curQue.wordTime &&
  311. curQue.wordTime[curSentIndex] &&
  312. curTime <= curQue.wordTime[curSentIndex].ed
  313. ? bgIndex == 0
  314. ? 'active'
  315. : 'active-yellow'
  316. : '',
  317. bgIndex == 1 ? 'font-white' : '',
  318. bgIndex == 0 && wordIndex == pItem.wordIndex ? 'wordActive' : '',
  319. bgIndex == 1 && wordIndex == pItem.wordIndex ? 'wordActive-blue' : '',
  320. newWordList.indexOf(pItem.chs) > -1 && !isPlaying ? 'newActive' : '',
  321. pItem.words && !isPlaying ? 'newActive' : '',
  322. ]"
  323. :style="{
  324. fontSize: hzSize + 'px',
  325. fontFamily: pItem.config && pItem.config.fontFamily ? pItem.config.fontFamily : '',
  326. height: hzSize * 1.17 + 'px',
  327. display: 'inline-block',
  328. width: pItem.chs[wIndex].trim() === '' ? '10px' : '',
  329. }"
  330. >{{ pItem.chs[wIndex] }}</span
  331. >
  332. </template>
  333. </span>
  334. <template v-if="curQue.property.pinyin_position == 'bottom'">
  335. <span
  336. v-if="config.isShowPY"
  337. class="NNPE-pinyin bottom"
  338. :class="[
  339. pItem.chs != '“' && pItem.padding ? 'padding' : '',
  340. pItem.className ? pItem.className : '',
  341. bgIndex == 1 ? 'font-white' : '',
  342. ]"
  343. :style="{
  344. fontSize: pySize + 'px',
  345. height: pySize * 1.25 + 'px',
  346. }"
  347. >{{ NumberList.indexOf(pItem.pinyin) == -1 ? pItem.pinyin : '' }}</span
  348. >
  349. </template>
  350. </template>
  351. </template>
  352. </template>
  353. <template v-else>
  354. <span
  355. :style="{
  356. height: pItem.height + 'px',
  357. width: pItem.width + 'px',
  358. }"
  359. ></span>
  360. </template>
  361. </template>
  362. </div>
  363. </div>
  364. <div style="overflow: hidden; clear: both"></div>
  365. <div
  366. v-if="
  367. enwords && config.isShowEN && (!curQue.enPosition || (curQue.enPosition && curQue.enPosition == 'bottom'))
  368. "
  369. :class="['enwords', bgIndex == 1 ? 'enwords-green' : '']"
  370. :style="{ fontSize: enSize + 'px' }"
  371. >
  372. {{ enwords }}
  373. </div>
  374. </div>
  375. <div class="vc-box-right">
  376. <div
  377. :class="[
  378. 'vc-left vc-right-grey',
  379. isShowRight && bgIndex == 0 ? 'vc-right-black' : '',
  380. isShowRight && bgIndex == 1 ? 'vc-right-white' : '',
  381. curSentIndex == sentList.length - 1 ? 'hidden' : '',
  382. ]"
  383. @click="nextSentence"
  384. ></div>
  385. </div>
  386. </div>
  387. <div class="voicefull-top" @mouseover="setBottomShow(true)" @mouseleave="setBottomShow(false)">
  388. <div :class="[isBottomShow ? 'voicefull-top-show' : 'voicefull-top-hidden']">
  389. <div class="top-left">
  390. <div :class="['select-bg', bgIndex == 1 ? 'select-bg-blue' : '']">
  391. <div :class="['bg-green-box', bgIndex == 1 ? 'active' : '']">
  392. <span :class="['bg-green', bgIndex == 1 ? 'active' : '']" @click="changeBg(1)"></span>
  393. </div>
  394. <div :class="['bg-white-box', bgIndex == 0 ? 'active' : '']">
  395. <span :class="['bg-white', bgIndex == 0 ? 'active' : '']" @click="changeBg(0)"></span>
  396. </div>
  397. </div>
  398. <div :class="['set-fontSize', bgIndex == 1 ? 'set-fontSize-green' : '']">
  399. <template v-if="hzSize >= 34">
  400. <span
  401. :class="['font-jian-black', bgIndex == 1 ? 'font-jian-yellow' : '']"
  402. @click="setFontSize('-')"
  403. ></span>
  404. </template>
  405. <template v-else>
  406. <span
  407. :class="['font-jian-black', bgIndex == 1 ? 'font-jian-yellow-disabled' : 'font-jian-white-disabled']"
  408. ></span>
  409. </template>
  410. <span :class="['font-img-black', bgIndex == 1 ? 'font-img-yellow' : '']"></span>
  411. <template v-if="hzSize <= 76">
  412. <span :class="['font-jia-black', bgIndex == 1 ? 'font-jia-yellow' : '']" @click="setFontSize('+')"></span>
  413. </template>
  414. <template v-else>
  415. <span
  416. :class="['font-jia-black', bgIndex == 1 ? 'font-jia-yellow-disabled' : 'font-jia-white-disabled']"
  417. ></span>
  418. </template>
  419. </div>
  420. <div
  421. :class="['op-btn', bgIndex == 1 ? 'op-btn-green' : '']"
  422. title="键盘控制开启后,可用方向键控制翻页,空格键播放暂停,回车键录音"
  423. @click="changeStatus('isKeyboard')"
  424. >
  425. <span
  426. :class="[
  427. 'keyboard-icon',
  428. !isKeyboard ? 'disabled' : '',
  429. isKeyboard && bgIndex == 1 ? 'keyboard-icon-yellow' : '',
  430. ]"
  431. ></span>
  432. </div>
  433. </div>
  434. <div class="top-middle">
  435. <template v-if="mp3">
  436. <AudioLineSentence
  437. :key="'sent' + curSentIndex"
  438. ref="audioLineSent"
  439. :mp3="mp3"
  440. :get-cur-time="getCurTime"
  441. :audio-id="'artPraAudioId' + curSentIndex"
  442. :stop-audio="stopAudio"
  443. :width="120"
  444. :hide-slider="true"
  445. :bg="bg"
  446. :ed="ed"
  447. :cur-time="curTime"
  448. :max-time="maxTime"
  449. :bg-index="bgIndex"
  450. :is-repeat="isRepeat"
  451. :is-auto="isAuto"
  452. @playChange="playChange"
  453. @rollSentence="rollSentence"
  454. />
  455. </template>
  456. <div :class="['op-btn', bgIndex == 1 ? 'op-btn-green' : '']" @click="setStatus">
  457. <span
  458. :class="[
  459. 'repeat-icon',
  460. !isRepeat && !isAuto ? 'disabled' : '',
  461. !isRepeat && isAuto ? 'auto-icon' : '',
  462. isRepeat && bgIndex == 1 ? 'repeat-icon-yellow' : '',
  463. !isRepeat && isAuto && bgIndex == 1 ? 'auto-icon-yellow' : '',
  464. ]"
  465. ></span>
  466. </div>
  467. <div :class="['op-btn', bgIndex == 1 ? 'op-btn-green' : '']" @click="changePinyin">
  468. <span
  469. :class="[
  470. 'pinyin-icon',
  471. !config.isShowPY ? 'disabled' : '',
  472. config.isShowPY && bgIndex == 1 ? 'pinyin-icon-yellow' : '',
  473. ]"
  474. ></span>
  475. </div>
  476. <div :class="['op-btn', bgIndex == 1 ? 'op-btn-green' : '']" @click="changeEN">
  477. <span
  478. :class="[
  479. 'en-icon',
  480. !enwords ? 'disabled' : '',
  481. !config.isShowEN ? 'disabled' : '',
  482. config.isShowEN && bgIndex == 1 ? 'en-icon-yellow' : '',
  483. ]"
  484. ></span>
  485. </div>
  486. <!-- <div
  487. :class="['op-btn', bgIndex == 1 ? 'op-btn-green' : '']"
  488. title="点击收藏后可在“个人中心”-“我的收藏”查看"
  489. @click="handleColl"
  490. >
  491. <span
  492. :class="[
  493. 'coll-icon',
  494. !isCollArr[curSentIndex] ? 'disabled' : '',
  495. isCollArr[curSentIndex] && bgIndex == 1 ? 'coll-icon-yellow' : '',
  496. ]"
  497. ></span>
  498. </div> -->
  499. </div>
  500. <div :class="['op-btn', bgIndex == 1 ? 'op-btn-green' : '']" @click="exitFullScreen">
  501. <span :class="['close-icon', bgIndex == 1 ? 'close-icon-white' : '']"></span>
  502. </div>
  503. </div>
  504. </div>
  505. <template v-if="isShow">
  506. <div ref="wordcard" class="NNPE-wordDetail" :style="{ left: left + 'px' }">
  507. <Wordcard
  508. :word="word"
  509. :change-word-card="changeWordCard"
  510. :theme-color="themeColor"
  511. :current-tree-i-d="currentTreeID"
  512. :mp3-url="wordPlayMp3"
  513. :bg="wordbgs"
  514. :ed="wordeds"
  515. :attrib="attrib"
  516. />
  517. </div>
  518. </template>
  519. <div v-if="isWordPlay || isNewWordPlay" class="word-play-audio">
  520. <AudioLineSentence
  521. ref="audioLineWord"
  522. :mp3="isWordPlay ? NpcNewWordMp3 : isNewWordPlay ? wordPlayMp3 : ''"
  523. :get-cur-time="getCurWordTime"
  524. :audio-id="'artPraAudioId' + curSentIndex + wordIndex"
  525. :stop-audio="stopAudio"
  526. :width="120"
  527. :hide-slider="false"
  528. :bg="wordbg"
  529. :ed="worded"
  530. :max-time="wordMaxTime"
  531. :bg-index="bgIndex"
  532. :is-repeat="isRepeat"
  533. :word-play="true"
  534. @changePlayStatus="changePlayStatus"
  535. />
  536. </div>
  537. </div>
  538. </template>
  539. <script>
  540. import AudioLineSentence from './components/AudioLineSentence.vue';
  541. import Soundrecorddiff from './components/Soundrecorddiff.vue';
  542. import AudioCompare from './components/AudioCompare.vue';
  543. import Wordcard from './components/Wordcard.vue';
  544. import { LearnWebSI } from '@/api/app';
  545. export default {
  546. name: 'VoiceFullScreen',
  547. components: {
  548. AudioLineSentence,
  549. Soundrecorddiff,
  550. AudioCompare,
  551. Wordcard,
  552. },
  553. props: [
  554. 'sentList',
  555. 'sentIndex',
  556. 'mp3',
  557. 'wordTimeList',
  558. 'curQue',
  559. 'noFont',
  560. 'themeColor',
  561. 'NNPENewWordList',
  562. 'NNPEAnnotationList',
  563. 'currentTreeID',
  564. 'config',
  565. 'TaskModel',
  566. 'NpcNewWordMp3',
  567. 'attrib',
  568. ],
  569. data() {
  570. return {
  571. pySize: 32,
  572. hzSize: 48,
  573. enSize: 24,
  574. bgIndex: 1,
  575. maxTime: 0,
  576. item: null,
  577. bg: 0,
  578. ed: 0,
  579. isRepeat: false,
  580. NumberList: ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳'],
  581. chsFhList: [',', '。', '”', ':', '》', '?', '!', ';', '、'],
  582. enFhList: [',', '.', ';', '?', '!', ':', '>', '<'],
  583. curTime: 0,
  584. wavblob: null,
  585. stopAudio: false,
  586. isRecord: false,
  587. isShowCompare: false,
  588. isShowRight: true,
  589. isShowLeft: true,
  590. curSentIndex: 0,
  591. oldHz: '',
  592. hz: '',
  593. clientY: 0,
  594. top: 0,
  595. left: 0,
  596. newWordList: [],
  597. pinyin: '',
  598. wordIndex: -1,
  599. isShow: false,
  600. wordbg: 0,
  601. worded: 0,
  602. wordbgs: 0,
  603. wordeds: 0,
  604. wordMaxTime: 0,
  605. isWordPlay: false,
  606. isNewWordPlay: false,
  607. curWordTime: 0,
  608. isPlaying: false,
  609. isAuto: false,
  610. key: 'isRepeat',
  611. isKeyboard: true,
  612. isTopShow: false,
  613. isBottomShow: false,
  614. isRecording: false,
  615. recordPlaying: false,
  616. isCollArr: [],
  617. enwords: '',
  618. screenHeight: 0,
  619. wordPlayMp3: '',
  620. };
  621. },
  622. computed: {
  623. // isPlaying: function () {
  624. // let playing = false;
  625. // if (this.$refs.audioLineSent) {
  626. // playing = this.$refs.audioLineSent.audio.isPlaying;
  627. // }
  628. // console.log(playing);
  629. // return playing;
  630. // },
  631. },
  632. watch: {
  633. isRecording: {
  634. handler(newVal, oldVal) {
  635. if (newVal) {
  636. this.isBottomShow = newVal;
  637. }
  638. },
  639. deep: true,
  640. },
  641. recordPlaying: {
  642. handler(newVal, oldVal) {
  643. if (newVal) {
  644. this.isBottomShow = newVal;
  645. }
  646. },
  647. deep: true,
  648. },
  649. sentIndex: {
  650. handler(newVal, oldVal) {
  651. this.curSentIndex = newVal;
  652. this.getSentence();
  653. },
  654. deep: true,
  655. },
  656. hz: {
  657. handler(val, oldVal) {
  658. let _this = this;
  659. if (val) {
  660. _this.handleNewWords(val);
  661. }
  662. },
  663. // 深度观察监听
  664. deep: true,
  665. },
  666. isShow: {
  667. handler(val, oldVal) {
  668. let _this = this;
  669. if (val) {
  670. setTimeout(() => {
  671. _this.cardHeight = _this.$refs.wordcard.offsetHeight;
  672. if (_this.screenHeight - _this.clientY > _this.cardHeight) {
  673. _this.top = _this.clientY + 20;
  674. } else {
  675. _this.top = _this.clientY - _this.cardHeight - 30;
  676. }
  677. }, 50);
  678. }
  679. },
  680. // 深度观察监听
  681. deep: true,
  682. },
  683. },
  684. // 生命周期 - 创建完成(可以访问当前this实例)
  685. created() {},
  686. // 生命周期 - 挂载完成(可以访问DOM元素)
  687. mounted() {
  688. let _this = this;
  689. window.addEventListener('resize', this.getScreenHeight);
  690. _this.getScreenHeight();
  691. document.addEventListener('keyup', function (e) {
  692. if (_this.isKeyboard) {
  693. if (e.keyCode == 32) {
  694. // 空格
  695. _this.$nextTick(() => {
  696. if (_this.$refs.audioLineSent) {
  697. _this.$refs.audioLineSent.PlayAudio();
  698. }
  699. });
  700. } else if (e.keyCode == 38) {
  701. _this.prevSentence();
  702. } else if (e.keyCode == 40) {
  703. _this.nextSentence();
  704. } else if (e.keyCode == 13) {
  705. _this.$nextTick(() => {
  706. _this.$refs.Soundrecorddiff.microphone();
  707. });
  708. }
  709. }
  710. });
  711. if (_this.NNPENewWordList) {
  712. _this.handleNewword();
  713. }
  714. _this.curSentIndex = _this.sentIndex;
  715. _this.getSentence();
  716. document.addEventListener('fullscreenchange', () => {
  717. let isFullscreen =
  718. document.fullscreenElement ||
  719. document.mozFullScreenElement ||
  720. document.webkitFullscreenElement ||
  721. document.fullScreen ||
  722. document.mozFullScreen ||
  723. document.webkitIsFullScreen;
  724. if (!isFullscreen) {
  725. _this.changeFullScreen();
  726. }
  727. });
  728. document.addEventListener('mozfullscreenchange', () => {
  729. let isFullscreen =
  730. document.fullscreenElement ||
  731. document.mozFullScreenElement ||
  732. document.webkitFullscreenElement ||
  733. document.fullScreen ||
  734. document.mozFullScreen ||
  735. document.webkitIsFullScreen;
  736. if (!isFullscreen) {
  737. _this.changeFullScreen();
  738. }
  739. });
  740. document.addEventListener('webkitfullscreenchange', () => {
  741. let isFullscreen =
  742. document.fullscreenElement ||
  743. document.mozFullScreenElement ||
  744. document.webkitFullscreenElement ||
  745. document.fullScreen ||
  746. document.mozFullScreen ||
  747. document.webkitIsFullScreen;
  748. if (!isFullscreen) {
  749. _this.changeFullScreen();
  750. }
  751. });
  752. document.addEventListener('msfullscreenchange', () => {
  753. let isFullscreen =
  754. document.fullscreenElement ||
  755. document.mozFullScreenElement ||
  756. document.webkitFullscreenElement ||
  757. document.fullScreen ||
  758. document.mozFullScreen ||
  759. document.webkitIsFullScreen;
  760. if (!isFullscreen) {
  761. _this.changeFullScreen();
  762. }
  763. });
  764. },
  765. beforeCreate() {}, // 生命周期 - 创建之前
  766. beforeMount() {}, // 生命周期 - 挂载之前
  767. beforeUpdate() {}, // 生命周期 - 更新之前
  768. updated() {}, // 生命周期 - 更新之后
  769. beforeDestroy() {
  770. window.removeEventListener('resize', this.getScreenHeight);
  771. }, // 生命周期 - 销毁之前
  772. destroyed() {}, // 生命周期 - 销毁完成
  773. activated() {},
  774. // 方法集合
  775. methods: {
  776. setTopShow(bool) {
  777. this.isTopShow = bool;
  778. },
  779. setBottomShow(bool) {
  780. if (!this.recordPlaying && !this.isRecording) {
  781. this.isBottomShow = bool;
  782. }
  783. },
  784. getPlayStatus(bool) {
  785. this.recordPlaying = bool;
  786. },
  787. setFontSize(type) {
  788. let _this = this;
  789. if (type == '-') {
  790. if (_this.hzSize >= 34) {
  791. this.hzSize -= 4;
  792. }
  793. }
  794. if (type == '+') {
  795. if (_this.hzSize <= 76) {
  796. this.hzSize += 4;
  797. }
  798. }
  799. _this.pySize = parseInt(_this.hzSize / 1.5);
  800. _this.enSize = parseInt(_this.hzSize / 2);
  801. },
  802. playChange(bool) {
  803. this.isPlaying = bool;
  804. },
  805. handleColl() {
  806. let _this = this;
  807. if (_this.isCollArr[_this.curSentIndex]) {
  808. _this.cancleColl();
  809. } else {
  810. _this.addColl();
  811. }
  812. },
  813. // 添加收藏
  814. addColl() {
  815. let Bookdetail = sessionStorage.getItem('Bookdetail');
  816. // if (Bookdetail) {
  817. Bookdetail = JSON.parse(Bookdetail);
  818. let MethodName = 'order-collection_manager-AddMyCollection';
  819. let text = '';
  820. this.item.forEach((item) => {
  821. if (item.chs != '#') {
  822. text += item.chs;
  823. }
  824. });
  825. let sentence_json = {
  826. item: JSON.stringify(this.item),
  827. bg: this.bg,
  828. ed: this.ed,
  829. mp3: this.mp3,
  830. pyPosition: this.curQue.property.pinyin_position,
  831. };
  832. let data = {
  833. goods_id: this.currentTreeID,
  834. goods_type: 502,
  835. goods_name: Bookdetail.name,
  836. goods_person_name_desc: Bookdetail.author ? Bookdetail.author : '',
  837. goods_picture_id: Bookdetail.picture_id ? Bookdetail.picture_id : '',
  838. goods_price: Bookdetail.price,
  839. sentence: {
  840. sentence_text: text,
  841. sentence_json: JSON.stringify(sentence_json),
  842. },
  843. };
  844. LearnWebSI(MethodName, data).then((res) => {
  845. this.$set(this.isCollArr, this.curSentIndex, true);
  846. this.$message.success('收藏成功!');
  847. });
  848. // } else {
  849. // this.$message.warning('权限不足!');
  850. // }
  851. },
  852. // 取消收藏
  853. cancleColl() {
  854. let text = '';
  855. this.item.forEach((item) => {
  856. if (item.chs != '#') {
  857. text += item.chs;
  858. }
  859. });
  860. let MethodName = 'order-collection_manager-CancelMyGoodsCollection_WS';
  861. let data = {
  862. goods_type: 502,
  863. goods_list: [
  864. {
  865. goods_id: this.currentTreeID, // 课件的id
  866. sentence_text: text,
  867. },
  868. ],
  869. };
  870. LearnWebSI(MethodName, data).then((res) => {
  871. this.$set(this.isCollArr, this.curSentIndex, false);
  872. this.$message.success('取消成功!');
  873. });
  874. },
  875. // 检查收藏状态
  876. checkCollStatus() {
  877. let text = '';
  878. this.item.forEach((item) => {
  879. if (item.chs != '#') {
  880. text += item.chs;
  881. }
  882. });
  883. let MethodName = 'order-collection_manager-CheckMyGoodsCollectionStatus';
  884. let data = {
  885. goods_type: 502,
  886. goods_id: this.currentTreeID, // 课件的id
  887. sentence_text: text,
  888. };
  889. LearnWebSI(MethodName, data).then((res) => {
  890. let collFlag = res.is_collection == 'true';
  891. this.$set(this.isCollArr, this.curSentIndex, collFlag);
  892. });
  893. },
  894. showPrevNext(bool, key) {
  895. this[key] = bool;
  896. },
  897. prevSentence() {
  898. let _this = this;
  899. if (_this.curSentIndex == 0) {
  900. // _this.$message.warning("已经是第一个句子了");
  901. return;
  902. }
  903. _this.curSentIndex -= 1;
  904. _this.getSentence();
  905. if (_this.isAuto) {
  906. _this.curTime = _this.bg;
  907. _this.$refs.audioLineSent.onTimeupdateTime(_this.bg / 1000);
  908. }
  909. },
  910. nextSentence() {
  911. if (this.curSentIndex == this.sentList.length - 1) {
  912. // this.$message.warning("已经是最后一个句子了");
  913. return;
  914. }
  915. this.curSentIndex += 1;
  916. this.getSentence();
  917. },
  918. rollSentence() {
  919. if (this.curSentIndex == this.sentList.length - 1) {
  920. this.curSentIndex = 0;
  921. } else {
  922. this.curSentIndex += 1;
  923. }
  924. this.getSentence();
  925. },
  926. changeStatus(key) {
  927. if (key == 'config.isShowEN') {
  928. if (this.enwords) {
  929. this[key] = !this[key];
  930. }
  931. } else {
  932. this[key] = !this[key];
  933. }
  934. },
  935. changePinyin() {
  936. this.$emit('changePinyin');
  937. },
  938. changeEN() {
  939. this.$emit('changeEN');
  940. },
  941. setStatus() {
  942. let _this = this;
  943. if (_this.key == 'isRepeat') {
  944. if (_this.isRepeat) {
  945. _this.isRepeat = false;
  946. _this.isAuto = true;
  947. _this.key = 'isAuto';
  948. } else {
  949. _this.isRepeat = true;
  950. _this.key = 'isRepeat';
  951. }
  952. } else if (_this.key == 'isAuto') {
  953. if (_this.isAuto) {
  954. _this.isRepeat = false;
  955. _this.isAuto = false;
  956. _this.key = 'isRepeat';
  957. }
  958. }
  959. },
  960. getRerordStatus(bool) {
  961. this.isShowCompare = bool;
  962. },
  963. getMicrophoneStatus(bool) {
  964. this.isRecording = bool;
  965. },
  966. getWavblob(wavblob) {
  967. this.wavblob = wavblob;
  968. },
  969. sentPause(isRecord) {
  970. this.isRecord = isRecord;
  971. },
  972. getCurTime(curTime) {
  973. let _this = this;
  974. if (_this.isRepeat) {
  975. let time = curTime * 1000;
  976. if (time > _this.ed || time < _this.bg) {
  977. _this.curTime = _this.bg;
  978. this.$refs.audioLineSent.onTimeupdateTime(_this.bg / 1000);
  979. } else {
  980. _this.curTime = curTime * 1000;
  981. }
  982. } else if (_this.isAuto) {
  983. let time = curTime * 1000;
  984. if (time > _this.ed) {
  985. _this.rollSentence();
  986. _this.curTime = _this.bg;
  987. _this.$refs.audioLineSent.onTimeupdateTime(_this.bg / 1000);
  988. } else {
  989. _this.curTime = curTime * 1000;
  990. }
  991. } else {
  992. _this.curTime = curTime * 1000;
  993. }
  994. },
  995. getCurCompareTime(curTime) {
  996. let _this = this;
  997. _this.curTime = curTime * 1000;
  998. },
  999. getCurWordTime(curTime) {
  1000. let _this = this;
  1001. _this.curWordTime = curTime * 1000;
  1002. },
  1003. changeBg(bgIndex) {
  1004. this.bgIndex = bgIndex;
  1005. },
  1006. getSentence() {
  1007. let _this = this;
  1008. _this.isShowCompare =
  1009. _this.curQue.Bookanswer.practiceModel[_this.curSentIndex] &&
  1010. _this.curQue.Bookanswer.practiceModel[_this.curSentIndex].recordList &&
  1011. _this.curQue.Bookanswer.practiceModel[_this.curSentIndex].recordList.length > 0;
  1012. _this.pauseAudio();
  1013. _this.isPlaying = false;
  1014. let item = JSON.parse(JSON.stringify(_this.sentList[_this.curSentIndex]));
  1015. console.log(item);
  1016. if (item.sentArr) {
  1017. _this.item = item.sentArr;
  1018. _this.enwords = item.enwords;
  1019. } else {
  1020. _this.item = item;
  1021. }
  1022. _this.sentList.forEach((item) => {
  1023. this.isCollArr.push(false);
  1024. });
  1025. _this.bg =
  1026. _this.curQue.wordTime && _this.curQue.wordTime[_this.curSentIndex]
  1027. ? _this.curQue.wordTime[_this.curSentIndex].bg
  1028. : 0;
  1029. _this.ed =
  1030. _this.curQue.wordTime && _this.curQue.wordTime[_this.curSentIndex]
  1031. ? _this.curQue.wordTime[_this.curSentIndex].ed
  1032. : 0;
  1033. let maxTime = (_this.ed - _this.bg) / 1000;
  1034. if (maxTime < 1) {
  1035. _this.maxTime = 1;
  1036. } else {
  1037. _this.maxTime = maxTime;
  1038. }
  1039. // _this.checkCollStatus();
  1040. },
  1041. pauseAudio() {
  1042. let audio = document.getElementsByTagName('audio');
  1043. if (audio && audio.length > 0 && window.location.href.indexOf('GCLS-Learn') == -1 && audio.forEach) {
  1044. audio.forEach((item) => {
  1045. item.pause();
  1046. });
  1047. }
  1048. },
  1049. exitFullScreen() {
  1050. this.pauseAudio();
  1051. this.$emit('exitFullscreen');
  1052. },
  1053. changeFullScreen() {
  1054. this.pauseAudio();
  1055. this.$emit('changeIsFull');
  1056. },
  1057. handleWav(list, tmIndex) {
  1058. tmIndex = tmIndex || 0;
  1059. this.$emit('handleWav', list, tmIndex);
  1060. },
  1061. // 录音时暂停音频播放
  1062. handleParentPlay() {
  1063. this.stopAudio = true;
  1064. },
  1065. // 音频播放时改变布尔值
  1066. handleChangeStopAudio() {
  1067. this.stopAudio = false;
  1068. },
  1069. // 播放音频
  1070. // playWord(item) {
  1071. // let _this = this;
  1072. // if (this.newWordList.indexOf(item.chs) > -1 || item.words) {
  1073. // _this.pauseAudio();
  1074. // _this.isWordPlay = false;
  1075. // _this.wordIndex = item.wordIndex;
  1076. // setTimeout(() => {
  1077. // let leg = item.timeList.length;
  1078. // _this.wordbg = item.timeList[0].wordBg;
  1079. // _this.worded = item.timeList[leg - 1].wordEd;
  1080. // let wordMaxTime = (_this.worded - _this.wordbg) / 1000;
  1081. // if (wordMaxTime < 1) {
  1082. // _this.wordMaxTime = 1;
  1083. // } else {
  1084. // _this.wordMaxTime = wordMaxTime;
  1085. // }
  1086. // _this.isWordPlay = true;
  1087. // }, 50);
  1088. // }
  1089. // },
  1090. playWord(item) {
  1091. let _this = this;
  1092. if (this.newWordList.indexOf(item.chs) > -1 || item.words) {
  1093. _this.pauseAudio();
  1094. _this.isNewWordPlay = false;
  1095. let new_word = item.words ? item.words : item.chs;
  1096. _this.NNPENewWordList.forEach((itemn) => {
  1097. // items.forEach((itemn) => {
  1098. if (itemn.new_word === new_word) {
  1099. _this.wordbg = itemn.bg;
  1100. _this.worded = itemn.ed;
  1101. _this.wordPlayMp3 = itemn.newWordMp3;
  1102. }
  1103. // });
  1104. });
  1105. setTimeout(() => {
  1106. _this.isNewWordPlay = true;
  1107. }, 50);
  1108. }
  1109. },
  1110. changePlayStatus() {
  1111. this.isWordPlay = false;
  1112. this.isNewWordPlay = false;
  1113. this.wordIndex = -1;
  1114. },
  1115. showWordDetail(e, item) {
  1116. let _this = this;
  1117. if (_this.TaskModel == 'ANSWER') {
  1118. return;
  1119. }
  1120. if (_this.chsFhList.indexOf(item.chs) > -1 || /^[a-zA-Z0-9]/.test(item.chs)) {
  1121. return;
  1122. }
  1123. if (_this.oldHz != item.chs) {
  1124. this.isShow = false;
  1125. setTimeout(() => {
  1126. _this.hz = item.words ? item.words : item.chs;
  1127. _this.pinyin = item.pinyin;
  1128. _this.wordIndex = item.wordIndex;
  1129. }, 50);
  1130. }
  1131. _this.clientY = e.clientY;
  1132. let new_word = item.words ? item.words : item.chs;
  1133. _this.wordPlayMp3 = '';
  1134. _this.NNPENewWordList.forEach((itemn) => {
  1135. // items.forEach((itemn) => {
  1136. if (itemn.new_word === new_word) {
  1137. _this.wordbgs = itemn.bg;
  1138. _this.wordeds = itemn.ed;
  1139. _this.wordPlayMp3 = itemn.newWordMp3;
  1140. }
  1141. // });
  1142. });
  1143. let left = e.clientX;
  1144. let width = 0;
  1145. if (item.chs.length == 1 || item.chs.length == 2) {
  1146. width = 304;
  1147. } else if (item.chs.length == 3 || item.chs.length == 4) {
  1148. width = 432;
  1149. } else if (item.chs.length > 3) {
  1150. width = 560;
  1151. }
  1152. // if (left - this.bodyLeft > this.contentWidth / 2) {
  1153. // _this.left = left - width + 10;
  1154. // } else {
  1155. _this.left = left - width / 2;
  1156. // }
  1157. },
  1158. changeWordCard(isShow) {
  1159. let _this = this;
  1160. _this.isShow = isShow;
  1161. _this.oldHz = '';
  1162. _this.hz = '';
  1163. _this.wordIndex = -1;
  1164. },
  1165. // 处理分词数据
  1166. handleNewWords(val) {
  1167. let _this = this;
  1168. _this.isShow = true;
  1169. _this.word = null;
  1170. if (_this.newWordList.indexOf(val) > -1) {
  1171. for (let i = 0; i < this.NNPENewWordList.length; i++) {
  1172. let pItem = this.NNPENewWordList[i];
  1173. if (pItem.new_word.trim() == val.trim()) {
  1174. let wordlist = val.split('');
  1175. this.word = { list: wordlist, detail: pItem };
  1176. break;
  1177. }
  1178. }
  1179. } else {
  1180. let wordlist = val.split('');
  1181. let option = {
  1182. definition_list: [],
  1183. mp3_list: [],
  1184. new_word: val,
  1185. pinyin: _this.pinyin,
  1186. };
  1187. _this.word = { list: wordlist, detail: option };
  1188. }
  1189. _this.oldHz = val;
  1190. },
  1191. handleNewword() {
  1192. let NewWordList = [];
  1193. this.NNPENewWordList.forEach((wItem) => {
  1194. // item.forEach((wItem) => {
  1195. NewWordList.push(wItem.new_word);
  1196. // });
  1197. });
  1198. this.newWordList = JSON.parse(JSON.stringify(NewWordList));
  1199. },
  1200. getScreenHeight() {
  1201. this.screenHeight = window.innerHeight;
  1202. },
  1203. }, // 如果页面有keep-alive缓存功能,这个函数会触发
  1204. };
  1205. </script>
  1206. <style lang="scss" scoped>
  1207. //@import url(); 引入公共css类
  1208. .voicefull {
  1209. display: flex;
  1210. flex-direction: column;
  1211. width: 100%;
  1212. height: 100vh;
  1213. overflow: hidden;
  1214. .NNPE-wordDetail {
  1215. position: fixed;
  1216. top: 50%;
  1217. z-index: 9999;
  1218. margin-top: -196px;
  1219. // box-shadow: 0 4px 16px rgba(0, 0, 0, 15%);
  1220. }
  1221. &.bg1 {
  1222. background: #fff;
  1223. }
  1224. &.bg2 {
  1225. background: linear-gradient(180deg, #274533 0%, #385f45 100%);
  1226. .newActive {
  1227. color: #ffc600 !important;
  1228. }
  1229. }
  1230. &-top {
  1231. box-sizing: border-box;
  1232. width: 100%;
  1233. height: 136px;
  1234. padding: 0 40px;
  1235. .voicefull-top-hidden {
  1236. display: flex;
  1237. align-items: center;
  1238. justify-content: space-between;
  1239. width: 100%;
  1240. height: 136px;
  1241. visibility: hidden;
  1242. }
  1243. .voicefull-top-show {
  1244. display: flex;
  1245. align-items: center;
  1246. justify-content: space-between;
  1247. width: 100%;
  1248. height: 136px;
  1249. visibility: visible;
  1250. }
  1251. .top-left {
  1252. display: flex;
  1253. align-items: center;
  1254. justify-content: flex-start;
  1255. }
  1256. .select-bg {
  1257. box-sizing: border-box;
  1258. display: flex;
  1259. align-items: center;
  1260. justify-content: space-between;
  1261. justify-content: center;
  1262. width: 96px;
  1263. height: 56px;
  1264. margin-right: 32px;
  1265. border: 1px solid rgba(0, 0, 0, 10%);
  1266. border-radius: 40px;
  1267. &.select-bg-blue {
  1268. background: rgba(255, 255, 255, 10%);
  1269. border: 1px solid rgba(0, 0, 0, 10%);
  1270. }
  1271. > div {
  1272. display: flex;
  1273. align-items: center;
  1274. justify-content: center;
  1275. width: 36px;
  1276. height: 36px;
  1277. border-radius: 100%;
  1278. &.bg-white-box {
  1279. margin-right: 4px;
  1280. background: 0 0;
  1281. &.active {
  1282. background: #de4444;
  1283. }
  1284. }
  1285. &.bg-green-box {
  1286. background: #fff;
  1287. &.active {
  1288. background: #ffc600;
  1289. }
  1290. }
  1291. > span {
  1292. box-sizing: border-box;
  1293. width: 24px;
  1294. height: 24px;
  1295. cursor: pointer;
  1296. border-radius: 100%;
  1297. &.bg-white {
  1298. background: #fff;
  1299. }
  1300. &.bg-green {
  1301. background: linear-gradient(180deg, #274533 0%, #385f45 100%);
  1302. }
  1303. }
  1304. }
  1305. }
  1306. .set-fontSize {
  1307. display: flex;
  1308. align-items: center;
  1309. justify-content: center;
  1310. height: 56px;
  1311. padding: 0 20px;
  1312. background: #fff;
  1313. border: 1px solid rgba(0, 0, 0, 10%);
  1314. border-radius: 40px;
  1315. &-green {
  1316. background: rgba(255, 255, 255, 10%);
  1317. border: 1px solid rgba(0, 0, 0, 10%);
  1318. }
  1319. > span {
  1320. width: 24px;
  1321. height: 24px;
  1322. margin: 0 4px;
  1323. &.font-jian {
  1324. &-black {
  1325. cursor: pointer;
  1326. background: url('@/assets/jian-black.png') no-repeat left top;
  1327. background-size: 100% 100%;
  1328. }
  1329. &-yellow {
  1330. cursor: pointer;
  1331. background: url('@/assets/jian-white.png') no-repeat left top;
  1332. background-size: 100% 100%;
  1333. }
  1334. &-white-disabled {
  1335. cursor: pointer;
  1336. background: url('@/assets/jian-white-disabled.png') no-repeat left top;
  1337. background-size: 100% 100%;
  1338. }
  1339. &-yellow-disabled {
  1340. cursor: pointer;
  1341. background: url('@/assets/jian-yellow-disabled.png') no-repeat left top;
  1342. background-size: 100% 100%;
  1343. }
  1344. }
  1345. &.font-img {
  1346. &-black {
  1347. background: url('@/assets/fontSize-black.png') no-repeat left top;
  1348. background-size: 100% 100%;
  1349. }
  1350. &-yellow {
  1351. background: url('@/assets/fontSize-white.png') no-repeat left top;
  1352. background-size: 100% 100%;
  1353. }
  1354. }
  1355. &.font-jia {
  1356. &-black {
  1357. cursor: pointer;
  1358. background: url('@/assets/jia-black.png') no-repeat left top;
  1359. background-size: 100% 100%;
  1360. }
  1361. &-yellow {
  1362. cursor: pointer;
  1363. background: url('@/assets/jia-white.png') no-repeat left top;
  1364. background-size: 100% 100%;
  1365. }
  1366. &-white-disabled {
  1367. cursor: pointer;
  1368. background: url('@/assets/jia-white-disabled.png') no-repeat left top;
  1369. background-size: 100% 100%;
  1370. }
  1371. &-yellow-disabled {
  1372. cursor: pointer;
  1373. background: url('@/assets/jia-yellow-disabled.png') no-repeat left top;
  1374. background-size: 100% 100%;
  1375. }
  1376. }
  1377. }
  1378. }
  1379. .top-middle {
  1380. display: flex;
  1381. align-items: center;
  1382. justify-content: center;
  1383. .audio-box {
  1384. display: flex;
  1385. align-items: center;
  1386. justify-content: center;
  1387. width: 56px;
  1388. height: 56px;
  1389. background: #fff;
  1390. border: 1px solid rgba(0, 0, 0, 10%);
  1391. border-radius: 40px;
  1392. &-green {
  1393. background: rgba(255, 255, 255, 10%);
  1394. border: 1px solid rgba(0, 0, 0, 10%);
  1395. }
  1396. }
  1397. }
  1398. }
  1399. .op-btn {
  1400. box-sizing: border-box;
  1401. display: flex;
  1402. align-items: center;
  1403. justify-content: center;
  1404. width: 56px;
  1405. height: 56px;
  1406. margin-left: 32px;
  1407. cursor: pointer;
  1408. background: #fff;
  1409. border: 1px solid rgba(0, 0, 0, 10%);
  1410. border-radius: 100%;
  1411. &-green {
  1412. background: rgba(255, 255, 255, 10%);
  1413. border: 1px solid rgba(0, 0, 0, 10%);
  1414. }
  1415. &.close-btn {
  1416. background: #274533;
  1417. border: 1px solid rgba(0, 0, 0, 10%);
  1418. }
  1419. > span {
  1420. width: 24px;
  1421. height: 24px;
  1422. &.close-icon {
  1423. background: url('@/assets/icon/cross-24-normal-black.png') no-repeat left top;
  1424. background-size: 100% 100%;
  1425. &-white {
  1426. background: url('@/assets/icon/cross-24-normal-white.png') no-repeat left top;
  1427. background-size: 100% 100%;
  1428. }
  1429. }
  1430. }
  1431. }
  1432. .repeat-icon {
  1433. background: url('@/assets/icon/Repeat-24-normal-red.png') no-repeat left top;
  1434. background-size: 100% 100%;
  1435. &.disabled {
  1436. background: url('@/assets/icon/Repeat-24-disable-Black.png') no-repeat left top;
  1437. background-size: 100% 100%;
  1438. }
  1439. &-yellow {
  1440. background: url('@/assets/icon/Repeat-24-normal-yellow.png') no-repeat left top;
  1441. background-size: 100% 100%;
  1442. }
  1443. &.auto-icon {
  1444. background: url('@/assets/icon/Auto-24-next-red.png') no-repeat left top;
  1445. background-size: 100% 100%;
  1446. &-yellow {
  1447. background: url('@/assets/icon/Auto-24-next-yellow.png') no-repeat left top;
  1448. background-size: 100% 100%;
  1449. }
  1450. }
  1451. }
  1452. .pinyin-icon {
  1453. background: url('@/assets/icon/pinyin-24-normal-red.png') no-repeat left top;
  1454. background-size: 100% 100%;
  1455. &.disabled {
  1456. background: url('@/assets/icon/pinyin-24-disable-Black.png') no-repeat left top;
  1457. background-size: 100% 100%;
  1458. }
  1459. &-yellow {
  1460. background: url('@/assets/icon/pinyin-24-normal-yellow.png') no-repeat left top;
  1461. background-size: 100% 100%;
  1462. }
  1463. }
  1464. .en-icon {
  1465. background: url('@/assets/icon/EN-24-normal-Red.png') no-repeat left top;
  1466. background-size: 100% 100%;
  1467. &.disabled {
  1468. background: url('@/assets/icon/EN-24-disable-Black.png') no-repeat left top;
  1469. background-size: 100% 100%;
  1470. }
  1471. &-yellow {
  1472. background: url('@/assets/icon/EN-24-normal-yellow.png') no-repeat left top;
  1473. background-size: 100% 100%;
  1474. }
  1475. }
  1476. .coll-icon {
  1477. background: url('@/assets/icon/bookmarkfill-24-normal-red.png') no-repeat left top;
  1478. background-size: 100% 100%;
  1479. &.disabled {
  1480. background: url('@/assets/icon/bookmarkfill-24-disable-Black.png') no-repeat left top;
  1481. background-size: 100% 100%;
  1482. }
  1483. &-yellow {
  1484. background: url('@/assets/icon/bookmarkfill-24-normal-yellow.png') no-repeat left top;
  1485. background-size: 100% 100%;
  1486. }
  1487. }
  1488. .keyboard-icon {
  1489. background: url('@/assets/icon/enter-24-keyboard-red.png') no-repeat left top;
  1490. background-size: 100% 100%;
  1491. &.disabled {
  1492. background: url('@/assets/icon/enter-24-keyboard-disable-Black.png') no-repeat left top;
  1493. background-size: 100% 100%;
  1494. }
  1495. &-yellow {
  1496. background: url('@/assets/icon/enter-24-keyboard-yellow.png') no-repeat left top;
  1497. background-size: 100% 100%;
  1498. }
  1499. }
  1500. &-content {
  1501. box-sizing: border-box;
  1502. display: flex;
  1503. flex: 1;
  1504. align-items: center;
  1505. width: 100%;
  1506. .vc-box {
  1507. padding: 0 8px 0 36px;
  1508. &-right {
  1509. padding: 0 36px 0 8px;
  1510. }
  1511. }
  1512. .vc-left {
  1513. width: 64px;
  1514. height: 64px;
  1515. cursor: pointer;
  1516. &-grey {
  1517. background: url('@/assets/left-grey.png') no-repeat left top;
  1518. background-size: 100% 100%;
  1519. }
  1520. &-black {
  1521. background: url('@/assets/left-black.png') no-repeat left top;
  1522. background-size: 100% 100%;
  1523. }
  1524. &-white {
  1525. background: url('@/assets/left-white.png') no-repeat left top;
  1526. background-size: 100% 100%;
  1527. }
  1528. &.hidden {
  1529. visibility: hidden;
  1530. }
  1531. }
  1532. .vc-right {
  1533. width: 64px;
  1534. height: 64px;
  1535. cursor: pointer;
  1536. &-grey {
  1537. background: url('@/assets/right-grey.png') no-repeat left top;
  1538. background-size: 100% 100%;
  1539. }
  1540. &-black {
  1541. background: url('@/assets/right-black.png') no-repeat left top;
  1542. background-size: 100% 100%;
  1543. }
  1544. &-white {
  1545. background: url('@/assets/right-white.png') no-repeat left top;
  1546. background-size: 100% 100%;
  1547. }
  1548. }
  1549. .vc-main {
  1550. width: fit-content;
  1551. padding: 0 67px;
  1552. margin: 0 auto;
  1553. .enwords {
  1554. padding: 0 3px;
  1555. margin-top: 24px;
  1556. font-family: 'Helvetica';
  1557. font-size: 24px;
  1558. line-height: 32px;
  1559. color: rgba(0, 0, 0, 45%);
  1560. word-break: break-word;
  1561. &-green {
  1562. color: rgba(255, 255, 255, 65%);
  1563. }
  1564. }
  1565. }
  1566. .NNPE-words {
  1567. float: left;
  1568. user-select: none;
  1569. &-box {
  1570. float: left;
  1571. > span {
  1572. display: block;
  1573. &.NNPE-pinyin {
  1574. box-sizing: border-box;
  1575. font-family: 'League';
  1576. font-size: 32px;
  1577. font-weight: normal;
  1578. line-height: 1.25;
  1579. color: rgba(0, 0, 0, 85%);
  1580. &.bottom {
  1581. padding-bottom: 16px;
  1582. }
  1583. &.noFont {
  1584. font-family: initial;
  1585. }
  1586. &.textLeft {
  1587. text-align: left;
  1588. }
  1589. &.font-white {
  1590. color: #fff;
  1591. }
  1592. &.wordBlank {
  1593. color: rgba(0, 0, 0, 85%);
  1594. }
  1595. }
  1596. &.NNPE-chs {
  1597. display: flex;
  1598. flex-flow: wrap; // 兼容不是汉字的内容
  1599. font-family: '楷体';
  1600. font-size: 48px;
  1601. line-height: 1.17;
  1602. color: rgba(0, 0, 0, 85%);
  1603. &.bottom {
  1604. padding-bottom: 16px;
  1605. }
  1606. .font-white {
  1607. color: #fff;
  1608. }
  1609. .active {
  1610. color: #de4444;
  1611. &-yellow {
  1612. color: #ffc600;
  1613. }
  1614. }
  1615. .wordActive {
  1616. color: #de4444;
  1617. }
  1618. .wordActive-blue {
  1619. color: #ffc600;
  1620. }
  1621. .newActive {
  1622. color: #de4444;
  1623. }
  1624. }
  1625. // &.padding {
  1626. // padding-right: 6px;
  1627. // }
  1628. }
  1629. }
  1630. &.textLeft {
  1631. text-align: left;
  1632. }
  1633. &.textCenter {
  1634. text-align: center;
  1635. }
  1636. &.textRight {
  1637. text-align: right;
  1638. }
  1639. > span {
  1640. display: block;
  1641. &.NNPE-pinyin {
  1642. box-sizing: border-box;
  1643. font-family: 'League';
  1644. font-size: 32px;
  1645. font-weight: normal;
  1646. line-height: 1.25;
  1647. color: rgba(0, 0, 0, 85%);
  1648. &.bottom {
  1649. padding-bottom: 16px;
  1650. }
  1651. &.font-white {
  1652. color: #fff;
  1653. }
  1654. &.noFont {
  1655. font-family: initial;
  1656. }
  1657. &.textLeft {
  1658. text-align: left;
  1659. }
  1660. &.wordBlank {
  1661. color: rgba(0, 0, 0, 85%);
  1662. }
  1663. }
  1664. &.NNPE-chs {
  1665. display: flex;
  1666. flex-flow: wrap; // 兼容不是汉字的内容
  1667. font-family: '楷体';
  1668. font-size: 48px;
  1669. line-height: 1.17;
  1670. color: rgba(0, 0, 0, 85%);
  1671. &.bottom {
  1672. padding-bottom: 16px;
  1673. }
  1674. .font-white {
  1675. color: #fff;
  1676. }
  1677. .active {
  1678. color: #de4444;
  1679. &-yellow {
  1680. color: #ffc600;
  1681. }
  1682. }
  1683. .wordActive {
  1684. color: #de4444;
  1685. }
  1686. .wordActive-blue {
  1687. color: #ffc600;
  1688. }
  1689. .newActive {
  1690. color: #de4444;
  1691. }
  1692. }
  1693. &.padding {
  1694. padding-right: 3px;
  1695. padding-left: 3px;
  1696. }
  1697. }
  1698. }
  1699. }
  1700. &-bottom {
  1701. box-sizing: border-box;
  1702. display: flex;
  1703. align-items: center;
  1704. justify-content: space-between;
  1705. width: 100%;
  1706. height: 136px;
  1707. padding-right: 40px;
  1708. .voicefull-bottom-show {
  1709. display: flex;
  1710. align-items: center;
  1711. justify-content: space-between;
  1712. width: 100%;
  1713. height: 136px;
  1714. visibility: visible;
  1715. }
  1716. .voicefull-bottom-hidden {
  1717. display: flex;
  1718. align-items: center;
  1719. justify-content: space-between;
  1720. width: 100%;
  1721. height: 136px;
  1722. visibility: hidden;
  1723. }
  1724. .bottom-left {
  1725. display: flex;
  1726. align-items: center;
  1727. justify-content: flex-start;
  1728. &-margin {
  1729. margin-left: 40px;
  1730. }
  1731. .compare-box {
  1732. box-sizing: border-box;
  1733. height: 56px;
  1734. padding: 16px;
  1735. border: 1px solid rgba(0, 0, 0, 10%);
  1736. border-left: 0 solid rgba(0, 0, 0, 10%);
  1737. border-radius: 0 40px 40px 0;
  1738. &-white {
  1739. background: rgba(255, 255, 255, 10%);
  1740. border: 1px solid rgba(0, 0, 0, 10%);
  1741. border-left: 0;
  1742. }
  1743. &-answer {
  1744. border-radius: 40px;
  1745. }
  1746. }
  1747. }
  1748. .page-count {
  1749. box-sizing: border-box;
  1750. min-width: 60px;
  1751. padding: 8px;
  1752. font-family: 'robot';
  1753. font-size: 16px;
  1754. line-height: 24px;
  1755. color: #000;
  1756. text-align: center;
  1757. background: #fff;
  1758. border-radius: 8px;
  1759. &-green {
  1760. color: #fff;
  1761. background: rgba(255, 255, 255, 20%);
  1762. }
  1763. }
  1764. }
  1765. }
  1766. .word-play-audio {
  1767. position: absolute;
  1768. left: -1000px;
  1769. }
  1770. </style>
  1771. <style lang="scss">
  1772. .NPC-Big-Book-preview-green {
  1773. .bg1 {
  1774. .repeat-icon {
  1775. background: url('@/assets/icon/Repeat-24-normal-Green.png') no-repeat left top;
  1776. background-size: 100% 100%;
  1777. }
  1778. .pinyin-icon {
  1779. background: url('@/assets/icon/pinyin-24-normal-green.png') no-repeat left top;
  1780. background-size: 100% 100%;
  1781. }
  1782. .en-icon {
  1783. background: url('@/assets/icon/EN-24-normal-Green.png') no-repeat left top;
  1784. background-size: 100% 100%;
  1785. }
  1786. .coll-icon {
  1787. background: url('@/assets/icon/bookmarkfill-24-normal-green.png') no-repeat left top;
  1788. background-size: 100% 100%;
  1789. }
  1790. }
  1791. }
  1792. .NPC-Big-Book-preview-brown {
  1793. .bg1 {
  1794. .repeat-icon {
  1795. background: url('@/assets/icon/Repeat-24-normal-Brown.png') no-repeat left top;
  1796. background-size: 100% 100%;
  1797. }
  1798. .pinyin-icon {
  1799. background: url('@/assets/icon/pinyin-24-normal-brown.png') no-repeat left top;
  1800. background-size: 100% 100%;
  1801. }
  1802. .en-icon {
  1803. background: url('@/assets/icon/EN-24-normal-Brown.png') no-repeat left top;
  1804. background-size: 100% 100%;
  1805. }
  1806. .coll-icon {
  1807. background: url('@/assets/icon/bookmarkfill-24-normal-brown.png') no-repeat left top;
  1808. background-size: 100% 100%;
  1809. }
  1810. }
  1811. }
  1812. </style>