xuePage.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="words-xue-box">
  3. <selectTypesVue activeSelect="1"></selectTypesVue>
  4. <view class="words-xue-body">
  5. <!-- 单词区 -->
  6. <view class="word-circle-box">
  7. <text v-for="(item,index) in activeWord.chaifen" :key="index">{{item}}</text>
  8. </view>
  9. <view class="word-block-box">
  10. <text v-for="(item,index) in activeWord.chaifen" :key="index">{{item}}</text>
  11. </view>
  12. <!-- 音标区 -->
  13. <view class="yb-play-box">
  14. <yinbiaoTxtVue :yinbiao="activeWord.yinbiao"></yinbiaoTxtVue>
  15. <!-- 音频播放 -->
  16. <audioTwoVue :active-word="activeWord" @play-audio="handlePlay"></audioTwoVue>
  17. </view>
  18. <!-- 注释区 -->
  19. <view class="pin-words-explain-box">
  20. <view class="words-explain-item" v-for="item in activeWord.xiangyi" :key="item">{{item}}</view>
  21. </view>
  22. <!-- 详解触发 -->
  23. <view @click="goXiangjie" class="details-btn">详解 ></view>
  24. <!-- 音标拆分区 -->
  25. <view v-if="data.isPindu" class="word-block-box yb-block-box">
  26. <!-- pindu -->
  27. <audioThreeVue v-for="(item,index) in activeWord.pindu" :key="index" :YItem="item" @play-audio="handlePlay"></audioThreeVue>
  28. </view>
  29. <view v-else class="yj-block-box">
  30. <!-- yinjie -->
  31. <audioFourVue v-for="(item,index) in activeWord.yinjie" :key="index" :YItem="item" @play-audio="handlePlay"></audioFourVue>
  32. </view>
  33. <!-- 音标按钮 -->
  34. <view class="xue-change-btn-box">
  35. <view class="change-btn" :class="{active: data.isPindu}" @click="handlePindu"><text>自然拼读</text></view>
  36. <view class="change-btn" :class="{active: !data.isPindu}" @click="handleYinjie"><text>音节拆分</text></view>
  37. </view>
  38. <!-- 词根+实用口语 -->
  39. <template v-if="data.isPindu">
  40. <view v-if="activeWord.cigenzhuji.length" class="details-content-box xue-details-content-box">
  41. <text class="details-title">词根助记</text>
  42. <scroll-view class="cg-item-list" scroll-x @touchmove.stop >
  43. <view class="cg-item-box" v-for="(item,index) in activeWord.cigenzhuji" :key="index" >
  44. <view class="cg-item">
  45. <view>{{item.en}}</view>
  46. <view>{{item.zn}}</view>
  47. </view>
  48. <view class="cg-symbol" v-if="index<activeWord.cigenzhuji.length-2">+</view>
  49. <view class="cg-symbol" v-if="index == activeWord.cigenzhuji.length - 2">=</view>
  50. </view>
  51. </scroll-view>
  52. </view>
  53. </template>
  54. <!-- 实用语句 -->
  55. <template v-else>
  56. <view class="details-content-box xue-details-content-box">
  57. <text class="details-title">实用口语</text>
  58. <view v-for="(item,index) in activeWord.kouyu" :key="index" class="syky-content">
  59. <view class="details-en-content">
  60. <view>{{item.en}}</view>
  61. <!-- 变色 word-color-->
  62. <!-- <text class="word-color">{{item.en}}</text>
  63. <text>{{item.en}}</text> -->
  64. </view>
  65. <view class="details-cn-content">{{item.zn}}</view>
  66. </view>
  67. </view>
  68. </template>
  69. </view>
  70. </view>
  71. </template>
  72. <script setup>
  73. import selectTypesVue from './selectTypes.vue';
  74. import audioTwoVue from './audioTwo.vue';
  75. import audioThreeVue from './audioThree.vue';
  76. import audioFourVue from './audioFour.vue';
  77. import yinbiaoTxtVue from "./yinbiaoTxt.vue"
  78. import {
  79. reactive,
  80. computed,
  81. } from 'vue';
  82. import {
  83. getUserIdentity,
  84. } from "@/utils/common.js"
  85. import * as httpApi from "@/api/word.js"
  86. import {
  87. audioPlayer,
  88. useAudioCache
  89. } from './useAudio.js';
  90. const emits = defineEmits(['play-audio'])
  91. const {
  92. cacheAudio,
  93. clearAudioCache
  94. } = useAudioCache();
  95. const data = reactive({
  96. isPlaying:false,
  97. isPindu:true,
  98. })
  99. const userCode = getUserIdentity();
  100. const props = defineProps({
  101. activeWord: { // 单词数据
  102. type: Object,
  103. },
  104. activeWords: {
  105. type: Array
  106. },
  107. pageData: {
  108. type: Object,
  109. },
  110. })
  111. async function handlePlay(opt) {
  112. emits('play-audio', opt)
  113. }
  114. function handlePindu() {
  115. data.isPindu = true
  116. }
  117. function handleYinjie() {
  118. data.isPindu = false
  119. }
  120. function goXiangjie() {
  121. uni.redirectTo({
  122. url: '/pages/newEnglish/components/xiangjie?jieId='+props.pageData.jieId+'&wordId='+props.pageData.activeId
  123. })
  124. }
  125. </script>
  126. <style>
  127. </style>