VoiceMatrixPreview.vue 25 KB

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