WritePreview.vue 3.3 KB

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