CharacterPreview.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!-- eslint-disable vue/no-v-html -->
  2. <template>
  3. <div class="select-preview" :style="getAreaStyle()">
  4. <SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
  5. <div class="main" :style="getMainStyle()">预览开发中</div>
  6. </div>
  7. </template>
  8. <script>
  9. import {
  10. getCharacterData,
  11. fillFontList,
  12. arrangeTypeList,
  13. audioPositionList,
  14. } from '@/views/book/courseware/data/character';
  15. import PreviewMixin from '../common/PreviewMixin';
  16. import AudioFill from '../fill/components/AudioFillPlay.vue';
  17. import SoundRecord from '../../common/SoundRecord.vue';
  18. export default {
  19. name: 'CharacterPreview',
  20. components: {
  21. AudioFill,
  22. SoundRecord,
  23. },
  24. mixins: [PreviewMixin],
  25. data() {
  26. return {
  27. data: getCharacterData(),
  28. };
  29. },
  30. computed: {
  31. fontFamily() {
  32. return fillFontList.find(({ value }) => this.data.property.fill_font === value).font;
  33. },
  34. },
  35. created() {
  36. this.answer.answer_list = this.data.model_essay
  37. .map((item) => {
  38. return item
  39. .map(({ type, content, mark }) => {
  40. if (type === 'input') {
  41. return {
  42. value: content,
  43. mark,
  44. };
  45. }
  46. })
  47. .filter((item) => item);
  48. })
  49. .flat();
  50. },
  51. methods: {
  52. getMainStyle() {
  53. const isRow = this.data.property.arrange_type === arrangeTypeList[0].value;
  54. const isFront = this.data.property.audio_position === audioPositionList[0].value;
  55. const isEnableVoice = this.data.property.is_enable_voice_answer === 'true';
  56. let _list = [
  57. { name: 'audio', value: '24px' },
  58. { name: 'fill', value: '1fr' },
  59. ];
  60. if (!isFront) {
  61. _list = _list.reverse();
  62. }
  63. let grid = isRow
  64. ? `"${_list[0].name} ${_list[1].name}${isEnableVoice ? ' record' : ''}" auto / ${_list[0].value} ${_list[1].value}${isEnableVoice ? ' 160px' : ''}`
  65. : `"${_list[0].name}" ${_list[0].value} "${_list[1].name}" ${_list[1].value}${isEnableVoice ? `" record" 32px ` : ''} / 1fr`;
  66. let style = {
  67. 'grid-auto-flow': isRow ? 'column' : 'row',
  68. 'column-gap': isRow ? '16px' : undefined,
  69. 'row-gap': isRow ? undefined : '8px',
  70. grid,
  71. };
  72. return style;
  73. },
  74. },
  75. };
  76. </script>
  77. <style lang="scss" scoped>
  78. @use '@/styles/mixin.scss' as *;
  79. .select-preview {
  80. @include preview-base;
  81. .main {
  82. display: grid;
  83. align-items: center;
  84. }
  85. .fill-wrapper {
  86. grid-area: fill;
  87. font-size: 16pt;
  88. p {
  89. margin: 0;
  90. }
  91. .el-input {
  92. display: inline-flex;
  93. align-items: center;
  94. width: 120px;
  95. margin: 0 2px;
  96. &.pinyin :deep input.el-input__inner {
  97. font-family: 'PINYIN-B', sans-serif;
  98. }
  99. &.chinese :deep input.el-input__inner {
  100. font-family: 'arial', sans-serif;
  101. }
  102. &.english :deep input.el-input__inner {
  103. font-family: 'arial', sans-serif;
  104. }
  105. :deep input.el-input__inner {
  106. padding: 0;
  107. font-size: 16pt;
  108. color: $font-color;
  109. text-align: center;
  110. background-color: #fff;
  111. border-width: 0;
  112. border-bottom: 1px solid $font-color;
  113. border-radius: 0;
  114. }
  115. }
  116. }
  117. .record-box {
  118. padding: 6px 12px;
  119. background-color: $fill-color;
  120. :deep .record-time {
  121. width: 100px;
  122. }
  123. }
  124. }
  125. </style>