RecordSpell.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <!-- 大声朗读 -->
  3. <div class="RecordSpell_main">
  4. <div :key="item.con + index" class="readSpell" v-for="(item, index) in cur.stem">
  5. <template v-if="item.mp3_url.indexOf('[FID##') > -1">
  6. <Audio
  7. :mp3="item.mp3List[0].response.file_info_list[0].file_url"
  8. :pinyin="item.pinyin"
  9. />
  10. </template>
  11. <template v-else>
  12. <Audio :mp3="item.mp3_url" :pinyin="item.pinyin"/>
  13. </template>
  14. </div>
  15. <div class="fourLine">{{cur.stem[0].con}}</div>
  16. <Soundrecord :queIndex="queIndex" :wavData="wavData" @handle-Wav="handleWav"/>
  17. </div>
  18. </template>
  19. <script>
  20. import Soundrecord from "../../components/common/Soundrecord";
  21. import Audio from "../../components/common/Audio";
  22. export default {
  23. name: 'RecordSpell',
  24. props: [
  25. "cur",
  26. "getAnswer",
  27. "queIndex",
  28. "answer",
  29. "uiType",
  30. "watchIndex"
  31. ],
  32. components: {
  33. Soundrecord,
  34. Audio
  35. },
  36. data () {
  37. return {
  38. userAnswer: [],
  39. wavData: null
  40. }
  41. },
  42. watch: {
  43. watchIndex: {
  44. handler: function (val, oldVal) {
  45. let _this = this;
  46. if (this.cur.Bookanswer) {
  47. this.wavData = this.cur.Bookanswer[0]
  48. } else {
  49. this.wavData = null
  50. }
  51. },
  52. // 深度观察监听
  53. deep: true,
  54. },
  55. },
  56. created () {
  57. if (this.cur.Bookanswer) {
  58. this.wavData = this.cur.Bookanswer[0]
  59. } else {
  60. this.wavData = null
  61. }
  62. },
  63. methods: {
  64. handleWav (data) {
  65. this.userAnswer = []
  66. this.userAnswer.push(data)
  67. this.getAnswer(this.userAnswer, this.queIndex)
  68. this.cur.Bookanswer = this.userAnswer
  69. },
  70. // 判断对错
  71. practiceJudge () {
  72. if(this.cur.Bookanswer){
  73. return true
  74. }else{
  75. return false
  76. }
  77. }
  78. },
  79. };
  80. </script>
  81. <style lang='scss' scoped>
  82. .RecordSpell_main {
  83. max-width: max-content;
  84. min-width: 444px;
  85. margin: 0 auto;
  86. padding-top: 52px;
  87. }
  88. .readSpell {
  89. text-align: center;
  90. font-size: 0;
  91. padding-bottom: 24px;
  92. }
  93. .readSpell img,
  94. .rightArrows img,
  95. .leftArrows img {
  96. cursor: pointer;
  97. }
  98. .fourLine {
  99. background: #ffff url('../../assets/single/bg-readAloud.png') center
  100. no-repeat;
  101. background-size: 100% 216px;
  102. border-radius: 24px;
  103. font-size: 144px;
  104. line-height: 216px;
  105. font-family: GB-PINYINOK-B;
  106. text-align: center;
  107. height: 444px;
  108. padding: 96px 36px 126px 36px;
  109. box-shadow: 0px 6px 0px rgba(239, 167, 28, 0.4);
  110. overflow-x: auto;
  111. overflow-y: hidden;
  112. white-space: nowrap;
  113. min-width: 444px;
  114. }
  115. .Book-record {
  116. justify-content: center;
  117. padding-top: 78px;
  118. }
  119. .questionMiddle {
  120. .RecordSpell_main {
  121. max-width: max-content;
  122. min-width: 296px;
  123. margin: 0 auto;
  124. padding-top: 28px;
  125. }
  126. .readSpell {
  127. padding-bottom: 16px;
  128. }
  129. .fourLine {
  130. background: #ffff url('../../assets/single/bg-readAloud.png') center
  131. no-repeat;
  132. background-size: 100% 144px;
  133. border-radius: 16px;
  134. font-size: 96px;
  135. line-height: 144px;
  136. height: 296px;
  137. padding: 64px 24px 84px 24px;
  138. box-shadow: 0px 4px 0px rgba(239, 167, 28, 0.4);
  139. min-width: 296px;
  140. }
  141. .Book-record {
  142. padding-top: 52px;
  143. }
  144. }
  145. .questionSmall {
  146. .RecordSpell_main {
  147. min-width: 222px;
  148. padding-top: 16px;
  149. }
  150. .readSpell {
  151. padding-bottom: 12px;
  152. }
  153. .fourLine {
  154. background: #ffff url('../../assets/single/bg-readAloud.png') center
  155. no-repeat;
  156. background-size: 100% 108px;
  157. border-radius: 12px;
  158. font-size: 72px;
  159. line-height: 108px;
  160. height: 222px;
  161. padding: 48px 18px 63px 18px;
  162. box-shadow: 0px 3px 0px rgba(239, 167, 28, 0.4);
  163. min-width: 222px;
  164. }
  165. .Book-record {
  166. padding-top: 39px;
  167. }
  168. }
  169. </style>