xuePage.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. <view v-if="activeWord.cigenzhuji.length" class="details-content-box xue-details-content-box">
  40. <text class="details-title">词根助记</text>
  41. <scroll-view class="cg-item-list" scroll-x @touchmove.stop >
  42. <view class="cg-item-box" v-for="(item,index) in activeWord.cigenzhuji" :key="index" >
  43. <view class="cg-item">
  44. <view>{{item.en}}</view>
  45. <view>{{item.zn}}</view>
  46. </view>
  47. <view class="cg-symbol" v-if="index<activeWord.cigenzhuji.length-2">+</view>
  48. <view class="cg-symbol" v-if="index == activeWord.cigenzhuji.length - 2">=</view>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. <!-- 实用语句 -->
  53. <view class="details-content-box xue-details-content-box">
  54. <text class="details-title">实用口语</text>
  55. <view v-for="(item,index) in activeWord.kouyu" :key="index" class="syky-content">
  56. <view class="details-en-content">
  57. <view>{{item.en}}</view>
  58. <!-- 变色 word-color-->
  59. <!-- <text class="word-color">{{item.en}}</text>
  60. <text>{{item.en}}</text> -->
  61. </view>
  62. <view class="details-cn-content">{{item.zn}}</view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script setup>
  69. import selectTypesVue from './selectTypes.vue';
  70. import audioTwoVue from './audioTwo.vue';
  71. import audioThreeVue from './audioThree.vue';
  72. import audioFourVue from './audioFour.vue';
  73. import yinbiaoTxtVue from "./yinbiaoTxt.vue"
  74. import {
  75. reactive,
  76. computed,
  77. } from 'vue';
  78. import {
  79. getUserIdentity,
  80. } from "@/utils/common.js"
  81. import * as httpApi from "@/api/word.js"
  82. import {
  83. audioPlayer,
  84. useAudioCache
  85. } from './useAudio.js';
  86. const emits = defineEmits(['play-audio'])
  87. const {
  88. cacheAudio,
  89. clearAudioCache
  90. } = useAudioCache();
  91. const data = reactive({
  92. isPlaying:false,
  93. isPindu:true,
  94. })
  95. const userCode = getUserIdentity();
  96. const props = defineProps({
  97. activeWord: { // 单词数据
  98. type: Object,
  99. },
  100. activeWords: {
  101. type: Array
  102. },
  103. pageData: {
  104. type: Object,
  105. },
  106. })
  107. async function handlePlay(opt) {
  108. emits('play-audio', opt)
  109. }
  110. function handlePindu() {
  111. data.isPindu = true
  112. }
  113. function handleYinjie() {
  114. data.isPindu = false
  115. }
  116. function goXiangjie() {
  117. uni.redirectTo({
  118. url: '/pages/newEnglish/components/xiangjie?jieId='+props.pageData.jieId+'&wordId='+props.pageData.activeId
  119. })
  120. }
  121. </script>
  122. <style>
  123. </style>