更换事件

This commit is contained in:
kron
2025-08-25 13:47:32 +08:00
parent 7a9439567f
commit 448df06daf
28 changed files with 52 additions and 52 deletions

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import { isGamingAPI, getCurrentGameAPI } from "@/apis"; import { isGamingAPI, getCurrentGameAPI } from "@/apis";
import { debounce } from "@/util"; import { debounce } from "@/util";
@@ -49,7 +49,7 @@ const gameOver = () => {
onMounted(() => { onMounted(() => {
uni.$on("game-over", gameOver); uni.$on("game-over", gameOver);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.$off("game-over", gameOver); uni.$off("game-over", gameOver);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import AppBackground from "@/components/AppBackground.vue"; import AppBackground from "@/components/AppBackground.vue";
import Header from "@/components/Header.vue"; import Header from "@/components/Header.vue";
@@ -55,7 +55,7 @@ onMounted(() => {
const menuBtnInfo = uni.getMenuButtonBoundingClientRect(); const menuBtnInfo = uni.getMenuButtonBoundingClientRect();
capsuleHeight.value = menuBtnInfo.top - 9; capsuleHeight.value = menuBtnInfo.top - 9;
}); });
onUnmounted(() => { onBeforeUnmount(() => {
// const pages = getCurrentPages(); // const pages = getCurrentPages();
// const currentPage = pages[pages.length - 1]; // const currentPage = pages[pages.length - 1];
// uni.setStorageSync("last-route", currentPage.route); // uni.setStorageSync("last-route", currentPage.route);

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted } from "vue";
import { getPointBookConfigAPI } from "@/apis"; import { getPointBookConfigAPI } from "@/apis";
const props = defineProps({ const props = defineProps({
itemIndex: { itemIndex: {

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import HeaderProgress from "@/components/HeaderProgress.vue"; import HeaderProgress from "@/components/HeaderProgress.vue";
const props = defineProps({ const props = defineProps({
@@ -48,7 +48,7 @@ onMounted(() => {
showProgress.value = true; showProgress.value = true;
} }
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.$off("update-header-loading", updateLoading); uni.$off("update-header-loading", updateLoading);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import audioManager from "@/audioManager"; import audioManager from "@/audioManager";
import { MESSAGETYPES } from "@/constants"; import { MESSAGETYPES } from "@/constants";
import useStore from "@/store"; import useStore from "@/store";
@@ -110,7 +110,7 @@ onMounted(() => {
uni.$on("play-sound", playSound); uni.$on("play-sound", playSound);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.$off("update-tips", onUpdateTips); uni.$off("update-tips", onUpdateTips);
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
uni.$off("play-sound", playSound); uni.$off("play-sound", playSound);

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted, watch } from "vue"; import { ref, onMounted, onBeforeUnmount, watch } from "vue";
const props = defineProps({ const props = defineProps({
stopMatch: { stopMatch: {
type: Function, type: Function,
@@ -94,7 +94,7 @@ onMounted(() => {
textStyles.value = getTextStyle(totalTop.value); textStyles.value = getTextStyle(totalTop.value);
}, 40); }, 40);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value); if (timer.value) clearInterval(timer.value);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({ const props = defineProps({
isFinal: { isFinal: {
type: Boolean, type: Boolean,
@@ -40,7 +40,7 @@ function startCount() {
onMounted(() => { onMounted(() => {
startCount(); startCount();
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (tiemr.value) clearInterval(tiemr.value); if (tiemr.value) clearInterval(tiemr.value);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({ const props = defineProps({
rowCount: { rowCount: {
type: Number, type: Number,
@@ -42,7 +42,7 @@ onMounted(() => {
bgIndex.value = bgIndex.value === 0 ? 1 : 0; bgIndex.value = bgIndex.value === 0 ? 1 : 0;
}, 200); }, 200);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (timer.value) { if (timer.value) {
clearInterval(timer.value); clearInterval(timer.value);
} }

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import audioManager from "@/audioManager"; import audioManager from "@/audioManager";
import { MESSAGETYPES } from "@/constants"; import { MESSAGETYPES } from "@/constants";
import useStore from "@/store"; import useStore from "@/store";
@@ -173,7 +173,7 @@ onMounted(() => {
uni.$on("play-sound", playSound); uni.$on("play-sound", playSound);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.$off("update-ramain", updateRemain); uni.$off("update-ramain", updateRemain);
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
uni.$off("play-sound", playSound); uni.$off("play-sound", playSound);

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { RoundGoldImages } from "@/constants"; import { RoundGoldImages } from "@/constants";
const props = defineProps({ const props = defineProps({
tips: { tips: {
@@ -52,7 +52,7 @@ onMounted(() => {
uni.$on("update-ramain", updateRemain); uni.$on("update-ramain", updateRemain);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.$off("update-ramain", updateRemain); uni.$off("update-ramain", updateRemain);
if (timer.value) clearInterval(timer.value); if (timer.value) clearInterval(timer.value);
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({ const props = defineProps({
start: { start: {
type: Boolean, type: Boolean,
@@ -32,7 +32,7 @@ onMounted(() => {
const deviceInfo = uni.getDeviceInfo(); const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios"; isIos.value = deviceInfo.osName === "ios";
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value); if (timer.value) clearInterval(timer.value);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import Guide from "@/components/Guide.vue"; import Guide from "@/components/Guide.vue";
import BowPower from "@/components/BowPower.vue"; import BowPower from "@/components/BowPower.vue";
import Avatar from "@/components/Avatar.vue"; import Avatar from "@/components/Avatar.vue";
@@ -38,7 +38,7 @@ onMounted(() => {
}, 1000); }, 1000);
uni.$on("update-timer", updateTimer); uni.$on("update-timer", updateTimer);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value); if (timer.value) clearInterval(timer.value);
uni.$off("update-timer", updateTimer); uni.$off("update-timer", updateTimer);
}); });
@@ -66,7 +66,7 @@ onMounted(() => {
if (envVersion !== "release") showsimul.value = true; if (envVersion !== "release") showsimul.value = true;
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({ const props = defineProps({
countdown: { countdown: {
type: Number, type: Number,
@@ -26,7 +26,7 @@ onMounted(() => {
}, 300); }, 300);
uni.$on("update-timer", updateTimer); uni.$on("update-timer", updateTimer);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value); if (timer.value) clearInterval(timer.value);
uni.$off("update-timer", updateTimer); uni.$off("update-timer", updateTimer);
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import useStore from "@/store"; import useStore from "@/store";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
const store = useStore(); const store = useStore();
@@ -44,7 +44,7 @@ onMounted(async () => {
}, 1000); }, 1000);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (timer.value) clearTimeout(timer.value); if (timer.value) clearTimeout(timer.value);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted } from "vue";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import Avatar from "@/components/Avatar.vue"; import Avatar from "@/components/Avatar.vue";
import UserUpgrade from "@/components/UserUpgrade.vue"; import UserUpgrade from "@/components/UserUpgrade.vue";

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted, nextTick } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app"; import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import PlayerSeats from "@/components/PlayerSeats.vue"; import PlayerSeats from "@/components/PlayerSeats.vue";
@@ -245,7 +245,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
if (refreshRoomTimer.value) clearInterval(refreshRoomTimer.value); if (refreshRoomTimer.value) clearInterval(refreshRoomTimer.value);
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue"; import Avatar from "@/components/Avatar.vue";
import SButton from "@/components/SButton.vue"; import SButton from "@/components/SButton.vue";
@@ -67,7 +67,7 @@ const toOrderPage = () => {
}); });
}; };
onUnmounted(() => { onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value); if (timer.value) clearInterval(timer.value);
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import Guide from "@/components/Guide.vue"; import Guide from "@/components/Guide.vue";
import SButton from "@/components/SButton.vue"; import SButton from "@/components/SButton.vue";
import Swiper from "@/components/Swiper.vue"; import Swiper from "@/components/Swiper.vue";
@@ -100,7 +100,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app"; import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import Matching from "@/components/Matching.vue"; import Matching from "@/components/Matching.vue";
@@ -59,7 +59,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app"; import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import BowTarget from "@/components/BowTarget.vue"; import BowTarget from "@/components/BowTarget.vue";
@@ -160,7 +160,7 @@ onMounted(() => {
}); });
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import SButton from "@/components/SButton.vue"; import SButton from "@/components/SButton.vue";
import { payOrderAPI, cancelOrderListAPI, getHomeData } from "@/apis"; import { payOrderAPI, cancelOrderListAPI, getHomeData } from "@/apis";
@@ -30,7 +30,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.$off("socket-inbox", onReceiveMessage); uni.$off("socket-inbox", onReceiveMessage);
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted } from "vue";
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import EditOption from "@/components/EditOption.vue"; import EditOption from "@/components/EditOption.vue";

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted } from "vue";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import BowTargetEdit from "@/components/BowTargetEdit.vue"; import BowTargetEdit from "@/components/BowTargetEdit.vue";

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted } from "vue";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import SModal from "@/components/SModal.vue"; import SModal from "@/components/SModal.vue";
import EditOption from "@/components/EditOption.vue"; import EditOption from "@/components/EditOption.vue";

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import ShootProgress from "@/components/ShootProgress.vue"; import ShootProgress from "@/components/ShootProgress.vue";
import BowTarget from "@/components/BowTarget.vue"; import BowTarget from "@/components/BowTarget.vue";
@@ -98,7 +98,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import ShootProgress from "@/components/ShootProgress.vue"; import ShootProgress from "@/components/ShootProgress.vue";
import BowTarget from "@/components/BowTarget.vue"; import BowTarget from "@/components/BowTarget.vue";
@@ -91,7 +91,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted, nextTick } from "vue"; import { ref, onMounted, onBeforeUnmount, nextTick } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app"; import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import BattleHeader from "@/components/BattleHeader.vue"; import BattleHeader from "@/components/BattleHeader.vue";
@@ -271,7 +271,7 @@ onMounted(() => {
}); });
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
}); });

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted, nextTick } from "vue"; import { ref, onMounted, onBeforeUnmount, nextTick } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app"; import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import BattleHeader from "@/components/BattleHeader.vue"; import BattleHeader from "@/components/BattleHeader.vue";
@@ -270,7 +270,7 @@ onMounted(() => {
}); });
uni.$on("socket-inbox", onReceiveMessage); uni.$on("socket-inbox", onReceiveMessage);
}); });
onUnmounted(() => { onBeforeUnmount(() => {
uni.setKeepScreenOn({ uni.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
}); });