xuePage.vue 3.0 KB

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