fix: 个人练习报环完成之后再弹练习结果弹窗

(cherry picked from commit a6becf67ff)
This commit is contained in:
2026-05-07 18:30:46 +08:00
parent 8c66ef78c6
commit d1bd036351
2 changed files with 10 additions and 2 deletions

View File

@@ -139,7 +139,7 @@ async function onReceiveMessage(msg) {
halfTime.value = false;
audioManager.play("比赛开始");
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
audioManager.play("比赛结束");
audioManager.play("比赛结束", false);
} else if (msg.type === MESSAGETYPESV2.ShootResult) {
let arrow = {};
if (msg.details && Array.isArray(msg.details)) {

View File

@@ -59,7 +59,7 @@ async function onReceiveMessage(msg) {
if (msg.type === MESSAGETYPESV2.ShootResult) {
scores.value = msg.details;
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
setTimeout(onOver, 1500);
// setTimeout(onOver, 1500);
}
}
@@ -84,6 +84,12 @@ const onClickShare = debounce(async () => {
await wxShare("shareCanvas");
});
function onAudioEnded(s) {
if (s.indexOf("比赛结束") >= 0) {
onOver()
}
}
onMounted(async () => {
// audioManager.play("第一轮");
uni.setKeepScreenOn({
@@ -91,6 +97,7 @@ onMounted(async () => {
});
uni.$on("socket-inbox", onReceiveMessage);
uni.$on("share-image", onClickShare);
uni.$on("audioEnded", onAudioEnded);
const result = await createPractiseAPI(total, 120, targetType.value);
if (result) practiseId.value = result.id;
});
@@ -101,6 +108,7 @@ onBeforeUnmount(() => {
});
uni.$off("socket-inbox", onReceiveMessage);
uni.$off("share-image", onClickShare);
uni.$off("audioEnded", onAudioEnded);
audioManager.stopAll();
endPractiseAPI();
});