|
@@ -25,7 +25,7 @@
|
|
<view class="word-view-btn" v-if="isLast&&isLearnRecord!=0" @click="handleComplete">完成</view>
|
|
<view class="word-view-btn" v-if="isLast&&isLearnRecord!=0" @click="handleComplete">完成</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
-
|
|
|
|
|
|
+
|
|
<audioRightWrongVue></audioRightWrongVue>
|
|
<audioRightWrongVue></audioRightWrongVue>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -35,7 +35,8 @@
|
|
import {
|
|
import {
|
|
ref,
|
|
ref,
|
|
reactive,
|
|
reactive,
|
|
- computed
|
|
|
|
|
|
+ computed,
|
|
|
|
+ nextTick
|
|
} from "vue";
|
|
} from "vue";
|
|
import {
|
|
import {
|
|
onLoad
|
|
onLoad
|
|
@@ -48,8 +49,10 @@
|
|
useAudioCache,
|
|
useAudioCache,
|
|
audioPlayer
|
|
audioPlayer
|
|
} from "./components/useAudio.js"
|
|
} from "./components/useAudio.js"
|
|
- import {getWordCancel} from "../../api/word";
|
|
|
|
- import audioRightWrongVue from "./components/audioRightWrong.vue";
|
|
|
|
|
|
+ import {
|
|
|
|
+ getWordCancel
|
|
|
|
+ } from "../../api/word";
|
|
|
|
+ import audioRightWrongVue from "./components/audioRightWrong.vue";
|
|
|
|
|
|
const userCode = getUserIdentity();
|
|
const userCode = getUserIdentity();
|
|
|
|
|
|
@@ -194,25 +197,25 @@
|
|
}
|
|
}
|
|
|
|
|
|
function handleShouCang() {
|
|
function handleShouCang() {
|
|
- if (data.collectFlag == 1) {
|
|
|
|
- httpApi.getWordCancel({
|
|
|
|
- wordId:data.activeId
|
|
|
|
- }).then(res => {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '操作成功'
|
|
|
|
- })
|
|
|
|
- data.collectFlag = 0;
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- httpApi.getWordShouCang({
|
|
|
|
- wordId: data.activeId
|
|
|
|
- }).then(res => {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '操作成功'
|
|
|
|
- })
|
|
|
|
- data.collectFlag = 1;
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ if (data.collectFlag == 1) {
|
|
|
|
+ httpApi.getWordCancel({
|
|
|
|
+ wordId: data.activeId
|
|
|
|
+ }).then(res => {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '操作成功'
|
|
|
|
+ })
|
|
|
|
+ data.collectFlag = 0;
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ httpApi.getWordShouCang({
|
|
|
|
+ wordId: data.activeId
|
|
|
|
+ }).then(res => {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '操作成功'
|
|
|
|
+ })
|
|
|
|
+ data.collectFlag = 1;
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function initWordInfo() {
|
|
function initWordInfo() {
|
|
@@ -230,6 +233,7 @@
|
|
}
|
|
}
|
|
// console.log('res.data',res.data)
|
|
// console.log('res.data',res.data)
|
|
handleCacheAudio()
|
|
handleCacheAudio()
|
|
|
|
+ //autoPlayAudio()
|
|
|
|
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
@@ -245,12 +249,29 @@
|
|
}
|
|
}
|
|
|
|
|
|
handleCacheAudio()
|
|
handleCacheAudio()
|
|
|
|
+ //autoPlayAudio()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // 新增自动播放功能
|
|
|
|
+ const autoPlayAudio = async () => {
|
|
|
|
+ // 等待数据加载完成
|
|
|
|
+ await nextTick();
|
|
|
|
+
|
|
|
|
+ // 检查是否有单词发音数据
|
|
|
|
+ if (data.activeWord && data.activeWord.yinpin) {
|
|
|
|
+ // 延迟500ms确保音频已缓存
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ handlePlayAudio({
|
|
|
|
+ url: data.activeWord.yinpin,
|
|
|
|
+ code: 'auto-play' // 特殊标记,区分自动播放
|
|
|
|
+ });
|
|
|
|
+ }, 500);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
|
|
function goXiangjie() {
|
|
function goXiangjie() {
|
|
-
|
|
|
|
|
|
+
|
|
uni.redirectTo({
|
|
uni.redirectTo({
|
|
url: `/pages/newEnglish/components/xiangjie?levelId=${data.levelId}&typeId=${data.typeId}&subjectId=${data.subjectId}&tipFlag=${data.tipFlag}&wordId=${data.activeId}&youkeZhangId=${data.youkeZhangId}&jieId=${data.jieId}`
|
|
url: `/pages/newEnglish/components/xiangjie?levelId=${data.levelId}&typeId=${data.typeId}&subjectId=${data.subjectId}&tipFlag=${data.tipFlag}&wordId=${data.activeId}&youkeZhangId=${data.youkeZhangId}&jieId=${data.jieId}`
|
|
})
|
|
})
|