From f4be7c597dd5572f4d00cb6213a7c4a0bac448ec Mon Sep 17 00:00:00 2001 From: kron Date: Sun, 15 Jun 2025 22:38:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index.vue | 18 ++++++++++++++---- src/pages/ranking.vue | 14 +++++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/pages/index.vue b/src/pages/index.vue index 89810a8..dc800fa 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -18,11 +18,21 @@ const isIos = ref(true); const toPage = (path) => { if (!user.value.id) { showModal.value = true; - } else { - uni.navigateTo({ - url: path, - }); + return; } + if ( + "/pages/first-try,/pages/practise,/pages/friend-battle".indexOf(path) !== -1 + ) { + if (!device.value.deviceId) { + return uni.showToast({ + title: "请先绑定设备", + icon: "none", + }); + } + } + uni.navigateTo({ + url: path, + }); }; onMounted(async () => { diff --git a/src/pages/ranking.vue b/src/pages/ranking.vue index 2b53cf5..2e59d45 100644 --- a/src/pages/ranking.vue +++ b/src/pages/ranking.vue @@ -5,7 +5,7 @@ import { ref } from "vue"; import useStore from "@/store"; import { storeToRefs } from "pinia"; const store = useStore(); -const { user } = storeToRefs(store); +const { user, device } = storeToRefs(store); const selectedIndex = ref(0); @@ -14,12 +14,24 @@ const handleSelect = (index) => { }; const toTeamMatchPage = (gameType, teamSize) => { + if (!device.value.deviceId) { + return uni.showToast({ + title: "请先绑定设备", + icon: "none", + }); + } uni.navigateTo({ url: `/pages/team-match?gameType=${gameType}&teamSize=${teamSize}`, }); }; const toMeleeMatchPage = (gameType, teamSize) => { + if (!device.value.deviceId) { + return uni.showToast({ + title: "请先绑定设备", + icon: "none", + }); + } uni.navigateTo({ url: `/pages/melee-match?gameType=${gameType}&teamSize=${teamSize}`, });