VoiceMatrixFullscreen.vue 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781
  1. <template>
  2. <div :class="['voicefull', bgIndex === 0 ? 'bg1' : 'bg2']">
  3. <div
  4. class="voicefull-top"
  5. @mouseover="setTopShow(true)"
  6. @mouseleave="setTopShow(false)"
  7. >
  8. <div :class="[isTopShow ? 'voicefull-top-show' : 'voicefull-top-hidden']">
  9. <div class="top-left">
  10. <div :class="['select-bg', bgIndex === 1 ? 'select-bg-blue' : '']">
  11. <div :class="['bg-green-box', bgIndex === 1 ? 'active' : '']">
  12. <span
  13. :class="['bg-green', bgIndex === 1 ? 'active' : '']"
  14. @click="changeBg(1)"
  15. />
  16. </div>
  17. <div :class="['bg-white-box', bgIndex === 0 ? 'active' : '']">
  18. <span
  19. :class="['bg-white', bgIndex === 0 ? 'active' : '']"
  20. @click="changeBg(0)"
  21. />
  22. </div>
  23. </div>
  24. <div
  25. :class="['set-fontSize', bgIndex === 1 ? 'set-fontSize-green' : '']"
  26. >
  27. <template v-if="hzSize >= 34">
  28. <span
  29. :class="[
  30. 'font-jian-black',
  31. bgIndex === 1 ? 'font-jian-yellow' : ''
  32. ]"
  33. @click="setFontSize('-')"
  34. />
  35. </template>
  36. <template v-else>
  37. <span
  38. :class="[
  39. 'font-jian-black',
  40. bgIndex === 1
  41. ? 'font-jian-yellow-disabled'
  42. : 'font-jian-white-disabled'
  43. ]"
  44. />
  45. </template>
  46. <span
  47. :class="[
  48. 'font-img-black',
  49. bgIndex === 1 ? 'font-img-yellow' : ''
  50. ]"
  51. />
  52. <template v-if="hzSize <= 76">
  53. <span
  54. :class="[
  55. 'font-jia-black',
  56. bgIndex === 1 ? 'font-jia-yellow' : ''
  57. ]"
  58. @click="setFontSize('+')"
  59. />
  60. </template>
  61. <template v-else>
  62. <span
  63. :class="[
  64. 'font-jia-black',
  65. bgIndex === 1
  66. ? 'font-jia-yellow-disabled'
  67. : 'font-jia-white-disabled'
  68. ]"
  69. />
  70. </template>
  71. </div>
  72. <div
  73. :class="['op-btn', bgIndex === 1 ? 'op-btn-green' : '']"
  74. @click="changeStatus('isKeyboard')"
  75. >
  76. <span
  77. :class="[
  78. 'keyboard-icon',
  79. !isKeyboard ? 'disabled' : '',
  80. isKeyboard && bgIndex === 1 ? 'keyboard-icon-yellow' : ''
  81. ]"
  82. />
  83. </div>
  84. </div>
  85. <div class="top-middle">
  86. <template v-if="mp3">
  87. <voice-matrix-fullscreen-audio
  88. ref="audioLine"
  89. audio-id="voiceMatrixAudio"
  90. :bg-index="bgIndex"
  91. :mp3="mp3"
  92. :get-cur-time="getCurTime"
  93. :stop-audio="stopAudio"
  94. :has-selected-cell="hasSelectedCell"
  95. @playChange="playChange"
  96. @parentPlayAudio="playAudio"
  97. @handleChangeStopAudio="handleChangeStopAudio"
  98. />
  99. </template>
  100. <div
  101. :class="['op-btn', bgIndex === 1 ? 'op-btn-green' : '']"
  102. @click="setStatus"
  103. >
  104. <span
  105. :class="[
  106. 'repeat-icon',
  107. !isRepeat && !isAuto ? 'disabled' : '',
  108. isRepeat && !isAuto ? 'auto-icon' : '',
  109. !isRepeat && bgIndex === 1 ? 'repeat-icon-yellow' : '',
  110. isRepeat && !isAuto && bgIndex === 1 ? 'auto-icon-yellow' : ''
  111. ]"
  112. />
  113. </div>
  114. <div
  115. :class="['op-btn', bgIndex === 1 ? 'op-btn-green' : '']"
  116. @click="changePinyin"
  117. >
  118. <span
  119. :class="[
  120. 'pinyin-icon',
  121. !isShowPY || !isHasPY ? 'disabled' : '',
  122. isShowPY && isHasPY && bgIndex === 1 ? 'pinyin-icon-yellow' : ''
  123. ]"
  124. />
  125. </div>
  126. <div
  127. :class="['op-btn', bgIndex === 1 ? 'op-btn-green' : '']"
  128. @click="changeEN"
  129. >
  130. <span
  131. :class="[
  132. 'en-icon',
  133. !isShowEN || !isHasEN ? 'disabled' : '',
  134. isShowEN && bgIndex === 1 && isHasEN ? 'en-icon-yellow' : ''
  135. ]"
  136. />
  137. </div>
  138. </div>
  139. <div
  140. :class="['op-btn', bgIndex === 1 ? 'op-btn-green' : '']"
  141. @click="exitFullScreen"
  142. >
  143. <span
  144. :class="['close-icon', bgIndex === 1 ? 'close-icon-white' : '']"
  145. />
  146. </div>
  147. </div>
  148. </div>
  149. <div class="voicefull-content">
  150. <div
  151. v-if="curQue.voiceMatrix.matrix.length > 0"
  152. class="matrix"
  153. :style="{
  154. 'grid-template': `96px repeat(${curQue.voiceMatrix.matrix.length}, auto) minmax(1.5em, 1fr) / 112px repeat(${curQue.voiceMatrix.matrix[0].length}, auto) minmax(124px, 1fr)`,
  155. 'font-size': `${hzSize}px`
  156. }"
  157. @mouseleave="clearSelectCell"
  158. >
  159. <!-- 顶部单元格 -->
  160. <div class="matrix-top" @mouseenter="clearSelectCell" />
  161. <template v-for="(row, i) in curQue.voiceMatrix.matrix[0]">
  162. <div
  163. :key="`top-${i}`"
  164. :class="['matrix-top']"
  165. @mouseenter="checkboxMouseenter(selectColumn === i, 'column')"
  166. >
  167. <span
  168. v-if="
  169. row.type !== 'connection' && curQue.voiceMatrix.columnSelection
  170. "
  171. v-show="
  172. selectColumn === i ||
  173. (selectedLine.type === 'column' && selectedLine.index === i)
  174. "
  175. :class="[
  176. `matrix-checkbox-row-${themeColor}`,
  177. selectedLine.type === 'column' && selectedLine.index === i
  178. ? 'active'
  179. : ''
  180. ]"
  181. @click="selectRowOrColumn(i, 'column')"
  182. />
  183. </div>
  184. </template>
  185. <div class="matrix-top" @mouseenter="clearSelectCell" />
  186. <!-- 主矩阵 -->
  187. <template v-for="(row, i) in curQue.voiceMatrix.matrix">
  188. <div
  189. :key="`start-${i}`"
  190. :class="['column-wrapper']"
  191. @mouseenter="checkboxMouseenter(selectRow === i, 'row')"
  192. >
  193. <span
  194. v-if="curQue.voiceMatrix.rowSelection"
  195. v-show="
  196. selectRow === i ||
  197. (selectedLine.type === 'row' && selectedLine.index === i)
  198. "
  199. :class="[
  200. `matrix-checkbox-column-${themeColor}`,
  201. selectedLine.type === 'row' && selectedLine.index === i
  202. ? 'active'
  203. : ''
  204. ]"
  205. @click="selectRowOrColumn(i, 'row')"
  206. />
  207. </div>
  208. <!-- 单元格 -->
  209. <template v-for="(column, j) in row">
  210. <div
  211. :key="`wrapper-${i}-${j}`"
  212. :class="[
  213. 'column-wrapper',
  214. (i === 0 && curQue.voiceMatrix.firstLineHighlight) ||
  215. (j === row.length - 1 && curQue.voiceMatrix.lastColumnHighlight)
  216. ? `highlight-${themeColor}`
  217. : ''
  218. ]"
  219. @mouseenter="matrixCellMouseenter(i, j, column.type)"
  220. >
  221. <!-- 文本 -->
  222. <div
  223. v-if="column.type === 'text'"
  224. :key="`column-${i}-${j}`"
  225. :class="[
  226. column.text.length === 0 ? 'space' : `column-${themeColor}`,
  227. (selectCell.row === i && selectCell.column === j) ||
  228. (selectedLine.type === 'column' &&
  229. selectedLine.index === j) ||
  230. (selectedLine.type === 'row' && selectedLine.index === i)
  231. ? 'selected'
  232. : '',
  233. playing &&
  234. column.lrc_data.begin_time / 1000 <= curTime &&
  235. (curTime < column.lrc_data.end_time / 1000 ||
  236. column.lrc_data.end_time === -1)
  237. ? 'playing'
  238. : '',
  239. column.isTitle ? 'title' : ''
  240. ]"
  241. @click="matrixCellClick(i, j)"
  242. >
  243. <span>{{ column.text }}</span>
  244. </div>
  245. <!-- 连接线 -->
  246. <div
  247. v-else-if="column.type === 'connection'"
  248. :key="`column-${i}-${j}`"
  249. :class="[
  250. 'connection',
  251. i === 0 && curQue.voiceMatrix.firstLineHighlight
  252. ? `highlight-bc-${themeColor}`
  253. : ''
  254. ]"
  255. />
  256. <!-- 分词 -->
  257. <div
  258. v-else-if="column.type === 'SentenceSegwordChs'"
  259. :key="`column-${i}-${j}`"
  260. :class="[
  261. `sentence-${themeColor}`,
  262. (selectCell.row === i && selectCell.column === j) ||
  263. (selectedLine.type === 'column' &&
  264. selectedLine.index === j) ||
  265. (selectedLine.type === 'row' && selectedLine.index === i)
  266. ? 'selected'
  267. : '',
  268. playing &&
  269. column.lrc_data.begin_time / 1000 <= curTime &&
  270. (curTime < column.lrc_data.end_time / 1000 ||
  271. column.lrc_data.end_time === -1)
  272. ? 'playing'
  273. : '',
  274. column.isTitle ? 'title' : ''
  275. ]"
  276. :style="{
  277. 'grid-template-columns': `repeat(${column.sentence_data.wordsList.length}, auto)`
  278. }"
  279. @click="matrixCellClick(i, j)"
  280. >
  281. <template
  282. v-for="({ chs, pinyin }, w) in column.sentence_data.wordsList"
  283. >
  284. <span
  285. :key="`${column.sentence_data.pyPosition === 'top' ? 'pinyin' : 'chs'}-${w}`"
  286. :style="{visibility: column.sentence_data.pyPosition === 'top' && isShowPY ? 'visible' : 'hidden'}"
  287. :class="column.sentence_data.pyPosition === 'top' ? 'pinyin' : 'chs'"
  288. >
  289. {{ column.sentence_data.pyPosition === 'top' ? pinyin : chs }}
  290. </span>
  291. </template>
  292. <template
  293. v-for="({ chs, pinyin }, w) in column.sentence_data.wordsList"
  294. >
  295. <span
  296. :key="`${column.sentence_data.pyPosition === 'top' ? 'chs' : 'pinyin'}-${w}`"
  297. :style="{visibility: column.sentence_data.pyPosition !== 'top' && isShowPY ? 'hidden' : 'visible'}"
  298. :class="column.sentence_data.pyPosition === 'top' ? 'chs' : 'pinyin'"
  299. >
  300. {{ column.sentence_data.pyPosition === 'top' ? chs : pinyin }}
  301. </span>
  302. </template>
  303. </div>
  304. <!-- 拼音 + 英文 -->
  305. <div
  306. v-else-if="column.type === 'PinyinEnglish'"
  307. :key="`column-${i}-${j}`"
  308. :class="[
  309. `pinyinEnglish-${themeColor}`,
  310. (selectCell.row === i && selectCell.column === j) ||
  311. (selectedLine.type === 'column' &&
  312. selectedLine.index === j) ||
  313. (selectedLine.type === 'row' && selectedLine.index === i)
  314. ? 'selected'
  315. : '',
  316. playing &&
  317. column.lrc_data.begin_time / 1000 <= curTime &&
  318. (curTime < column.lrc_data.end_time / 1000 ||
  319. column.lrc_data.end_time === -1)
  320. ? 'playing'
  321. : '',
  322. column.isTitle ? 'title' : ''
  323. ]"
  324. @click="matrixCellClick(i, j)"
  325. >
  326. <div class="inside-wrapper">
  327. <div
  328. class="pinyin"
  329. >
  330. {{ column.pinyin_english_data.pinyin }}
  331. </div>
  332. <div class="english" :style="{visibility: isShowEN ? 'visible' : 'hidden'}">
  333. {{ column.pinyin_english_data.english }}
  334. </div>
  335. </div>
  336. </div>
  337. <!-- 文本中有括号 -->
  338. <div
  339. v-else-if="column.type === 'textBrackets'"
  340. :key="`column-${i}-${j}`"
  341. :class="[
  342. `textBrackets-${themeColor}`,
  343. (selectCell.row === i && selectCell.column === j) ||
  344. (selectedLine.type === 'column' &&
  345. selectedLine.index === j) ||
  346. (selectedLine.type === 'row' && selectedLine.index === i)
  347. ? 'selected'
  348. : '',
  349. playing &&
  350. column.lrc_data.begin_time / 1000 <= curTime &&
  351. (curTime < column.lrc_data.end_time / 1000 ||
  352. column.lrc_data.end_time === -1)
  353. ? 'playing'
  354. : '',
  355. column.isTitle ? 'title' : ''
  356. ]"
  357. @click="matrixCellClick(i, j)"
  358. >
  359. <span>
  360. <span class="brackets-text">{{
  361. column.text_brackets.brackets_outer
  362. }}</span>
  363. <span class="brackets">&nbsp;[&nbsp;</span>
  364. <span class="brackets-text">{{
  365. column.text_brackets.brackets_inner
  366. }}</span>
  367. <span class="brackets">&nbsp;]</span>
  368. </span>
  369. </div>
  370. </div>
  371. </template>
  372. <div :key="`end-${i}`" @mouseenter="clearSelectCell" />
  373. </template>
  374. <!-- 底部格子 -->
  375. <div class="matrix-bottom" @mouseenter="clearSelectCell" />
  376. <template v-for="(row, i) in curQue.voiceMatrix.matrix[0]">
  377. <div :key="`bottom-${i}`" @mouseenter="clearSelectCell" />
  378. </template>
  379. <div class="matrix-bottom" @mouseenter="clearSelectCell" />
  380. </div>
  381. </div>
  382. <div
  383. class="voicefull-bottom"
  384. @mouseover="setBottomShow(true)"
  385. @mouseleave="setBottomShow(false)"
  386. >
  387. <div :class="['voicefull-bottom-show', isBottomShow ? '' : 'hidden']">
  388. <div class="bottom-left">
  389. <soundrecorddiff
  390. ref="Soundrecorddiff"
  391. :bg-index="bgIndex"
  392. :file-name="fileName"
  393. :select-data="selectData"
  394. @getSelectData="getSelectData"
  395. @getWavblob="getWavblob"
  396. @handleParentPlay="handleParentPlay"
  397. @sentPause="sentPause"
  398. @getRerordStatus="getRerordStatus"
  399. @getMicrophoneStatus="getMicrophoneStatus"
  400. @getPlayStatus="getPlayStatus"
  401. />
  402. <div
  403. v-if="isShowCompare"
  404. :class="['compare-box', bgIndex === 1 ? 'compare-box-white' : '']"
  405. >
  406. <audio-compare
  407. type="full"
  408. :theme-color="themeColor"
  409. :url="mp3"
  410. :wavblob="wavblob"
  411. :sent-pause="sentPause"
  412. :is-record="isRecord"
  413. :handle-change-stop-audio="handleChangeStopAudio"
  414. :get-play-status="getPlayStatus"
  415. :matrix-select-lrc="matrixSelectLrc"
  416. :get-cur-time="getCurTime"
  417. :cur-time="curTime"
  418. />
  419. </div>
  420. </div>
  421. </div>
  422. </div>
  423. </div>
  424. </template>
  425. <script>
  426. import VoiceMatrixFullscreenAudio from "./VoiceMatrixFullscreenAudio.vue";
  427. import Soundrecorddiff from "./Soundrecorddiff.vue";
  428. import AudioCompare from "./AudioCompareMatrix.vue";
  429. import Wordcard from "./components/Wordcard.vue";
  430. export default {
  431. components: {
  432. VoiceMatrixFullscreenAudio,
  433. Soundrecorddiff,
  434. AudioCompare,
  435. Wordcard
  436. },
  437. props: ["mp3", "curQue", "themeColor"],
  438. data() {
  439. return {
  440. hzSize: 48,
  441. bgIndex: 1,
  442. item: null,
  443. curTime: 0,
  444. stopAudio: false,
  445. isShowCompare: false,
  446. clientY: 0,
  447. top: 0,
  448. left: 0,
  449. isShow: false,
  450. curWordTime: 0,
  451. playing: false,
  452. isAuto: false,
  453. autoCount: 0,
  454. key: "isRepeat",
  455. isKeyboard: true,
  456. isTopShow: false,
  457. isBottomShow: false,
  458. isRecording: false,
  459. recordPlaying: false,
  460. fileName: "",
  461. // 底色行、列
  462. selectRow: -1,
  463. selectColumn: -1,
  464. // 行、列选中
  465. selectedLine: {
  466. type: "",
  467. index: 0
  468. },
  469. // 点击选中
  470. selectCell: {
  471. row: -1,
  472. column: -1
  473. },
  474. isRepeat: false,
  475. // 跟读所需属性
  476. wavblob: null,
  477. isRecord: false,
  478. matrixSelectLrc: null,
  479. unWatch: null,
  480. lrcArray: [],
  481. cellTimer: null,
  482. // 拼音、英文显隐判断
  483. isShowPY: true,
  484. isShowEN: true
  485. };
  486. },
  487. computed: {
  488. isHasPY() {
  489. let matrix = this.curQue.voiceMatrix.matrix;
  490. for (let i = 0; i < matrix.length; i++) {
  491. if (matrix[i].some(({ type }) => type === "SentenceSegwordChs")) {
  492. return true;
  493. }
  494. }
  495. return false;
  496. },
  497. isHasEN() {
  498. let matrix = this.curQue.voiceMatrix.matrix;
  499. for (let i = 0; i < matrix.length; i++) {
  500. if (matrix[i].some(({ type }) => type === "PinyinEnglish")) return true;
  501. }
  502. return false;
  503. },
  504. hasSelectedCell() {
  505. let { type, index } = this.selectedLine;
  506. let { row, column } = this.selectCell;
  507. return (type.length > 0 && index >= 0) || (row >= 0 && column >= 0);
  508. },
  509. selectData() {
  510. let { type, index } = this.selectedLine;
  511. let { row, column } = this.selectCell;
  512. return {
  513. type: type.length > 0 && index >= 0 ? type : "cell",
  514. index,
  515. row,
  516. column
  517. };
  518. },
  519. // 矩阵的行、列数从 0 开始
  520. matrix() {
  521. const matrixArr = this.curQue.voiceMatrix.matrix;
  522. return {
  523. rows: matrixArr.length - 1,
  524. columns: matrixArr.length > 0 ? matrixArr[0].length - 1 : -1
  525. };
  526. }
  527. },
  528. watch: {
  529. isRecording(newVal) {
  530. if (newVal) {
  531. this.isBottomShow = newVal;
  532. }
  533. },
  534. recordPlaying(newVal) {
  535. if (newVal) {
  536. this.isBottomShow = newVal;
  537. }
  538. },
  539. isShow(val) {
  540. if (val) {
  541. setTimeout(() => {
  542. this.cardHeight = this.$refs.wordcard.offsetHeight;
  543. if (this.screenHeight - this.clientY > this.cardHeight) {
  544. this.top = this.clientY + 20;
  545. } else {
  546. this.top = this.clientY - this.cardHeight - 30;
  547. }
  548. }, 50);
  549. }
  550. }
  551. },
  552. created() {
  553. document.addEventListener("keyup", this.handleKeyup);
  554. [
  555. "fullscreenchange",
  556. "mozfullscreenchange",
  557. "webkitfullscreenchange",
  558. "msfullscreenchange"
  559. ].forEach(event => {
  560. document.addEventListener(event, this.handleFullscreen);
  561. });
  562. },
  563. beforeDestroy() {
  564. document.removeEventListener("keyup", this.handleKeyup);
  565. [
  566. "fullscreenchange",
  567. "mozfullscreenchange",
  568. "webkitfullscreenchange",
  569. "msfullscreenchange"
  570. ].forEach(event => {
  571. document.removeEventListener(event, this.handleFullscreen);
  572. });
  573. },
  574. // 方法集合
  575. methods: {
  576. // #region
  577. /** 语音矩阵方法开始 **/
  578. // 鼠标移入移出
  579. matrixCellMouseenter(i, j, type) {
  580. if (type === "connection") {
  581. this.selectRow = -1;
  582. this.selectColumn = -1;
  583. } else {
  584. this.selectRow = i;
  585. this.selectColumn = j;
  586. }
  587. },
  588. clearSelectCell() {
  589. this.selectRow = -1;
  590. this.selectColumn = -1;
  591. },
  592. // 单击单元格
  593. matrixCellClick(row, column) {
  594. if (this.playing) this.handleParentPlay();
  595. if (this.unWatch) this.unWatch();
  596. this.lrcArray = [];
  597. if (row === this.selectCell.row && column === this.selectCell.column) {
  598. this.selectCell = { row: -1, column: -1 };
  599. return;
  600. }
  601. this.selectedLine = { type: "", index: -1 };
  602. this.selectCell = { row, column };
  603. this.handleChangeTime(
  604. this.curQue.voiceMatrix.matrix[row][column].lrc_data
  605. );
  606. // 设置录音文件名
  607. this.setRecordingFileName(row, column);
  608. },
  609. setRecordingFileName(row, column) {
  610. let {
  611. type,
  612. text,
  613. sentence_data,
  614. pinyin_english_data,
  615. text_brackets
  616. } = this.curQue.voiceMatrix.matrix[row][column];
  617. if (type === "text") this.fileName = text;
  618. if (type === "SentenceSegwordChs") this.fileName = sentence_data.sentence;
  619. if (type === "PinyinEnglish") this.fileName = pinyin_english_data.pinyin;
  620. if (type === "textBrackets") {
  621. this.fileName = `${text_brackets.brackets_outer}[${text_brackets.brackets_inner}]`;
  622. }
  623. },
  624. checkboxMouseenter(isSelected, type) {
  625. if (!isSelected) return this.clearSelectCell();
  626. if (type === "row") this.selectColumn = -1;
  627. if (type === "column") this.selectRow = -1;
  628. },
  629. // 选中行、列
  630. selectRowOrColumn(index, type) {
  631. this.handleParentPlay();
  632. this.lrcArray = [];
  633. this.selectCell = { row: -1, column: -1 };
  634. if (this.unWatch) this.unWatch();
  635. if (
  636. this.selectedLine.type === type &&
  637. this.selectedLine.index === index
  638. ) {
  639. this.selectedLine = { type: "", index: -1 };
  640. return;
  641. }
  642. this.selectedLine = { type, index };
  643. let number = index;
  644. if (type === "column") {
  645. this.curQue.voiceMatrix.matrix[index].forEach(({ type }, i) => {
  646. if (i >= index) return;
  647. if (type === "connection") number -= 1;
  648. });
  649. }
  650. this.fileName = `第 ${number + 1} ${type === "row" ? "行" : "列"}`;
  651. },
  652. playAudio() {
  653. if (!this.hasSelectedCell) return;
  654. if (this.playing) return this.handleParentPlay();
  655. if (this.lrcArray.length > 0) return this.$refs.audioLine.PlayAudio();
  656. if (this.unWatch) this.unWatch();
  657. this.lrcArray = [];
  658. let { type, index } = this.selectedLine;
  659. if (type.length > 0 && index >= 0 && type === "row") {
  660. this.curQue.voiceMatrix.matrix[index].forEach(item => {
  661. let data = this.getLrcData(item);
  662. if (data) this.lrcArray.push(data);
  663. });
  664. if (this.lrcArray.length > 0) this.lrcPlay(this.lrcArray[0], 0);
  665. return;
  666. }
  667. if (type.length > 0 && index >= 0 && type === "column") {
  668. this.curQue.voiceMatrix.matrix.forEach(item => {
  669. let data = this.getLrcData(item[index]);
  670. if (data) this.lrcArray.push(data);
  671. });
  672. if (this.lrcArray.length > 0) this.lrcPlay(this.lrcArray[0], 0);
  673. return;
  674. }
  675. let { row, column } = this.selectCell;
  676. if (row >= 0 && column >= 0) {
  677. this.handleChangeTime(
  678. this.curQue.voiceMatrix.matrix[row][column].lrc_data
  679. );
  680. }
  681. },
  682. lrcPlay({ begin_time, end_time }, index) {
  683. this.handleParentPlay();
  684. this.$nextTick(() => {
  685. this.$refs.audioLine.onTimeupdateTime(begin_time / 1000);
  686. this.$refs.audioLine.PlayAudio();
  687. if (end_time === -1) return;
  688. let end = end_time / 1000 - 0.01;
  689. this.unWatch = this.$watch("curTime", val => {
  690. if (val >= end) {
  691. if (!this.hasSelectedCell) return this.unWatch();
  692. this.handleParentPlay();
  693. this.$refs.audioLine.onTimeupdateTime(end);
  694. this.unWatch();
  695. let i = index + 1;
  696. if (i < this.lrcArray.length) {
  697. return this.lrcPlay(this.lrcArray[i], i);
  698. }
  699. // 多次循环
  700. if (this.isRepeat) {
  701. return this.lrcPlay(this.lrcArray[0], 0);
  702. }
  703. // 单次循环
  704. if (this.isAuto && this.autoCount === 1) {
  705. this.autoCount = 0;
  706. this.lrcArray = [];
  707. return;
  708. }
  709. if (this.isAuto && this.autoCount === 0) {
  710. this.autoCount += 1;
  711. return this.lrcPlay(this.lrcArray[0], 0);
  712. }
  713. this.lrcArray = [];
  714. }
  715. });
  716. });
  717. },
  718. // 暂停音频播放
  719. handleParentPlay() {
  720. this.stopAudio = true;
  721. },
  722. // 音频播放时改变布尔值
  723. handleChangeStopAudio() {
  724. this.stopAudio = false;
  725. },
  726. getCurTime(curTime) {
  727. this.curTime = curTime;
  728. },
  729. getWavblob(wavblob) {
  730. this.wavblob = wavblob;
  731. },
  732. getSelectData({ type, index, row, column }) {
  733. if (type === "") return;
  734. let arr = [];
  735. if (type.length > 0 && index >= 0 && type === "row") {
  736. this.curQue.voiceMatrix.matrix[index].forEach(item => {
  737. let data = this.getLrcData(item);
  738. if (data) arr.push(data);
  739. });
  740. this.matrixSelectLrc = arr;
  741. return;
  742. }
  743. if (type.length > 0 && index >= 0 && type === "column") {
  744. this.curQue.voiceMatrix.matrix.forEach(item => {
  745. let data = this.getLrcData(item[index]);
  746. if (data) arr.push(data);
  747. });
  748. this.matrixSelectLrc = arr;
  749. return;
  750. }
  751. if (type === "cell" && row >= 0 && column >= 0) {
  752. let lrcData = this.curQue.voiceMatrix.matrix[row][column].lrc_data;
  753. if (lrcData.end_time === -1) lrcData.end_time = this.mp3Duration;
  754. this.matrixSelectLrc = [lrcData];
  755. }
  756. },
  757. getLrcData({ type, text, lrc_data }) {
  758. if (
  759. type === "SentenceSegwordChs" ||
  760. type === "PinyinEnglish" ||
  761. type === "textBrackets" ||
  762. (type === "text" && text.length > 0)
  763. ) {
  764. if (lrc_data.end_time === -1) {
  765. return {
  766. begin_time: lrc_data.begin_time,
  767. end_time: this.mp3Duration,
  768. text: lrc_data.text
  769. };
  770. }
  771. return lrc_data;
  772. }
  773. return false;
  774. },
  775. sentPause(isRecord) {
  776. this.isRecord = isRecord;
  777. },
  778. handleChangeTime({ begin_time, end_time }) {
  779. if (this.unWatch) this.unWatch();
  780. this.handleParentPlay();
  781. this.$nextTick(() => {
  782. this.$refs.audioLine.onTimeupdateTime(begin_time / 1000);
  783. this.$refs.audioLine.PlayAudio();
  784. // 监听是否已到结束时间,为了选中效果 - 0.01
  785. if (end_time === -1) return;
  786. let end = end_time / 1000 - 0.01;
  787. this.unWatch = this.$watch("curTime", val => {
  788. if (val >= end) {
  789. this.handleParentPlay();
  790. this.$refs.audioLine.onTimeupdateTime(end);
  791. this.unWatch();
  792. this.unWatch = null;
  793. }
  794. });
  795. });
  796. },
  797. /** 语音矩阵方法结束 **/
  798. // #endregion
  799. /* 全局事件处理 */
  800. handleKeyup({ key }) {
  801. if (!this.isKeyboard) return;
  802. if (key === "Enter") {
  803. this.$refs.Soundrecorddiff.microphone();
  804. }
  805. if (key === " ") {
  806. this.hasSelectedCell
  807. ? this.playAudio()
  808. : this.$refs.audioLine.PlayAudio();
  809. }
  810. if (!this.hasSelectedCell) return;
  811. if (key === "ArrowUp") {
  812. let { type, index, row, column } = this.selectData;
  813. if (type === "cell" && row > 0) {
  814. return this.matrixCellClick(row - 1, column);
  815. }
  816. if ((type === "column" || type === "row") && index > 0) {
  817. return this.selectRowOrColumn(index - 1, type);
  818. }
  819. }
  820. if (key === "ArrowDown") {
  821. let { type, index, row, column } = this.selectData;
  822. let { rows } = this.matrix;
  823. if (type === "cell" && row < rows) {
  824. return this.matrixCellClick(row + 1, column);
  825. }
  826. if ((type === "column" || type === "row") && index < rows) {
  827. return this.selectRowOrColumn(index + 1, type);
  828. }
  829. }
  830. if (key === "ArrowLeft") {
  831. let { type, row, column } = this.selectData;
  832. if (type !== "cell") return;
  833. if (column > 0) {
  834. return this.matrixCellClick(row, column - 1);
  835. }
  836. }
  837. if (key === "ArrowRight") {
  838. let { columns } = this.matrix;
  839. let { type, row, column } = this.selectData;
  840. if (type !== "cell") return;
  841. if (column < columns) {
  842. return this.matrixCellClick(row, column + 1);
  843. }
  844. }
  845. },
  846. handleFullscreen() {
  847. let isFullscreen = Boolean(
  848. document.fullScreen ||
  849. document.mozFullScreen ||
  850. document.webkitIsFullScreen ||
  851. document.webkitFullScreen ||
  852. document.msFullScreen
  853. );
  854. if (!isFullscreen) this.changeFullScreen();
  855. },
  856. setTopShow(bool) {
  857. this.isTopShow = bool;
  858. },
  859. setBottomShow(bool) {
  860. if (!this.recordPlaying && !this.isRecording) {
  861. this.isBottomShow = bool;
  862. }
  863. },
  864. getPlayStatus(bool) {
  865. this.recordPlaying = bool;
  866. },
  867. setFontSize(type) {
  868. if (this.hzSize >= 34 || this.hzSize <= 76) {
  869. type === "+" ? (this.hzSize += 4) : (this.hzSize -= 4);
  870. }
  871. },
  872. playChange(bool) {
  873. this.playing = bool;
  874. },
  875. changeStatus(key) {
  876. this[key] = !this[key];
  877. },
  878. setStatus() {
  879. if (this.key === "isRepeat") {
  880. if (this.isRepeat) {
  881. this.isRepeat = false;
  882. this.isAuto = true;
  883. this.autoCount = 0;
  884. this.key = "isAuto";
  885. } else {
  886. this.isRepeat = true;
  887. this.key = "isRepeat";
  888. }
  889. } else if (this.key === "isAuto") {
  890. if (this.isAuto) {
  891. this.isRepeat = false;
  892. this.isAuto = false;
  893. this.key = "isRepeat";
  894. }
  895. }
  896. },
  897. getRerordStatus(bool) {
  898. this.isShowCompare = bool;
  899. },
  900. getMicrophoneStatus(bool) {
  901. this.isRecording = bool;
  902. },
  903. getCurCompareTime(curTime) {
  904. this.curTime = curTime * 1000;
  905. },
  906. getCurWordTime(curTime) {
  907. this.curWordTime = curTime * 1000;
  908. },
  909. changePinyin() {
  910. if (!this.isHasPY) return;
  911. this.isShowPY = !this.isShowPY;
  912. },
  913. changeEN() {
  914. if (!this.isHasEN) return;
  915. this.isShowEN = !this.isShowEN;
  916. },
  917. changeBg(bgIndex) {
  918. this.bgIndex = bgIndex;
  919. },
  920. pauseAudio() {
  921. let audio = document.getElementsByTagName("audio");
  922. audio.forEach(item => {
  923. item.pause();
  924. });
  925. },
  926. exitFullScreen() {
  927. this.pauseAudio();
  928. this.$emit("exitFullscreen");
  929. },
  930. changeFullScreen() {
  931. this.pauseAudio();
  932. this.$emit("changeIsFull");
  933. }
  934. }
  935. };
  936. </script>
  937. <style lang="scss" scoped>
  938. $select-color: #de4444;
  939. $border-color: #e6e6e6;
  940. $select-color-green: #24b99e;
  941. $select-color-green-bc: rgba(36, 185, 158, 0.25);
  942. $select-color-green-hover: #3dd4b8;
  943. $select-color-green-active: #1fa189;
  944. $select-color-brown: #bd8865;
  945. $select-color-brown-bc: rgba(189, 136, 101, 0.25);
  946. $select-color-brown-hover: #d6a687;
  947. $select-color-brown-active: #a37557;
  948. $dark-color: #ffc600;
  949. $dark-color-play: #fff2c6;
  950. .voicefull {
  951. width: 100%;
  952. height: 100vh;
  953. overflow: hidden;
  954. display: flex;
  955. flex-direction: column;
  956. &.bg1 {
  957. background: #fff;
  958. color: #062211;
  959. .playing {
  960. color: $select-color !important;
  961. }
  962. }
  963. // 黑暗模式 强制替换颜色
  964. &.bg2 {
  965. background: linear-gradient(180deg, #274533 0%, #385f45 100%);
  966. color: #fff;
  967. .column-wrapper {
  968. &:hover {
  969. color: $dark-color !important;
  970. }
  971. .selected {
  972. color: $dark-color !important;
  973. }
  974. .playing {
  975. color: $dark-color-play;
  976. text-shadow: 0 0 0.1em, 0 0 0.3em;
  977. }
  978. &.highlight-,
  979. &.highlight-red,
  980. &.highlight-brown,
  981. &.highlight-green {
  982. color: $dark-color !important;
  983. }
  984. .matrix-checkbox-column-,
  985. .matrix-checkbox-column-red,
  986. .matrix-checkbox-column-brown,
  987. .matrix-checkbox-column-green {
  988. &.active {
  989. border-color: $dark-color !important;
  990. &::after {
  991. border-color: $dark-color !important;
  992. }
  993. }
  994. }
  995. .connection {
  996. &.highlight-bc-,
  997. &.highlight-bc-red,
  998. &.highlight-bc-brown,
  999. &.highlight-bc-green {
  1000. background-color: $dark-color !important;
  1001. }
  1002. }
  1003. }
  1004. .matrix-top {
  1005. .matrix-checkbox-row-,
  1006. .matrix-checkbox-row-green,
  1007. .matrix-checkbox-row-brown,
  1008. .matrix-checkbox-row-red {
  1009. &.active {
  1010. border-color: $dark-color !important;
  1011. &::after {
  1012. border-color: $dark-color !important;
  1013. }
  1014. }
  1015. }
  1016. }
  1017. }
  1018. &-top {
  1019. height: 136px;
  1020. width: 100%;
  1021. padding: 0 40px;
  1022. .voicefull-top-hidden {
  1023. width: 100%;
  1024. height: 136px;
  1025. visibility: hidden;
  1026. display: flex;
  1027. justify-content: space-between;
  1028. align-items: center;
  1029. }
  1030. .voicefull-top-show {
  1031. width: 100%;
  1032. height: 136px;
  1033. visibility: visible;
  1034. display: flex;
  1035. justify-content: space-between;
  1036. align-items: center;
  1037. }
  1038. .top-left {
  1039. display: flex;
  1040. justify-content: flex-start;
  1041. align-items: center;
  1042. }
  1043. .select-bg {
  1044. display: flex;
  1045. justify-content: space-between;
  1046. align-items: center;
  1047. width: 96px;
  1048. height: 56px;
  1049. border: 1px solid rgba(0, 0, 0, 0.1);
  1050. border-radius: 40px;
  1051. display: flex;
  1052. justify-content: center;
  1053. align-items: center;
  1054. margin-right: 32px;
  1055. &.select-bg-blue {
  1056. background: rgba(255, 255, 255, 0.1);
  1057. border: 1px solid rgba(0, 0, 0, 0.1);
  1058. }
  1059. > div {
  1060. width: 36px;
  1061. height: 36px;
  1062. border-radius: 100%;
  1063. display: flex;
  1064. justify-content: center;
  1065. align-items: center;
  1066. &.bg-white-box {
  1067. background: 0 0;
  1068. margin-right: 4px;
  1069. &.active {
  1070. background: #de4444;
  1071. }
  1072. }
  1073. &.bg-green-box {
  1074. background: #fff;
  1075. &.active {
  1076. background: #ffc600;
  1077. }
  1078. }
  1079. > span {
  1080. width: 24px;
  1081. height: 24px;
  1082. border-radius: 100%;
  1083. cursor: pointer;
  1084. &.bg-white {
  1085. background: #fff;
  1086. }
  1087. &.bg-green {
  1088. background: linear-gradient(180deg, #274533 0%, #385f45 100%);
  1089. }
  1090. }
  1091. }
  1092. }
  1093. .set-fontSize {
  1094. padding: 0 20px;
  1095. height: 56px;
  1096. background: #ffffff;
  1097. border: 1px solid rgba(0, 0, 0, 0.1);
  1098. border-radius: 40px;
  1099. display: flex;
  1100. justify-content: center;
  1101. align-items: center;
  1102. &-green {
  1103. background: rgba(255, 255, 255, 0.1);
  1104. border: 1px solid rgba(0, 0, 0, 0.1);
  1105. }
  1106. > span {
  1107. width: 24px;
  1108. height: 24px;
  1109. margin: 0 4px;
  1110. &.font-jian {
  1111. &-black {
  1112. background: url("../../../assets/NPC/jian-black.png") no-repeat left
  1113. top;
  1114. background-size: 100% 100%;
  1115. cursor: pointer;
  1116. }
  1117. &-yellow {
  1118. background: url("../../../assets/NPC/jian-white.png") no-repeat left
  1119. top;
  1120. background-size: 100% 100%;
  1121. cursor: pointer;
  1122. }
  1123. &-white-disabled {
  1124. background: url("../../../assets/NPC/jian-white-disabled.png")
  1125. no-repeat left top;
  1126. background-size: 100% 100%;
  1127. cursor: pointer;
  1128. }
  1129. &-yellow-disabled {
  1130. background: url("../../../assets/NPC/jian-yellow-disabled.png")
  1131. no-repeat left top;
  1132. background-size: 100% 100%;
  1133. cursor: pointer;
  1134. }
  1135. }
  1136. &.font-img {
  1137. &-black {
  1138. background: url("../../../assets/NPC/fontSize-black.png") no-repeat
  1139. left top;
  1140. background-size: 100% 100%;
  1141. }
  1142. &-yellow {
  1143. background: url("../../../assets/NPC/fontSize-white.png") no-repeat
  1144. left top;
  1145. background-size: 100% 100%;
  1146. }
  1147. }
  1148. &.font-jia {
  1149. &-black {
  1150. background: url("../../../assets/NPC/jia-black.png") no-repeat left
  1151. top;
  1152. background-size: 100% 100%;
  1153. cursor: pointer;
  1154. }
  1155. &-yellow {
  1156. background: url("../../../assets/NPC/jia-white.png") no-repeat left
  1157. top;
  1158. background-size: 100% 100%;
  1159. cursor: pointer;
  1160. }
  1161. &-white-disabled {
  1162. background: url("../../../assets/NPC/jia-white-disabled.png")
  1163. no-repeat left top;
  1164. background-size: 100% 100%;
  1165. cursor: pointer;
  1166. }
  1167. &-yellow-disabled {
  1168. background: url("../../../assets/NPC/jia-yellow-disabled.png")
  1169. no-repeat left top;
  1170. background-size: 100% 100%;
  1171. cursor: pointer;
  1172. }
  1173. }
  1174. }
  1175. }
  1176. .top-middle {
  1177. display: flex;
  1178. justify-content: center;
  1179. align-items: center;
  1180. .audio-box {
  1181. width: 56px;
  1182. height: 56px;
  1183. background: #ffffff;
  1184. border: 1px solid rgba(0, 0, 0, 0.1);
  1185. border-radius: 40px;
  1186. display: flex;
  1187. justify-content: center;
  1188. align-items: center;
  1189. &-green {
  1190. background: rgba(255, 255, 255, 0.1);
  1191. border: 1px solid rgba(0, 0, 0, 0.1);
  1192. }
  1193. }
  1194. }
  1195. }
  1196. .op-btn {
  1197. width: 56px;
  1198. height: 56px;
  1199. border-radius: 100%;
  1200. display: flex;
  1201. justify-content: center;
  1202. align-items: center;
  1203. cursor: pointer;
  1204. margin-left: 32px;
  1205. background: #ffffff;
  1206. border: 1px solid rgba(0, 0, 0, 0.1);
  1207. &-green {
  1208. background: rgba(255, 255, 255, 0.1);
  1209. border: 1px solid rgba(0, 0, 0, 0.1);
  1210. }
  1211. &.close-btn {
  1212. background: #274533;
  1213. border: 1px solid rgba(0, 0, 0, 0.1);
  1214. }
  1215. > span {
  1216. width: 24px;
  1217. height: 24px;
  1218. &.close-icon {
  1219. background: url("../../../assets/icon/cross-24-normal-black.png")
  1220. no-repeat left top;
  1221. background-size: 100% 100%;
  1222. &-white {
  1223. background: url("../../../assets/icon/cross-24-normal-white.png")
  1224. no-repeat left top;
  1225. background-size: 100% 100%;
  1226. }
  1227. }
  1228. }
  1229. }
  1230. .repeat-icon {
  1231. background: url("../../../assets/icon/Repeat-24-normal-red.png") no-repeat
  1232. left top;
  1233. background-size: 100% 100%;
  1234. &.disabled {
  1235. background: url("../../../assets/icon/Repeat-24-disable-Black.png")
  1236. no-repeat left top;
  1237. background-size: 100% 100%;
  1238. }
  1239. &-yellow {
  1240. background: url("../../../assets/icon/Repeat-24-normal-yellow.png")
  1241. no-repeat left top;
  1242. background-size: 100% 100%;
  1243. }
  1244. &.auto-icon {
  1245. background: url("../../../assets/icon/Auto-24-next-red.png") no-repeat
  1246. left top;
  1247. background-size: 100% 100%;
  1248. &-yellow {
  1249. background: url("../../../assets/icon/Auto-24-next-yellow.png")
  1250. no-repeat left top;
  1251. background-size: 100% 100%;
  1252. }
  1253. }
  1254. }
  1255. .pinyin-icon {
  1256. background: url("../../../assets/icon/pinyin-24-normal-red.png") no-repeat
  1257. left top;
  1258. background-size: 100% 100%;
  1259. &.disabled {
  1260. background: url("../../../assets/icon/pinyin-24-disable-Black.png")
  1261. no-repeat left top;
  1262. background-size: 100% 100%;
  1263. }
  1264. &-yellow {
  1265. background: url("../../../assets/icon/pinyin-24-normal-yellow.png")
  1266. no-repeat left top;
  1267. background-size: 100% 100%;
  1268. }
  1269. }
  1270. .en-icon {
  1271. background: url("../../../assets/icon/EN-24-normal-Red.png") no-repeat left
  1272. top;
  1273. background-size: 100% 100%;
  1274. &.disabled {
  1275. background: url("../../../assets/icon/EN-24-disable-Black.png") no-repeat
  1276. left top;
  1277. background-size: 100% 100%;
  1278. }
  1279. &-yellow {
  1280. background: url("../../../assets/icon/EN-24-normal-yellow.png") no-repeat
  1281. left top;
  1282. background-size: 100% 100%;
  1283. }
  1284. }
  1285. .keyboard-icon {
  1286. background: url("../../../assets/icon/enter-24-keyboard-red.png") no-repeat
  1287. left top;
  1288. background-size: 100% 100%;
  1289. &.disabled {
  1290. background: url("../../../assets/icon/enter-24-keyboard-disable-Black.png")
  1291. no-repeat left top;
  1292. background-size: 100% 100%;
  1293. }
  1294. &-yellow {
  1295. background: url("../../../assets/icon/enter-24-keyboard-yellow.png")
  1296. no-repeat left top;
  1297. background-size: 100% 100%;
  1298. }
  1299. }
  1300. &-content {
  1301. flex: 1;
  1302. width: 100%;
  1303. display: flex;
  1304. align-items: center;
  1305. justify-content: center;
  1306. // 语音矩阵
  1307. .matrix {
  1308. display: inline-grid;
  1309. gap: 20px 48px;
  1310. height: 100%;
  1311. word-break: break-word;
  1312. %matrix-checkbox {
  1313. position: relative;
  1314. top: calc(50% - 0.25em);
  1315. display: block;
  1316. width: 0.5em;
  1317. height: 0.5em;
  1318. border: 1.5px solid #b0b0b0;
  1319. border-radius: 4px;
  1320. margin: 0 auto;
  1321. cursor: pointer;
  1322. &.active {
  1323. border-color: $select-color;
  1324. &::after {
  1325. box-sizing: content-box;
  1326. content: "";
  1327. border: 1px solid $select-color;
  1328. border-left: 0;
  1329. border-top: 0;
  1330. width: 0.1em;
  1331. height: 0.25em;
  1332. top: 18%;
  1333. left: 37%;
  1334. position: absolute;
  1335. transform: rotate(45deg) scaleY(1);
  1336. transition: transform 0.15s ease-in 0.05s;
  1337. transform-origin: center;
  1338. }
  1339. }
  1340. }
  1341. .matrix-checkbox-row-,
  1342. .matrix-checkbox-row-red {
  1343. @extend %matrix-checkbox;
  1344. }
  1345. .matrix-checkbox-row-green {
  1346. @extend %matrix-checkbox;
  1347. &.active {
  1348. border-color: $select-color-green-active;
  1349. &::after {
  1350. border-color: $select-color-green-active;
  1351. }
  1352. }
  1353. }
  1354. .matrix-checkbox-row-brown {
  1355. @extend %matrix-checkbox;
  1356. &.active {
  1357. border-color: $select-color-brown-active;
  1358. &::after {
  1359. border-color: $select-color-brown-active;
  1360. }
  1361. }
  1362. }
  1363. %matrix-checkbox-column,
  1364. .matrix-checkbox-column-,
  1365. .matrix-checkbox-column-red {
  1366. @extend %matrix-checkbox;
  1367. top: calc(50% - 0.25em);
  1368. right: -48px;
  1369. }
  1370. .matrix-checkbox-column-green {
  1371. @extend %matrix-checkbox-column;
  1372. &.active {
  1373. border-color: $select-color-green-active;
  1374. &::after {
  1375. border-color: $select-color-green-active;
  1376. }
  1377. }
  1378. }
  1379. .matrix-checkbox-column-brown {
  1380. @extend %matrix-checkbox-column;
  1381. &.active {
  1382. border-color: $select-color-brown-active;
  1383. &::after {
  1384. border-color: $select-color-brown-active;
  1385. }
  1386. }
  1387. }
  1388. .read {
  1389. background-color: #eaeaea;
  1390. }
  1391. .highlight-,
  1392. .highlight-red {
  1393. color: $select-color;
  1394. }
  1395. .highlight-green {
  1396. color: $select-color-green;
  1397. }
  1398. .highlight-brown {
  1399. color: $select-color-brown;
  1400. }
  1401. .column-wrapper {
  1402. padding: 4px;
  1403. %column {
  1404. width: 100%;
  1405. height: 100%;
  1406. min-height: 32px;
  1407. border-radius: 8px;
  1408. transition: 0.2s;
  1409. cursor: pointer;
  1410. user-select: none;
  1411. &:hover {
  1412. border-color: #8c8c8c;
  1413. }
  1414. &.selected {
  1415. color: $select-color;
  1416. border-color: $select-color;
  1417. }
  1418. &.title {
  1419. background-color: transparent;
  1420. border-color: transparent;
  1421. }
  1422. > span {
  1423. display: inline-block;
  1424. padding: 4px 12px;
  1425. }
  1426. }
  1427. %column-red,
  1428. .column-,
  1429. .column-red {
  1430. @extend %column;
  1431. position: relative;
  1432. font-family: "GB-PINYINOK-B", "FZJCGFKTK";
  1433. &::before {
  1434. display: inline-block;
  1435. content: "";
  1436. vertical-align: middle;
  1437. }
  1438. }
  1439. .column-green {
  1440. @extend %column-red;
  1441. &.selected {
  1442. color: $select-color-green;
  1443. border-color: $select-color-green;
  1444. }
  1445. }
  1446. .column-brown {
  1447. @extend %column-red;
  1448. &.selected {
  1449. color: $select-color-brown;
  1450. border-color: $select-color-brown;
  1451. }
  1452. }
  1453. %sentence,
  1454. .sentence-,
  1455. .sentence-red {
  1456. @extend %column;
  1457. display: inline-grid;
  1458. padding: 4px 12px;
  1459. column-gap: 8px;
  1460. justify-items: center;
  1461. justify-content: start;
  1462. > span {
  1463. padding: 0;
  1464. }
  1465. .pinyin {
  1466. font-family: "GB-PINYINOK-B";
  1467. opacity: 0.45;
  1468. font-size: 0.75em;
  1469. }
  1470. .chs {
  1471. font-family: "FZJCGFKTK";
  1472. font-size: 1em;
  1473. }
  1474. }
  1475. .sentence-green {
  1476. @extend %sentence;
  1477. &.selected {
  1478. color: $select-color-green;
  1479. border-color: $select-color-green;
  1480. }
  1481. }
  1482. .sentence-brown {
  1483. @extend %sentence;
  1484. &.selected {
  1485. color: $select-color-brown;
  1486. border-color: $select-color-brown;
  1487. }
  1488. }
  1489. .connection {
  1490. position: relative;
  1491. top: calc(50% - 1px);
  1492. height: 2px;
  1493. width: 16px;
  1494. margin: 0 -4px;
  1495. border-radius: 4px;
  1496. background-color: #252525;
  1497. &.highlight-bc-,
  1498. &.highlight-bc-red {
  1499. background-color: $select-color;
  1500. }
  1501. &.highlight-bc-green {
  1502. background-color: $select-color-green;
  1503. }
  1504. &.highlight-bc-brown {
  1505. background-color: $select-color-brown;
  1506. }
  1507. }
  1508. // 拼音 + 文字
  1509. %pinyinEnglish,
  1510. .pinyinEnglish-,
  1511. .pinyinEnglish-red {
  1512. @extend %column;
  1513. .inside-wrapper {
  1514. padding: 4px 12px;
  1515. .pinyin {
  1516. font-family: "GB-PINYINOK-B";
  1517. font-size: 1em;
  1518. }
  1519. .english {
  1520. font-family: "robot";
  1521. opacity: 0.45;
  1522. font-size: 0.75em;
  1523. }
  1524. }
  1525. }
  1526. .pinyinEnglish-green {
  1527. @extend %pinyinEnglish;
  1528. &.selected {
  1529. color: $select-color-green;
  1530. border-color: $select-color-green;
  1531. }
  1532. }
  1533. .pinyinEnglish-brown {
  1534. @extend %pinyinEnglish;
  1535. &.selected {
  1536. color: $select-color-brown;
  1537. border-color: $select-color-brown;
  1538. }
  1539. }
  1540. %textBrackets,
  1541. .textBrackets-,
  1542. .textBrackets-red {
  1543. @extend %column;
  1544. .brackets-text {
  1545. font-family: "GB-PINYINOK-B";
  1546. }
  1547. .brackets {
  1548. font-size: 1em;
  1549. font-family: "FZJCGFKTK";
  1550. }
  1551. }
  1552. .textBrackets-green {
  1553. @extend %textBrackets;
  1554. &.selected {
  1555. color: $select-color-green;
  1556. border-color: $select-color-green;
  1557. }
  1558. }
  1559. .textBrackets-brown {
  1560. @extend %textBrackets;
  1561. &.selected {
  1562. color: $select-color-brown;
  1563. border-color: $select-color-brown;
  1564. }
  1565. }
  1566. }
  1567. }
  1568. }
  1569. &-bottom {
  1570. height: 136px;
  1571. width: 100%;
  1572. display: flex;
  1573. justify-content: space-between;
  1574. align-items: center;
  1575. padding-right: 40px;
  1576. .voicefull-bottom-show {
  1577. height: 136px;
  1578. width: 100%;
  1579. display: flex;
  1580. justify-content: space-between;
  1581. align-items: center;
  1582. visibility: visible;
  1583. &.hidden {
  1584. visibility: hidden;
  1585. }
  1586. }
  1587. .bottom-left {
  1588. display: flex;
  1589. justify-content: flex-start;
  1590. align-items: center;
  1591. .compare-box {
  1592. height: 56px;
  1593. padding: 16px 16px;
  1594. border: 1px solid rgba(0, 0, 0, 0.1);
  1595. border-radius: 0 40px 40px 0;
  1596. border-left: 0px solid rgba(0, 0, 0, 0.1);
  1597. &-white {
  1598. background: rgba(255, 255, 255, 0.1);
  1599. border: 1px solid rgba(0, 0, 0, 0.1);
  1600. border-left: 0;
  1601. }
  1602. }
  1603. }
  1604. }
  1605. }
  1606. </style>
  1607. <style lang="scss">
  1608. .NPC-Big-Book-preview-green {
  1609. .bg1 {
  1610. .repeat-icon {
  1611. background: url("../../../assets/icon/Repeat-24-normal-Green.png")
  1612. no-repeat left top;
  1613. background-size: 100% 100%;
  1614. }
  1615. .pinyin-icon {
  1616. background: url("../../../assets/icon/pinyin-24-normal-green.png")
  1617. no-repeat left top;
  1618. background-size: 100% 100%;
  1619. }
  1620. .en-icon {
  1621. background: url("../../../assets/icon/EN-24-normal-Green.png") no-repeat
  1622. left top;
  1623. background-size: 100% 100%;
  1624. }
  1625. }
  1626. }
  1627. .NPC-Big-Book-preview-brown {
  1628. .bg1 {
  1629. .repeat-icon {
  1630. background: url("../../../assets/icon/Repeat-24-normal-Brown.png")
  1631. no-repeat left top;
  1632. background-size: 100% 100%;
  1633. }
  1634. .en-icon {
  1635. background: url("../../../assets/icon/EN-24-normal-Brown.png") no-repeat
  1636. left top;
  1637. background-size: 100% 100%;
  1638. }
  1639. .coll-icon {
  1640. background: url("../../../assets/icon/bookmarkfill-24-normal-brown.png")
  1641. no-repeat left top;
  1642. background-size: 100% 100%;
  1643. }
  1644. }
  1645. }
  1646. </style>