VoiceMatrixPreview.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. <!-- eslint-disable vue/no-v-html -->
  2. <template>
  3. <div class="voice-matrix-preview" :style="[getAreaStyle(), getComponentStyle()]">
  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="convertText(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. <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
  209. <AnswerAnalysis
  210. :visible.sync="visibleAnswerAnalysis"
  211. :answer-list="data.answer_list"
  212. :analysis-list="data.analysis_list"
  213. @closeAnswerAnalysis="closeAnswerAnalysis"
  214. />
  215. </div>
  216. </template>
  217. <script>
  218. import { getVoiceMatrixData } from '@/views/book/courseware/data/voiceMatrix';
  219. import { getRandomNumber } from '@/utils/index.js';
  220. import PreviewMixin from '../common/PreviewMixin';
  221. import Bus from './components/Bus.js';
  222. import SoundRecord from '../../common/SoundRecord.vue';
  223. import AudioCompare from './components/AudioCompareMatrix.vue';
  224. import AudioLine from './components/AudioLine.vue';
  225. export default {
  226. name: 'VoiceMatrixPreview',
  227. components: {
  228. SoundRecord,
  229. AudioCompare,
  230. AudioLine,
  231. },
  232. mixins: [PreviewMixin],
  233. data() {
  234. return {
  235. data: getVoiceMatrixData(),
  236. cid: getRandomNumber(),
  237. themeColor: 'red',
  238. curTime: 0,
  239. playing: false,
  240. stopAudio: true,
  241. unWatch: null,
  242. lrcArray: [],
  243. fileName: '',
  244. // 底色行、列
  245. selectRow: -1,
  246. selectColumn: -1,
  247. // 行、列选中
  248. selectedLine: {
  249. type: '',
  250. index: 0,
  251. },
  252. // 点击选中
  253. selectCell: {
  254. row: -1,
  255. column: -1,
  256. },
  257. isRepeat: false,
  258. // 跟读所需属性
  259. wavblob: null,
  260. isRecord: false,
  261. matrixSelectLrc: null,
  262. };
  263. },
  264. computed: {
  265. hasSelectedCell() {
  266. const { type, index } = this.selectedLine;
  267. const { row, column } = this.selectCell;
  268. return (type.length > 0 && index >= 0) || (row >= 0 && column >= 0);
  269. },
  270. mp3Url() {
  271. const audioData = this.data.audio_data;
  272. return audioData.url.match(/^\[FID##/) ? audioData.temporary_url : audioData.url;
  273. },
  274. mp3Source() {
  275. const audioData = this.data.audio_data;
  276. return 'source' in audioData ? audioData.source : '';
  277. },
  278. mp3Duration() {
  279. return this.data.audio_data.media_duration * 1000;
  280. },
  281. selectData() {
  282. const { type, index } = this.selectedLine;
  283. const { row, column } = this.selectCell;
  284. return {
  285. type: type.length > 0 && index >= 0 ? type : 'cell',
  286. index,
  287. row,
  288. column,
  289. };
  290. },
  291. },
  292. watch: {
  293. hasSelectedCell() {
  294. this.handleParentPlay();
  295. },
  296. isShowRightAnswer(val) {
  297. if (!val) return;
  298. this.handleWav(this.answer.record_list);
  299. if (this.answer.record_list.length > 0) {
  300. this.getWavblob(this.answer.record_list[0].wavData);
  301. }
  302. },
  303. 'data.record_list'(val) {
  304. this.answer.record_list = val;
  305. },
  306. },
  307. created() {
  308. Bus.$on('audioPause', (id) => {
  309. if (this.cid === id) return;
  310. if (this.$refs.luyin?.microphoneStatus) this.$refs.luyin.microphone();
  311. this.handleParentPlay();
  312. });
  313. if (!('record_list' in this.answer)) {
  314. this.$set(this.answer, 'record_list', []);
  315. }
  316. },
  317. mounted() {
  318. document.querySelector('body').addEventListener('click', this.restoreAudioStatus);
  319. },
  320. beforeDestroy() {
  321. document.querySelector('body').removeEventListener('click', this.restoreAudioStatus);
  322. },
  323. methods: {
  324. handleWav(data) {
  325. this.data.record_list = data;
  326. },
  327. // 鼠标移入移出
  328. matrixCellMouseenter(i, j, type) {
  329. if (type === 'connection') {
  330. this.selectRow = -1;
  331. this.selectColumn = -1;
  332. } else {
  333. this.selectRow = i;
  334. this.selectColumn = j;
  335. }
  336. },
  337. clearSelectCell() {
  338. this.selectRow = -1;
  339. this.selectColumn = -1;
  340. },
  341. // 单击单元格
  342. matrixCellClick(row, column) {
  343. if (this.playing) this.handleParentPlay();
  344. if (this.unWatch) this.unWatch();
  345. this.lrcArray = [];
  346. if (row === this.selectCell.row && column === this.selectCell.column) {
  347. this.selectCell = { row: -1, column: -1 };
  348. return;
  349. }
  350. this.selectedLine = { type: '', index: -1 };
  351. this.selectCell = { row, column };
  352. this.handleChangeTime(this.data.option_list[row][column].lrc_data);
  353. // 设置录音文件名
  354. this.setRecordingFileName(row, column);
  355. },
  356. setRecordingFileName(row, column) {
  357. return `录音第${column}列第${row}行`;
  358. },
  359. /**
  360. * 判断 click 点击是否语音矩阵可操作区域
  361. * @param {PointerEvent} event
  362. */
  363. restoreAudioStatus(event) {
  364. const whitePath = [
  365. 'column-green',
  366. 'column-red',
  367. 'column-brown',
  368. 'matrix-checkbox-column-',
  369. 'matrix-checkbox-row-',
  370. 'audio-simple-image',
  371. 'audio-simple-repeat',
  372. 'luyin-box',
  373. ];
  374. const operable = event.composedPath().some((item) => {
  375. const className = item.className;
  376. if (!className || typeof className !== 'string') return false;
  377. return whitePath.some((path) => className.includes(path));
  378. });
  379. if (!operable) {
  380. this.selectedLine = { type: '', index: -1 };
  381. this.selectCell = { row: -1, column: -1 };
  382. if (this.playing) this.handleParentPlay();
  383. if (this.unWatch) this.unWatch();
  384. }
  385. },
  386. checkboxMouseenter(isSelected, type) {
  387. if (!isSelected) return this.clearSelectCell();
  388. if (type === 'row') this.selectColumn = -1;
  389. if (type === 'column') this.selectRow = -1;
  390. },
  391. // 选中行、列
  392. selectRowOrColumn(index, type) {
  393. this.handleParentPlay();
  394. this.lrcArray = [];
  395. this.selectCell = { row: -1, column: -1 };
  396. if (this.unWatch) this.unWatch();
  397. if (this.selectedLine.type === type && this.selectedLine.index === index) {
  398. this.selectedLine = { type: '', index: -1 };
  399. return;
  400. }
  401. this.selectedLine = { type, index };
  402. let number = index;
  403. if (type === 'column') {
  404. this.data.option_list[index].forEach((item, i) => {
  405. if (i >= index) return;
  406. });
  407. }
  408. this.fileName = `第 ${number + 1} ${type === 'row' ? '行' : '列'}`;
  409. },
  410. playAudio() {
  411. if (!this.hasSelectedCell) return;
  412. if (this.playing) return this.handleParentPlay();
  413. if (this.lrcArray.length > 0) return this.$refs.audioLine.PlayAudio();
  414. if (this.unWatch) this.unWatch();
  415. this.lrcArray = [];
  416. const { type, index } = this.selectedLine;
  417. if (type.length > 0 && index >= 0 && type === 'row') {
  418. this.data.option_list[index].forEach((item) => {
  419. const data = this.getLrcData(item);
  420. if (data) this.lrcArray.push(data);
  421. });
  422. if (this.lrcArray.length > 0) this.lrcPlay(this.lrcArray[0], 0);
  423. return;
  424. }
  425. if (type.length > 0 && index >= 0 && type === 'column') {
  426. this.data.option_list.forEach((item) => {
  427. const data = this.getLrcData(item[index]);
  428. if (data) this.lrcArray.push(data);
  429. });
  430. if (this.lrcArray.length > 0) this.lrcPlay(this.lrcArray[0], 0);
  431. return;
  432. }
  433. const { row, column } = this.selectCell;
  434. if (row >= 0 && column >= 0) {
  435. this.handleChangeTime(this.data.option_list[row][column].lrc_data);
  436. }
  437. },
  438. lrcPlay({ begin_time, end_time }, index) {
  439. this.handleParentPlay();
  440. this.$nextTick(() => {
  441. this.$refs.audioLine.onTimeupdateTime(begin_time / 1000);
  442. this.$refs.audioLine.PlayAudio();
  443. if (end_time === -1) return;
  444. const end = end_time / 1000 - 0.01;
  445. this.unWatch = this.$watch('curTime', (val) => {
  446. if (val >= end) {
  447. if (!this.hasSelectedCell) return this.unWatch();
  448. this.handleParentPlay();
  449. this.$refs.audioLine.onTimeupdateTime(end);
  450. this.unWatch();
  451. const i = index + 1;
  452. if (i < this.lrcArray.length) {
  453. return this.lrcPlay(this.lrcArray[i], i);
  454. }
  455. if (this.isRepeat) {
  456. return this.lrcPlay(this.lrcArray[0], 0);
  457. }
  458. this.lrcArray = [];
  459. }
  460. });
  461. });
  462. },
  463. playChange(playing) {
  464. this.playing = playing;
  465. // 子组件通信,同时只能播放一个音频
  466. if (playing) Bus.$emit('audioPause', this.cid);
  467. },
  468. pauseOtherAudio() {
  469. Bus.$emit('audioPause', this.cid);
  470. this.stopAudio = true;
  471. },
  472. // 暂停音频播放
  473. handleParentPlay() {
  474. this.stopAudio = true;
  475. },
  476. // 音频播放时改变布尔值
  477. handleChangeStopAudio() {
  478. this.stopAudio = false;
  479. },
  480. getCurTime(curTime) {
  481. this.curTime = curTime;
  482. },
  483. getWavblob(wavblob) {
  484. this.wavblob = wavblob;
  485. },
  486. getSelectData({ type, index, row, column }) {
  487. if (type === '') return;
  488. const arr = [];
  489. if (type.length > 0 && index >= 0 && type === 'row') {
  490. this.data.option_list[index].forEach((item) => {
  491. const data = this.getLrcData(item);
  492. if (data) arr.push(data);
  493. });
  494. this.matrixSelectLrc = arr;
  495. return;
  496. }
  497. if (type.length > 0 && index >= 0 && type === 'column') {
  498. this.data.option_list.forEach((item) => {
  499. const data = this.getLrcData(item[index]);
  500. if (data) arr.push(data);
  501. });
  502. this.matrixSelectLrc = arr;
  503. return;
  504. }
  505. if (type === 'cell' && row >= 0 && column >= 0) {
  506. const lrcData = this.data.option_list[row][column].lrc_data;
  507. if (lrcData.end_time === -1) lrcData.end_time = this.mp3Duration;
  508. this.matrixSelectLrc = [lrcData];
  509. }
  510. },
  511. getLrcData({ content, lrc_data }) {
  512. if (content.length > 0) {
  513. if (lrc_data.end_time === -1) {
  514. return {
  515. begin_time: lrc_data.begin_time,
  516. end_time: this.mp3Duration,
  517. text: lrc_data.text,
  518. };
  519. }
  520. return lrc_data;
  521. }
  522. return false;
  523. },
  524. sentPause(isRecord) {
  525. this.isRecord = isRecord;
  526. },
  527. handleChangeTime({ begin_time, end_time }) {
  528. if (this.unWatch) this.unWatch();
  529. this.handleParentPlay();
  530. this.$nextTick(() => {
  531. this.$refs.audioLine.onTimeupdateTime(begin_time / 1000);
  532. this.$refs.audioLine.PlayAudio();
  533. // 监听是否已到结束时间,为了选中效果 - 0.01
  534. if (end_time === -1) return;
  535. const end = end_time / 1000 - 0.01;
  536. this.unWatch = this.$watch('curTime', (val) => {
  537. if (val >= end) {
  538. this.handleParentPlay();
  539. this.$refs.audioLine.onTimeupdateTime(end);
  540. this.unWatch();
  541. this.unWatch = null;
  542. if (this.isRepeat) {
  543. this.handleChangeTime({ begin_time, end_time });
  544. }
  545. }
  546. });
  547. });
  548. },
  549. },
  550. };
  551. </script>
  552. <style lang="scss" scoped>
  553. @use '@/styles/mixin.scss' as *;
  554. $select-color: #1890ff;
  555. $border-color: #e6e6e6;
  556. .voice-matrix-preview {
  557. @include preview-base;
  558. .main {
  559. color: #262626;
  560. .voice-matrix-audio {
  561. display: flex;
  562. height: 42px;
  563. border: 1px solid $border-color;
  564. border-radius: 8px 8px 0 0;
  565. .audio-number {
  566. padding: 12px 0 0 12px;
  567. %serial-number,
  568. .serial-number {
  569. display: inline-block;
  570. width: 16px;
  571. height: 16px;
  572. font-family: 'robot';
  573. font-size: 16px;
  574. line-height: 16px;
  575. color: #000;
  576. text-align: center;
  577. border-radius: 50%;
  578. }
  579. }
  580. .audio-simple {
  581. display: flex;
  582. flex-grow: 1;
  583. align-items: center;
  584. justify-content: space-between;
  585. height: 100%;
  586. line-height: 46px;
  587. .audio-simple-image {
  588. width: 24px;
  589. height: 24px;
  590. margin-left: 12px;
  591. cursor: pointer;
  592. }
  593. img {
  594. width: 16px;
  595. height: 16px;
  596. margin-left: 12px;
  597. cursor: pointer;
  598. }
  599. .Repeat-16 {
  600. display: inline-block;
  601. width: 16px;
  602. height: 16px;
  603. margin-right: 12px;
  604. cursor: pointer;
  605. }
  606. }
  607. }
  608. // 语音矩阵
  609. .voice-matrix-container {
  610. font-size: 16px;
  611. word-break: break-word;
  612. background-color: #f5f5f5;
  613. border-right: 1px solid $border-color;
  614. border-bottom: 1px solid $border-color;
  615. border-left: 1px solid $border-color;
  616. .matrix {
  617. display: inline-grid;
  618. width: 100%;
  619. height: 100%;
  620. %matrix-checkbox {
  621. position: relative;
  622. top: calc(50% - 5px);
  623. display: block;
  624. width: 14px;
  625. height: 14px;
  626. margin: 0 auto;
  627. cursor: pointer;
  628. border: 1.5px solid #b0b0b0;
  629. border-radius: 4px;
  630. &.active {
  631. border-color: $select-color;
  632. &::after {
  633. position: absolute;
  634. left: 4px;
  635. box-sizing: content-box;
  636. width: 3px;
  637. height: 7px;
  638. content: '';
  639. border: 1px solid $select-color;
  640. border-top: 0;
  641. border-left: 0;
  642. transition: transform 0.15s ease-in 0.05s;
  643. transform: rotate(45deg) scaleY(1);
  644. transform-origin: center;
  645. }
  646. }
  647. }
  648. .matrix-checkbox-row-,
  649. .matrix-checkbox-row-red {
  650. @extend %matrix-checkbox;
  651. }
  652. %matrix-checkbox-column,
  653. .matrix-checkbox-column-,
  654. .matrix-checkbox-column-red {
  655. @extend %matrix-checkbox;
  656. top: calc(50% - 7px);
  657. right: -2px;
  658. }
  659. .read {
  660. background-color: #eaeaea;
  661. }
  662. .highlight-,
  663. .highlight-red {
  664. color: $select-color;
  665. }
  666. .column-wrapper {
  667. padding: 4px;
  668. %column {
  669. width: 100%;
  670. height: 100%;
  671. min-height: 32px;
  672. cursor: pointer;
  673. user-select: none;
  674. background-color: #fff;
  675. border: 1px solid $border-color;
  676. border-radius: 4px;
  677. transition: 0.2s;
  678. &:hover {
  679. border-color: #8c8c8c;
  680. }
  681. &.selected {
  682. color: $select-color;
  683. border-color: $select-color;
  684. }
  685. &.playing {
  686. background-color: rgba(24, 144, 255, 10%);
  687. }
  688. &.title {
  689. background-color: transparent;
  690. border-color: transparent;
  691. }
  692. > span {
  693. display: inline-block;
  694. width: 100%;
  695. padding: 4px 12px;
  696. line-height: 24px;
  697. }
  698. .lang {
  699. padding: 0 12px 4px;
  700. }
  701. }
  702. %column-red,
  703. .column-,
  704. .column-red {
  705. @extend %column;
  706. position: relative;
  707. &::before {
  708. display: inline-block;
  709. vertical-align: middle;
  710. content: '';
  711. }
  712. }
  713. %sentence,
  714. .sentence-,
  715. .sentence-red {
  716. @extend %column;
  717. display: inline-grid;
  718. column-gap: 8px;
  719. justify-content: start;
  720. justify-items: center;
  721. padding: 4px 12px;
  722. line-height: 24px;
  723. > span {
  724. padding: 0;
  725. }
  726. .pinyin {
  727. font-family: 'League';
  728. font-size: 12px;
  729. line-height: 20px;
  730. opacity: 0.45;
  731. }
  732. .chs {
  733. font-size: 16px;
  734. line-height: 24px;
  735. }
  736. }
  737. .connection {
  738. position: relative;
  739. top: calc(50% - 1px);
  740. width: 16px;
  741. height: 2px;
  742. margin: 0 -4px;
  743. background-color: #252525;
  744. border-radius: 4px;
  745. &.highlight-bc-,
  746. &.highlight-bc-red {
  747. background-color: $select-color;
  748. }
  749. }
  750. // 拼音 + 文字
  751. %pinyin-english,
  752. .pinyinEnglish-,
  753. .pinyinEnglish-red {
  754. @extend %column;
  755. .inside-wrapper {
  756. padding: 4px 12px;
  757. .pinyin {
  758. font-family: 'League';
  759. font-size: 16px;
  760. line-height: 24px;
  761. }
  762. .english {
  763. font-family: 'robot';
  764. font-size: 12px;
  765. line-height: 20px;
  766. opacity: 0.45;
  767. }
  768. }
  769. }
  770. %text-brackets,
  771. .textBrackets-,
  772. .textBrackets-red {
  773. @extend %column;
  774. .brackets-text {
  775. font-family: 'League';
  776. }
  777. .brackets {
  778. font-size: 16px;
  779. }
  780. }
  781. }
  782. }
  783. .matrix-audio {
  784. width: 228px;
  785. height: 40px;
  786. padding: 4px 4px 4px 16px;
  787. margin: 24px 24px 0 0;
  788. background-color: #fff;
  789. border: 1px solid $border-color;
  790. border-radius: 8px;
  791. }
  792. }
  793. .voice-luyin {
  794. display: flex;
  795. align-items: center;
  796. height: 40px;
  797. padding: 3px 16px;
  798. border: 1px solid $border-color;
  799. border-top-width: 0;
  800. border-radius: 0 0 8px 8px;
  801. :deep .record {
  802. max-width: 280px;
  803. }
  804. }
  805. }
  806. }
  807. .NNPE-tableList-tr-last {
  808. .voice-matrix {
  809. padding-bottom: 0;
  810. }
  811. }
  812. </style>
  813. <style lang="scss">
  814. .voice-matrix {
  815. &-audio {
  816. .audioLine {
  817. border-radius: 8px 8px 0 0 !important;
  818. }
  819. .el-slider {
  820. width: 100% !important;
  821. }
  822. }
  823. .luyin-box {
  824. .el-select .el-input {
  825. width: 136px;
  826. }
  827. }
  828. }
  829. </style>