CharacterPreview.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!-- eslint-disable vue/no-v-html -->
  2. <template>
  3. <div class="character-preview">
  4. <SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
  5. <div class="main">
  6. <div class="content-box" v-for="(item, index) in data.content_list" :key="index">
  7. <div class="main-top" :style="{ width: item.hz_strokes_list.length * 64 + 'px' }">
  8. <AudioPlay v-if="isEnable(data.property.is_enable_voice)" :file-id="item.audio_file_id" theme-color="gray" />
  9. <span class="pinyin" v-if="isEnable(data.property.is_enable_pinyin)">{{ item.pinyin }}</span>
  10. </div>
  11. <div class="strock-chinese-box">
  12. <Strockplayredline
  13. v-for="(items, indexs) in item.hz_strokes_list"
  14. :key="indexs"
  15. :play-storkes="isEnable(data.property.is_enable_stroke)"
  16. :book-text="item.con"
  17. :target-div="'pre' + item.con + indexs"
  18. :book-strokes="items.strokes"
  19. :class="['strock-chinese', indexs !== item.hz_strokes_list.length - 1 ? 'border-right-none' : '']"
  20. :bg-type="data.property.frame_type"
  21. :frame-color="data.property.frame_color"
  22. />
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import { getCharacterData } from '@/views/book/courseware/data/character';
  30. import PreviewMixin from '../common/PreviewMixin';
  31. import AudioPlay from '../character_base/components/AudioPlay.vue';
  32. import Strockplayredline from '../character_base/components/Strockplayredline.vue';
  33. export default {
  34. name: 'CharacterPreview',
  35. components: {
  36. AudioPlay,
  37. Strockplayredline,
  38. },
  39. mixins: [PreviewMixin],
  40. data() {
  41. return {
  42. data: getCharacterData(),
  43. };
  44. },
  45. watch: {},
  46. computed: {},
  47. created() {},
  48. methods: {},
  49. };
  50. </script>
  51. <style lang="scss" scoped>
  52. @use '@/styles/mixin.scss' as *;
  53. .character-preview {
  54. @include preview-base;
  55. display: block;
  56. .main {
  57. display: flex;
  58. flex-wrap: wrap;
  59. column-gap: 16px;
  60. justify-content: start;
  61. }
  62. .content-box {
  63. width: max-content;
  64. }
  65. .audio-wrapper-nobg {
  66. height: 16px;
  67. :deep .audio-play {
  68. width: 16px;
  69. height: 16px;
  70. color: #000;
  71. background-color: initial;
  72. }
  73. :deep .audio-play.not-url {
  74. color: #a1a1a1;
  75. }
  76. :deep .voice-play {
  77. width: 16px;
  78. height: 16px;
  79. }
  80. }
  81. .main-top {
  82. display: flex;
  83. column-gap: 4px;
  84. align-items: center;
  85. justify-content: center;
  86. }
  87. .pinyin {
  88. font-family: 'League';
  89. font-size: 12px;
  90. font-weight: 500;
  91. color: #000;
  92. }
  93. .strock-chinese-box {
  94. display: flex;
  95. flex-wrap: wrap;
  96. margin: 8px 0;
  97. }
  98. .strockplay-newWord {
  99. position: relative;
  100. box-sizing: border-box;
  101. flex-shrink: 0;
  102. width: 64px;
  103. height: 64px;
  104. border: 1px solid #e81b1b;
  105. .character-target-bg,
  106. .hanzi-writer-img {
  107. position: absolute;
  108. top: 0;
  109. left: 0;
  110. width: 100%;
  111. height: 100%;
  112. color: #dedede;
  113. }
  114. .hanzi-writer-img {
  115. z-index: 1;
  116. }
  117. }
  118. .border-right-none {
  119. border-right: none;
  120. }
  121. }
  122. </style>