添加退出当前页面关闭声音

This commit is contained in:
kron
2025-11-13 11:58:16 +08:00
parent cfc9912a4a
commit 24996a4b35
6 changed files with 10 additions and 2 deletions

View File

@@ -67,7 +67,6 @@ const ringText = (ring) => {
<style scoped> <style scoped>
.container { .container {
min-height: 150rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-end; justify-content: flex-end;

View File

@@ -12,6 +12,7 @@ import Avatar from "@/components/Avatar.vue";
import BowPower from "@/components/BowPower.vue"; import BowPower from "@/components/BowPower.vue";
import TestDistance from "@/components/TestDistance.vue"; import TestDistance from "@/components/TestDistance.vue";
import BubbleTip from "@/components/BubbleTip.vue"; import BubbleTip from "@/components/BubbleTip.vue";
import audioManager from "@/audioManager";
import { createPractiseAPI } from "@/apis"; import { createPractiseAPI } from "@/apis";
import { generateCanvasImage, wxShare, debounce } from "@/util"; import { generateCanvasImage, wxShare, debounce } from "@/util";
import { MESSAGETYPES } from "@/constants"; import { MESSAGETYPES } from "@/constants";
@@ -104,6 +105,7 @@ onBeforeUnmount(() => {
}); });
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
uni.$off("share-image", onClickShare); uni.$off("share-image", onClickShare);
audioManager.stopAll();
}); });
const nextStep = async () => { const nextStep = async () => {

View File

@@ -10,6 +10,7 @@ import SButton from "@/components/SButton.vue";
import Avatar from "@/components/Avatar.vue"; import Avatar from "@/components/Avatar.vue";
import ScreenHint from "@/components/ScreenHint.vue"; import ScreenHint from "@/components/ScreenHint.vue";
import TestDistance from "@/components/TestDistance.vue"; import TestDistance from "@/components/TestDistance.vue";
import audioManager from "@/audioManager";
import { getCurrentGameAPI, laserCloseAPI } from "@/apis"; import { getCurrentGameAPI, laserCloseAPI } from "@/apis";
import { isGameEnded } from "@/util"; import { isGameEnded } from "@/util";
import { MESSAGETYPES } from "@/constants"; import { MESSAGETYPES } from "@/constants";
@@ -167,6 +168,7 @@ onBeforeUnmount(() => {
keepScreenOn: false, keepScreenOn: false,
}); });
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
audioManager.stopAll();
}); });
const refreshTimer = ref(null); const refreshTimer = ref(null);
onShow(async () => { onShow(async () => {

View File

@@ -10,6 +10,7 @@ import Avatar from "@/components/Avatar.vue";
import BowPower from "@/components/BowPower.vue"; import BowPower from "@/components/BowPower.vue";
import TestDistance from "@/components/TestDistance.vue"; import TestDistance from "@/components/TestDistance.vue";
import BubbleTip from "@/components/BubbleTip.vue"; import BubbleTip from "@/components/BubbleTip.vue";
import audioManager from "@/audioManager";
import { createPractiseAPI } from "@/apis"; import { createPractiseAPI } from "@/apis";
import { generateCanvasImage, wxShare, debounce } from "@/util"; import { generateCanvasImage, wxShare, debounce } from "@/util";
import { MESSAGETYPES, roundsName } from "@/constants"; import { MESSAGETYPES, roundsName } from "@/constants";
@@ -24,6 +25,7 @@ const currentRound = ref(0);
const practiseResult = ref({}); const practiseResult = ref({});
const practiseId = ref(""); const practiseId = ref("");
const showGuide = ref(false); const showGuide = ref(false);
const tips = ref("");
const onReady = async () => { const onReady = async () => {
const result = await createPractiseAPI(total); const result = await createPractiseAPI(total);
@@ -102,6 +104,7 @@ onBeforeUnmount(() => {
}); });
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
uni.$off("share-image", onClickShare); uni.$off("share-image", onClickShare);
audioManager.stopAll();
}); });
</script> </script>
@@ -119,7 +122,6 @@ onBeforeUnmount(() => {
}轮` }轮`
}`" }`"
:start="start" :start="start"
:total="120"
/> />
<view class="user-row"> <view class="user-row">
<Avatar :src="user.avatar" :size="35" /> <Avatar :src="user.avatar" :size="35" />

View File

@@ -10,6 +10,7 @@ import Avatar from "@/components/Avatar.vue";
import BowPower from "@/components/BowPower.vue"; import BowPower from "@/components/BowPower.vue";
import TestDistance from "@/components/TestDistance.vue"; import TestDistance from "@/components/TestDistance.vue";
import BubbleTip from "@/components/BubbleTip.vue"; import BubbleTip from "@/components/BubbleTip.vue";
import audioManager from "@/audioManager";
import { createPractiseAPI } from "@/apis"; import { createPractiseAPI } from "@/apis";
import { generateCanvasImage, wxShare, debounce } from "@/util"; import { generateCanvasImage, wxShare, debounce } from "@/util";
import { MESSAGETYPES } from "@/constants"; import { MESSAGETYPES } from "@/constants";
@@ -95,6 +96,7 @@ onBeforeUnmount(() => {
}); });
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
uni.$off("share-image", onClickShare); uni.$off("share-image", onClickShare);
audioManager.stopAll();
}); });
</script> </script>

View File

@@ -297,6 +297,7 @@ onBeforeUnmount(() => {
keepScreenOn: false, keepScreenOn: false,
}); });
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
audioManager.stopAll();
}); });
const refreshTimer = ref(null); const refreshTimer = ref(null);
onShow(async () => { onShow(async () => {