quiz algo fix

This commit is contained in:
polv committed 2026-07-05 13:49:05 +07:00
1 parent 09af058fa1
commit f3c3b2bbb3
1 file changed
+11 -11
+11 -11
View File
@@ -66,7 +66,7 @@ import TTS from "./TTS.vue";
const vCats = ref<string[]>([]); const vCats = ref<string[]>([]);
const vChosenCats = ref<string[]>([]); const vChosenCats = ref<string[]>([]);
const vList = ref<IVoc[]>([]); const vList = ref<IVoc[]>([]);
const vIndex = ref(0); const vIndex = ref(-1);
const vSentAutoplayAudio = ref(true); const vSentAutoplayAudio = ref(true);
const sentenceDetails = useTemplateRef("sdetails"); const sentenceDetails = useTemplateRef("sdetails");
@@ -124,10 +124,20 @@ function mark(isRight: boolean) {
if (sentenceDetails.value) { if (sentenceDetails.value) {
sentenceDetails.value.open = false; sentenceDetails.value.open = false;
} }
if (vSentAutoplayAudio.value) {
if (stts.value) {
stts.value.playAudio();
} else if (example.value?.audio) {
new Audio(example.value.audio).play();
}
}
}); });
if (isRight) { if (isRight) {
vList.value = [...vList.value.filter((_, i) => i !== vIndex.value)]; vList.value = [...vList.value.filter((_, i) => i !== vIndex.value)];
vIndex.value = -1;
if (vList.value.length === 0) { if (vList.value.length === 0) {
makeVList(); makeVList();
return; return;
@@ -143,16 +153,6 @@ function mark(isRight: boolean) {
} else { } else {
vIndex.value = i; vIndex.value = i;
} }
if (vSentAutoplayAudio.value) {
nextTick(() => {
if (stts.value) {
stts.value.playAudio();
} else if (example.value?.audio) {
new Audio(example.value.audio).play();
}
});
}
} }
function updateCats(cat: string) { function updateCats(cat: string) {