123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <selectTypesVue :activeSelect="currentIndex"></selectTypesVue>
- <swiper class="word-view-swiper-box" :indicator-dots="false" :autoplay="false" :circular="false"
- @change="handleSwiperChange" :disable-touch="isPlaying">
- <swiper-item>
- <view class="swiper-item uni-bg-red">
- <xuePage :active-word="activeWord" :active-words="activeWords" @goXiangjie="goXiangjie"
- @play-audio="handlePlayAudio" :pageData="pageData"></xuePage>
- </view>
- </swiper-item>
- <swiper-item>
- <view class="swiper-item uni-bg-red">
- <pinPageVue :active-word="activeWord" :active-words="activeWords" @play-audio="handlePlayAudio">
- </pinPageVue>
- </view>
- </swiper-item>
- <swiper-item>
- <view class="swiper-item uni-bg-blue">
- <readContent :active-word="activeWord" :pageData="pageData" @play-audio="handlePlayAudio"
- @luyinSuccess="luyinSuccess" :active-words="activeWords"></readContent>
- </view>
- </swiper-item>
- <swiper-item>
- <view class="swiper-item uni-bg-blue">
- <selectPageVue :active-word="activeWord" :active-words="activeWords" @play-audio="handlePlayAudio">
- </selectPageVue>
- </view>
- </swiper-item>
- <swiper-item>
- <view class="swiper-item uni-bg-blue">
- <beiPageVue :active-word="activeWord" :pageData="pageData" :active-words="activeWords"
- @play-audio="handlePlayAudio"></beiPageVue>
- </view>
- </swiper-item>
- </swiper>
- <uni-popup ref="statusPopup" :animation="false" :is-mask-click="false"
- mask-background-color="rgba(51, 137, 217, 0.65);">
- <view class="ezy-image-dialog luyin">
- </view>
- </uni-popup>
- <audioRightWrongVue></audioRightWrongVue>
- </template>
- <script setup>
- import pinPageVue from './pinPage.vue';
- import selectPageVue from './selectPage.vue';
- import beiPageVue from './beiPage.vue';
- import readContent from './readContent.vue';
- import xuePage from './xuePage.vue';
- import audioRightWrongVue from "../components/audioRightWrong.vue";
- import selectTypesVue from './selectTypes.vue';
- import {
- ref,
- onMounted,
- onUnmounted
- } from 'vue';
- const props = defineProps({
- activeWord: {
- type: Object,
- },
- pageData: {
- type: Object,
- },
- activeWords: {
- type: Array
- },
- isPlaying: Boolean // 新增 isPlaying prop
- })
- const statusPopup = ref(null)
- const popupImage = ref('')
- const statusAudio = uni.createInnerAudioContext()
- const emits = defineEmits(['play-audio', 'goXiangjie', 'swiper-change'])
- const currentIndex = ref(1)
- const luyinSuccess = (imagePath, text, audioPath) => {
- console.log('111111');
- showStatusPopup('', '录音成功!', '/static/mp3/newYingyu/right-tip.mp3')
- }
- const showStatusPopup = (imagePath, text, audioPath) => {
- console.log('audioPath', audioPath);
- // 播放音效
- statusAudio.stop()
- statusAudio.src = audioPath
- statusAudio.play()
- // 显示弹窗
- statusPopup.value.open()
- }
- function handleSwiperChange(e) {
- emits('swiper-change', e.detail.current)
- currentIndex.value = e.detail.current+1;
- }
- function handlePlayAudio({
- url,
- code
- }) {
- emits('play-audio', {
- url,
- code
- })
- }
- function goXiangjie() {
- emits('goXiangjie')
- }
- onMounted(() => {
- statusAudio.autoplay = false
- statusAudio.onEnded(() => {
- statusPopup.value.close()
- })
- })
- onUnmounted(() => {
- statusAudio.destroy()
- })
- </script>
- <style lang="scss" scoped>
- </style>
|