VoiceMatrixPreview.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. <!-- eslint-disable vue/no-v-html -->
  2. <template>
  3. <div class="voice-matrix-preview" :style="getAreaStyle()">
  4. <SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
  5. <div class="main">
  6. <div class="voice-matrix-audio">
  7. <div v-show="hasSelectedCell" class="audio-simple">
  8. <img
  9. class="audio-simple-image"
  10. :src="
  11. playing
  12. ? require(`@/assets/voice_matrix/icon-voice-play-blue.png`)
  13. : require(`@/assets/voice_matrix/icon-voice.png`)
  14. "
  15. @click="playAudio"
  16. />
  17. <span
  18. :class="['Repeat-16', 'audio-simple-repeat', isRepeat ? '' : 'disabled']"
  19. @click="isRepeat = !isRepeat"
  20. ></span>
  21. </div>
  22. <AudioLine
  23. v-show="!hasSelectedCell"
  24. ref="audioLine"
  25. audio-id="voiceMatrixAudio"
  26. :mp3="mp3Url"
  27. :get-cur-time="getCurTime"
  28. :stop-audio="stopAudio"
  29. :mp3-source="mp3Source"
  30. :audio-data="data"
  31. @handleChangeStopAudio="handleChangeStopAudio"
  32. @playChange="playChange"
  33. />
  34. </div>
  35. <!-- 语音矩阵 -->
  36. <div
  37. class="voice-matrix-container"
  38. :style="{ height: isEnable(data.property.is_enable_record) ? 'calc(100% - 80px)' : 'auto' }"
  39. >
  40. <div
  41. v-if="data.option_list.length > 0"
  42. class="matrix"
  43. :style="{
  44. 'grid-template': `36px repeat(${data.option_list.length}, auto) minmax(36px, 1fr) / 36px repeat(${data.option_list[0].length}, auto) minmax(36px, 1fr)`,
  45. }"
  46. @mouseleave="clearSelectCell"
  47. >
  48. <!-- 顶部单元格 -->
  49. <div class="matrix-top" @mouseenter="clearSelectCell"></div>
  50. <template v-for="(row, i) in data.option_list[0]">
  51. <div
  52. :key="`top-${i}`"
  53. :class="[
  54. 'matrix-top',
  55. isEnable(data.property.is_enable_column_play) &&
  56. (selectColumn === i || (selectedLine.type === 'column' && selectedLine.index === i))
  57. ? 'read'
  58. : '',
  59. ]"
  60. @mouseenter="checkboxMouseenter(selectColumn === i, 'column')"
  61. >
  62. <span
  63. v-if="row.type !== 'connection' && isEnable(data.property.is_enable_column_play)"
  64. v-show="selectColumn === i || (selectedLine.type === 'column' && selectedLine.index === i)"
  65. :class="[
  66. `matrix-checkbox-row-${themeColor}`,
  67. selectedLine.type === 'column' && selectedLine.index === i ? 'active' : '',
  68. ]"
  69. @click="selectRowOrColumn(i, 'column')"
  70. ></span>
  71. </div>
  72. </template>
  73. <div class="matrix-top" @mouseenter="clearSelectCell"></div>
  74. <!-- 主矩阵 -->
  75. <template v-for="(row, i) in data.option_list">
  76. <div
  77. :key="`start-${i}`"
  78. :class="[
  79. 'column-wrapper',
  80. isEnable(data.property.is_enable_row_play) &&
  81. (selectRow === i || (selectedLine.type === 'row' && selectedLine.index === i))
  82. ? 'read'
  83. : '',
  84. ]"
  85. @mouseenter="checkboxMouseenter(selectRow === i, 'row')"
  86. >
  87. <span
  88. v-if="isEnable(data.property.is_enable_row_play)"
  89. v-show="selectRow === i || (selectedLine.type === 'row' && selectedLine.index === i)"
  90. :class="[
  91. `matrix-checkbox-column-${themeColor}`,
  92. selectedLine.type === 'row' && selectedLine.index === i ? 'active' : '',
  93. ]"
  94. @click="selectRowOrColumn(i, 'row')"
  95. ></span>
  96. </div>
  97. <!-- 单元格 -->
  98. <template v-for="(column, j) in row">
  99. <div
  100. :key="`wrapper-${i}-${j}`"
  101. :class="[
  102. 'column-wrapper',
  103. (isEnable(data.property.is_enable_row_play) && selectRow === i) ||
  104. (isEnable(data.property.is_enable_column_play) && selectColumn === j) ||
  105. (isEnable(data.property.is_enable_column_play) &&
  106. selectedLine.type === 'column' &&
  107. selectedLine.index === j) ||
  108. (isEnable(data.property.is_enable_row_play) &&
  109. selectedLine.type === 'row' &&
  110. selectedLine.index === i)
  111. ? 'read'
  112. : '',
  113. ]"
  114. @mouseenter="matrixCellMouseenter(i, j, column.type)"
  115. >
  116. <!-- 文本 -->
  117. <div
  118. :key="`column-${i}-${j}`"
  119. :class="[
  120. column.content.length === 0 ? 'space' : `column-${themeColor}`,
  121. (selectCell.row === i && selectCell.column === j) ||
  122. (selectedLine.type === 'column' && selectedLine.index === j) ||
  123. (selectedLine.type === 'row' && selectedLine.index === i)
  124. ? 'selected'
  125. : '',
  126. playing &&
  127. column.lrc_data.begin_time / 1000 <= curTime &&
  128. (curTime < column.lrc_data.end_time / 1000 || column.lrc_data.end_time === -1)
  129. ? 'playing'
  130. : '',
  131. column.isTitle ? 'title' : '',
  132. ]"
  133. @click="matrixCellClick(i, j)"
  134. >
  135. <span
  136. class="content rich-text"
  137. :style="{ textAlign: data.property.align }"
  138. v-html="sanitizeHTML(column.content)"
  139. ></span>
  140. </div>
  141. </div>
  142. </template>
  143. <div
  144. :key="`end-${i}`"
  145. :class="[
  146. isEnable(data.property.is_enable_row_play) &&
  147. (selectRow === i || (selectedLine.type === 'row' && selectedLine.index === i))
  148. ? 'read'
  149. : '',
  150. ]"
  151. @mouseenter="clearSelectCell"
  152. ></div>
  153. </template>
  154. <!-- 底部格子 -->
  155. <div class="matrix-bottom" @mouseenter="clearSelectCell"></div>
  156. <template v-for="(row, i) in data.option_list[0]">
  157. <div
  158. :key="`bottom-${i}`"
  159. :class="[
  160. 'matrix-bottom',
  161. isEnable(data.property.is_enable_column_play) &&
  162. (selectColumn === i || (selectedLine.type === 'column' && selectedLine.index === i))
  163. ? 'read'
  164. : '',
  165. ]"
  166. @mouseenter="clearSelectCell"
  167. ></div>
  168. </template>
  169. <div class="matrix-bottom" @mouseenter="clearSelectCell"></div>
  170. </div>
  171. </div>
  172. <!-- 录音 -->
  173. <div v-if="isEnable(data.property.is_enable_record)" class="voice-luyin">
  174. <SoundRecord
  175. ref="luyin"
  176. type="promax"
  177. class="luyin-box"
  178. :answer-record-list="data.record_list"
  179. @getWavblob="getWavblob"
  180. @getSelectData="getSelectData"
  181. @handleParentPlay="pauseOtherAudio"
  182. @sentPause="sentPause"
  183. @handleWav="handleWav"
  184. />
  185. <AudioCompare
  186. :style="{ flex: 1 }"
  187. :theme-color="themeColor"
  188. :wavblob="wavblob"
  189. :url="mp3Url"
  190. :is-record="isRecord"
  191. :sent-pause="sentPause"
  192. :matrix-select-lrc="matrixSelectLrc"
  193. :get-cur-time="getCurTime"
  194. :cur-time="curTime"
  195. :handle-change-stop-audio="handleChangeStopAudio"
  196. @playing="playChange"
  197. />
  198. </div>
  199. </div>
  200. </div>
  201. </template>
  202. <script>
  203. import { getVoiceMatrixData } from '@/views/book/courseware/data/voiceMatrix';
  204. import { getRandomNumber } from '@/utils/index.js';
  205. import PreviewMixin from '../common/PreviewMixin';
  206. import Bus from './components/Bus.js';
  207. import SoundRecord from '../../common/SoundRecord.vue';
  208. import AudioCompare from './components/AudioCompareMatrix.vue';
  209. import AudioLine from './components/AudioLine.vue';
  210. export default {
  211. name: 'VoiceMatrixPreview',
  212. components: {
  213. SoundRecord,
  214. AudioCompare,
  215. AudioLine,
  216. },
  217. mixins: [PreviewMixin],
  218. data() {
  219. return {
  220. data: getVoiceMatrixData(),
  221. cid: getRandomNumber(),
  222. themeColor: 'red',
  223. curTime: 0,
  224. playing: false,
  225. stopAudio: true,
  226. unWatch: null,
  227. lrcArray: [],
  228. fileName: '',
  229. // 底色行、列
  230. selectRow: -1,
  231. selectColumn: -1,
  232. // 行、列选中
  233. selectedLine: {
  234. type: '',
  235. index: 0,
  236. },
  237. // 点击选中
  238. selectCell: {
  239. row: -1,
  240. column: -1,
  241. },
  242. isRepeat: false,
  243. // 跟读所需属性
  244. wavblob: null,
  245. isRecord: false,
  246. matrixSelectLrc: null,
  247. };
  248. },
  249. computed: {
  250. hasSelectedCell() {
  251. const { type, index } = this.selectedLine;
  252. const { row, column } = this.selectCell;
  253. return (type.length > 0 && index >= 0) || (row >= 0 && column >= 0);
  254. },
  255. mp3Url() {
  256. const audioData = this.data.audio_data;
  257. return audioData.url.match(/^\[FID##/) ? audioData.temporary_url : audioData.url;
  258. },
  259. mp3Source() {
  260. const audioData = this.data.audio_data;
  261. return 'source' in audioData ? audioData.source : '';
  262. },
  263. mp3Duration() {
  264. return this.data.audio_data.media_duration * 1000;
  265. },
  266. selectData() {
  267. const { type, index } = this.selectedLine;
  268. const { row, column } = this.selectCell;
  269. return {
  270. type: type.length > 0 && index >= 0 ? type : 'cell',
  271. index,
  272. row,
  273. column,
  274. };
  275. },
  276. },
  277. watch: {
  278. hasSelectedCell() {
  279. this.handleParentPlay();
  280. },
  281. isShowRightAnswer(val) {
  282. if (!val) return;
  283. this.handleWav(this.answer.record_list);
  284. if (this.answer.record_list.length > 0) {
  285. this.getWavblob(this.answer.record_list[0].wavData);
  286. }
  287. },
  288. 'data.record_list'(val) {
  289. this.answer.record_list = val;
  290. },
  291. },
  292. created() {
  293. Bus.$on('audioPause', (id) => {
  294. if (this.cid === id) return;
  295. if (this.$refs.luyin?.microphoneStatus) this.$refs.luyin.microphone();
  296. this.handleParentPlay();
  297. });
  298. if (!('record_list' in this.answer)) {
  299. this.$set(this.answer, 'record_list', []);
  300. }
  301. },
  302. mounted() {
  303. document.querySelector('body').addEventListener('click', this.restoreAudioStatus);
  304. },
  305. beforeDestroy() {
  306. document.querySelector('body').removeEventListener('click', this.restoreAudioStatus);
  307. },
  308. methods: {
  309. handleWav(data) {
  310. this.data.record_list = data;
  311. },
  312. // 鼠标移入移出
  313. matrixCellMouseenter(i, j, type) {
  314. if (type === 'connection') {
  315. this.selectRow = -1;
  316. this.selectColumn = -1;
  317. } else {
  318. this.selectRow = i;
  319. this.selectColumn = j;
  320. }
  321. },
  322. clearSelectCell() {
  323. this.selectRow = -1;
  324. this.selectColumn = -1;
  325. },
  326. // 单击单元格
  327. matrixCellClick(row, column) {
  328. if (this.playing) this.handleParentPlay();
  329. if (this.unWatch) this.unWatch();
  330. this.lrcArray = [];
  331. if (row === this.selectCell.row && column === this.selectCell.column) {
  332. this.selectCell = { row: -1, column: -1 };
  333. return;
  334. }
  335. this.selectedLine = { type: '', index: -1 };
  336. this.selectCell = { row, column };
  337. this.handleChangeTime(this.data.option_list[row][column].lrc_data);
  338. // 设置录音文件名
  339. this.setRecordingFileName(row, column);
  340. },
  341. setRecordingFileName(row, column) {
  342. return `录音第${column}列第${row}行`;
  343. },
  344. /**
  345. * 判断 click 点击是否语音矩阵可操作区域
  346. * @param {PointerEvent} event
  347. */
  348. restoreAudioStatus(event) {
  349. const whitePath = [
  350. 'column-green',
  351. 'column-red',
  352. 'column-brown',
  353. 'matrix-checkbox-column-',
  354. 'matrix-checkbox-row-',
  355. 'audio-simple-image',
  356. 'audio-simple-repeat',
  357. 'luyin-box',
  358. ];
  359. const operable = event.composedPath().some((item) => {
  360. const className = item.className;
  361. if (!className || typeof className !== 'string') return false;
  362. return whitePath.some((path) => className.includes(path));
  363. });
  364. if (!operable) {
  365. this.selectedLine = { type: '', index: -1 };
  366. this.selectCell = { row: -1, column: -1 };
  367. if (this.playing) this.handleParentPlay();
  368. if (this.unWatch) this.unWatch();
  369. }
  370. },
  371. checkboxMouseenter(isSelected, type) {
  372. if (!isSelected) return this.clearSelectCell();
  373. if (type === 'row') this.selectColumn = -1;
  374. if (type === 'column') this.selectRow = -1;
  375. },
  376. // 选中行、列
  377. selectRowOrColumn(index, type) {
  378. this.handleParentPlay();
  379. this.lrcArray = [];
  380. this.selectCell = { row: -1, column: -1 };
  381. if (this.unWatch) this.unWatch();
  382. if (this.selectedLine.type === type && this.selectedLine.index === index) {
  383. this.selectedLine = { type: '', index: -1 };
  384. return;
  385. }
  386. this.selectedLine = { type, index };
  387. let number = index;
  388. if (type === 'column') {
  389. this.data.option_list[index].forEach((item, i) => {
  390. if (i >= index) return;
  391. });
  392. }
  393. this.fileName = `第 ${number + 1} ${type === 'row' ? '行' : '列'}`;
  394. },
  395. playAudio() {
  396. if (!this.hasSelectedCell) return;
  397. if (this.playing) return this.handleParentPlay();
  398. if (this.lrcArray.length > 0) return this.$refs.audioLine.PlayAudio();
  399. if (this.unWatch) this.unWatch();
  400. this.lrcArray = [];
  401. const { type, index } = this.selectedLine;
  402. if (type.length > 0 && index >= 0 && type === 'row') {
  403. this.data.option_list[index].forEach((item) => {
  404. const data = this.getLrcData(item);
  405. if (data) this.lrcArray.push(data);
  406. });
  407. if (this.lrcArray.length > 0) this.lrcPlay(this.lrcArray[0], 0);
  408. return;
  409. }
  410. if (type.length > 0 && index >= 0 && type === 'column') {
  411. this.data.option_list.forEach((item) => {
  412. const data = this.getLrcData(item[index]);
  413. if (data) this.lrcArray.push(data);
  414. });
  415. if (this.lrcArray.length > 0) this.lrcPlay(this.lrcArray[0], 0);
  416. return;
  417. }
  418. const { row, column } = this.selectCell;
  419. if (row >= 0 && column >= 0) {
  420. this.handleChangeTime(this.data.option_list[row][column].lrc_data);
  421. }
  422. },
  423. lrcPlay({ begin_time, end_time }, index) {
  424. this.handleParentPlay();
  425. this.$nextTick(() => {
  426. this.$refs.audioLine.onTimeupdateTime(begin_time / 1000);
  427. this.$refs.audioLine.PlayAudio();
  428. if (end_time === -1) return;
  429. const end = end_time / 1000 - 0.01;
  430. this.unWatch = this.$watch('curTime', (val) => {
  431. if (val >= end) {
  432. if (!this.hasSelectedCell) return this.unWatch();
  433. this.handleParentPlay();
  434. this.$refs.audioLine.onTimeupdateTime(end);
  435. this.unWatch();
  436. const i = index + 1;
  437. if (i < this.lrcArray.length) {
  438. return this.lrcPlay(this.lrcArray[i], i);
  439. }
  440. if (this.isRepeat) {
  441. return this.lrcPlay(this.lrcArray[0], 0);
  442. }
  443. this.lrcArray = [];
  444. }
  445. });
  446. });
  447. },
  448. playChange(playing) {
  449. this.playing = playing;
  450. // 子组件通信,同时只能播放一个音频
  451. if (playing) Bus.$emit('audioPause', this.cid);
  452. },
  453. pauseOtherAudio() {
  454. Bus.$emit('audioPause', this.cid);
  455. this.stopAudio = true;
  456. },
  457. // 暂停音频播放
  458. handleParentPlay() {
  459. this.stopAudio = true;
  460. },
  461. // 音频播放时改变布尔值
  462. handleChangeStopAudio() {
  463. this.stopAudio = false;
  464. },
  465. getCurTime(curTime) {
  466. this.curTime = curTime;
  467. },
  468. getWavblob(wavblob) {
  469. this.wavblob = wavblob;
  470. },
  471. getSelectData({ type, index, row, column }) {
  472. if (type === '') return;
  473. const arr = [];
  474. if (type.length > 0 && index >= 0 && type === 'row') {
  475. this.data.option_list[index].forEach((item) => {
  476. const data = this.getLrcData(item);
  477. if (data) arr.push(data);
  478. });
  479. this.matrixSelectLrc = arr;
  480. return;
  481. }
  482. if (type.length > 0 && index >= 0 && type === 'column') {
  483. this.data.option_list.forEach((item) => {
  484. const data = this.getLrcData(item[index]);
  485. if (data) arr.push(data);
  486. });
  487. this.matrixSelectLrc = arr;
  488. return;
  489. }
  490. if (type === 'cell' && row >= 0 && column >= 0) {
  491. const lrcData = this.data.option_list[row][column].lrc_data;
  492. if (lrcData.end_time === -1) lrcData.end_time = this.mp3Duration;
  493. this.matrixSelectLrc = [lrcData];
  494. }
  495. },
  496. getLrcData({ content, lrc_data }) {
  497. if (content.length > 0) {
  498. if (lrc_data.end_time === -1) {
  499. return {
  500. begin_time: lrc_data.begin_time,
  501. end_time: this.mp3Duration,
  502. text: lrc_data.text,
  503. };
  504. }
  505. return lrc_data;
  506. }
  507. return false;
  508. },
  509. sentPause(isRecord) {
  510. this.isRecord = isRecord;
  511. },
  512. handleChangeTime({ begin_time, end_time }) {
  513. if (this.unWatch) this.unWatch();
  514. this.handleParentPlay();
  515. this.$nextTick(() => {
  516. this.$refs.audioLine.onTimeupdateTime(begin_time / 1000);
  517. this.$refs.audioLine.PlayAudio();
  518. // 监听是否已到结束时间,为了选中效果 - 0.01
  519. if (end_time === -1) return;
  520. const end = end_time / 1000 - 0.01;
  521. this.unWatch = this.$watch('curTime', (val) => {
  522. if (val >= end) {
  523. this.handleParentPlay();
  524. this.$refs.audioLine.onTimeupdateTime(end);
  525. this.unWatch();
  526. this.unWatch = null;
  527. if (this.isRepeat) {
  528. this.handleChangeTime({ begin_time, end_time });
  529. }
  530. }
  531. });
  532. });
  533. },
  534. },
  535. };
  536. </script>
  537. <style lang="scss" scoped>
  538. @use '@/styles/mixin.scss' as *;
  539. $select-color: #1890ff;
  540. $border-color: #e6e6e6;
  541. .voice-matrix-preview {
  542. @include preview-base;
  543. .main {
  544. color: #262626;
  545. .voice-matrix-audio {
  546. display: flex;
  547. height: 42px;
  548. border: 1px solid $border-color;
  549. border-radius: 8px 8px 0 0;
  550. .audio-number {
  551. padding: 12px 0 0 12px;
  552. %serial-number,
  553. .serial-number {
  554. display: inline-block;
  555. width: 16px;
  556. height: 16px;
  557. font-family: 'robot';
  558. font-size: 16px;
  559. line-height: 16px;
  560. color: #000;
  561. text-align: center;
  562. border-radius: 50%;
  563. }
  564. }
  565. .audio-simple {
  566. display: flex;
  567. flex-grow: 1;
  568. align-items: center;
  569. justify-content: space-between;
  570. height: 100%;
  571. line-height: 46px;
  572. img {
  573. width: 16px;
  574. height: 16px;
  575. margin-left: 12px;
  576. cursor: pointer;
  577. }
  578. .Repeat-16 {
  579. display: inline-block;
  580. width: 16px;
  581. height: 16px;
  582. margin-right: 12px;
  583. cursor: pointer;
  584. }
  585. }
  586. }
  587. // 语音矩阵
  588. .voice-matrix-container {
  589. font-size: 16px;
  590. word-break: break-word;
  591. background-color: #f5f5f5;
  592. border-right: 1px solid $border-color;
  593. border-bottom: 1px solid $border-color;
  594. border-left: 1px solid $border-color;
  595. .matrix {
  596. display: inline-grid;
  597. width: 100%;
  598. height: 100%;
  599. %matrix-checkbox {
  600. position: relative;
  601. top: calc(50% - 5px);
  602. display: block;
  603. width: 14px;
  604. height: 14px;
  605. margin: 0 auto;
  606. cursor: pointer;
  607. border: 1.5px solid #b0b0b0;
  608. border-radius: 4px;
  609. &.active {
  610. border-color: $select-color;
  611. &::after {
  612. position: absolute;
  613. left: 4px;
  614. box-sizing: content-box;
  615. width: 3px;
  616. height: 7px;
  617. content: '';
  618. border: 1px solid $select-color;
  619. border-top: 0;
  620. border-left: 0;
  621. transition: transform 0.15s ease-in 0.05s;
  622. transform: rotate(45deg) scaleY(1);
  623. transform-origin: center;
  624. }
  625. }
  626. }
  627. .matrix-checkbox-row-,
  628. .matrix-checkbox-row-red {
  629. @extend %matrix-checkbox;
  630. }
  631. %matrix-checkbox-column,
  632. .matrix-checkbox-column-,
  633. .matrix-checkbox-column-red {
  634. @extend %matrix-checkbox;
  635. top: calc(50% - 7px);
  636. right: -2px;
  637. }
  638. .read {
  639. background-color: #eaeaea;
  640. }
  641. .highlight-,
  642. .highlight-red {
  643. color: $select-color;
  644. }
  645. .column-wrapper {
  646. padding: 4px;
  647. %column {
  648. width: 100%;
  649. height: 100%;
  650. min-height: 32px;
  651. cursor: pointer;
  652. user-select: none;
  653. background-color: #fff;
  654. border: 1px solid $border-color;
  655. border-radius: 8px;
  656. transition: 0.2s;
  657. &:hover {
  658. border-color: #8c8c8c;
  659. }
  660. &.selected {
  661. color: $select-color;
  662. border-color: $select-color;
  663. }
  664. &.playing {
  665. background-color: rgba(24, 144, 255, 10%);
  666. }
  667. &.title {
  668. background-color: transparent;
  669. border-color: transparent;
  670. }
  671. > span {
  672. display: inline-block;
  673. width: 100%;
  674. padding: 4px 12px;
  675. line-height: 24px;
  676. }
  677. }
  678. %column-red,
  679. .column-,
  680. .column-red {
  681. @extend %column;
  682. position: relative;
  683. &::before {
  684. display: inline-block;
  685. vertical-align: middle;
  686. content: '';
  687. }
  688. }
  689. %sentence,
  690. .sentence-,
  691. .sentence-red {
  692. @extend %column;
  693. display: inline-grid;
  694. column-gap: 8px;
  695. justify-content: start;
  696. justify-items: center;
  697. padding: 4px 12px;
  698. line-height: 24px;
  699. > span {
  700. padding: 0;
  701. }
  702. .pinyin {
  703. font-family: 'GB-PINYINOK-B';
  704. font-size: 12px;
  705. line-height: 20px;
  706. opacity: 0.45;
  707. }
  708. .chs {
  709. font-size: 16px;
  710. line-height: 24px;
  711. }
  712. }
  713. .connection {
  714. position: relative;
  715. top: calc(50% - 1px);
  716. width: 16px;
  717. height: 2px;
  718. margin: 0 -4px;
  719. background-color: #252525;
  720. border-radius: 4px;
  721. &.highlight-bc-,
  722. &.highlight-bc-red {
  723. background-color: $select-color;
  724. }
  725. }
  726. // 拼音 + 文字
  727. %pinyin-english,
  728. .pinyinEnglish-,
  729. .pinyinEnglish-red {
  730. @extend %column;
  731. .inside-wrapper {
  732. padding: 4px 12px;
  733. .pinyin {
  734. font-family: 'GB-PINYINOK-B';
  735. font-size: 16px;
  736. line-height: 24px;
  737. }
  738. .english {
  739. font-family: 'robot';
  740. font-size: 12px;
  741. line-height: 20px;
  742. opacity: 0.45;
  743. }
  744. }
  745. }
  746. %text-brackets,
  747. .textBrackets-,
  748. .textBrackets-red {
  749. @extend %column;
  750. .brackets-text {
  751. font-family: 'GB-PINYINOK-B';
  752. }
  753. .brackets {
  754. font-size: 16px;
  755. }
  756. }
  757. }
  758. }
  759. .matrix-audio {
  760. width: 228px;
  761. height: 40px;
  762. padding: 4px 4px 4px 16px;
  763. margin: 24px 24px 0 0;
  764. background-color: #fff;
  765. border: 1px solid $border-color;
  766. border-radius: 8px;
  767. }
  768. }
  769. .voice-luyin {
  770. display: flex;
  771. align-items: center;
  772. height: 40px;
  773. padding: 3px 16px;
  774. border: 1px solid $border-color;
  775. border-top-width: 0;
  776. border-radius: 0 0 8px 8px;
  777. :deep .record {
  778. max-width: 280px;
  779. }
  780. }
  781. }
  782. }
  783. .NNPE-tableList-tr-last {
  784. .voice-matrix {
  785. padding-bottom: 0;
  786. }
  787. }
  788. </style>
  789. <style lang="scss">
  790. .voice-matrix {
  791. &-audio {
  792. .audioLine {
  793. border-radius: 8px 8px 0 0 !important;
  794. }
  795. .el-slider {
  796. width: 100% !important;
  797. }
  798. }
  799. .luyin-box {
  800. .el-select .el-input {
  801. width: 136px;
  802. }
  803. }
  804. }
  805. </style>