quiz algo fix
This commit is contained in:
1 parent
09af058fa1
commit
f3c3b2bbb3
1 file changed
+11
-11
@@ -66,7 +66,7 @@ import TTS from "./TTS.vue";
|
||||
const vCats = ref<string[]>([]);
|
||||
const vChosenCats = ref<string[]>([]);
|
||||
const vList = ref<IVoc[]>([]);
|
||||
const vIndex = ref(0);
|
||||
const vIndex = ref(-1);
|
||||
const vSentAutoplayAudio = ref(true);
|
||||
|
||||
const sentenceDetails = useTemplateRef("sdetails");
|
||||
@@ -124,10 +124,20 @@ function mark(isRight: boolean) {
|
||||
if (sentenceDetails.value) {
|
||||
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) {
|
||||
vList.value = [...vList.value.filter((_, i) => i !== vIndex.value)];
|
||||
vIndex.value = -1;
|
||||
|
||||
if (vList.value.length === 0) {
|
||||
makeVList();
|
||||
return;
|
||||
@@ -143,16 +153,6 @@ function mark(isRight: boolean) {
|
||||
} else {
|
||||
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) {
|
||||
|
||||
Reference in new issue
Block a user