BUG修复
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||
import { ref, onMounted, computed, onBeforeUnmount } from "vue";
|
||||
import { onShow, onLoad, onShareAppMessage } from "@dcloudio/uni-app";
|
||||
import Container from "@/components/Container.vue";
|
||||
import PlayerSeats from "@/components/PlayerSeats.vue";
|
||||
@@ -188,6 +188,18 @@ const removePlayer = async (player) => {
|
||||
await kickPlayerAPI(roomNumber.value, player.id);
|
||||
};
|
||||
|
||||
const canClick = computed(() => {
|
||||
if (ready.value) return false;
|
||||
const { members = [] } = room.value;
|
||||
if (members.length < 2) return false;
|
||||
if (
|
||||
owner.value.id === user.value.id &&
|
||||
members.some((m) => !m.userInfo.state && m.userInfo.id !== owner.value.id)
|
||||
)
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: "邀请您进入房间对战",
|
||||
@@ -373,15 +385,7 @@ onBeforeUnmount(() => {
|
||||
:removePlayer="removePlayer"
|
||||
/>
|
||||
<view>
|
||||
<SButton
|
||||
:disabled="
|
||||
ready ||
|
||||
(room.members || []).some(
|
||||
(m) => !m.userInfo.state && m.userInfo.id !== user.id
|
||||
)
|
||||
"
|
||||
:onClick="getReady"
|
||||
>
|
||||
<SButton :disabled="!canClick" :onClick="getReady">
|
||||
{{
|
||||
allReady.value
|
||||
? "即将进入对局..."
|
||||
|
||||
@@ -56,26 +56,6 @@ async function onReceiveMessage(msg) {
|
||||
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
||||
setTimeout(onOver, 1500);
|
||||
}
|
||||
// messages.forEach((msg) => {
|
||||
// if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
|
||||
// if (scores.value.length < total) {
|
||||
// scores.value.push(msg.target);
|
||||
// currentRound.value += 1;
|
||||
// if (currentRound.value === 4) {
|
||||
// currentRound.value = 1;
|
||||
// }
|
||||
// if (practiseId && scores.value.length === total / 2) {
|
||||
// showGuide.value = true;
|
||||
// setTimeout(() => {
|
||||
// showGuide.value = false;
|
||||
// }, 3000);
|
||||
// }
|
||||
// if (scores.value.length === total) {
|
||||
// setTimeout(onOver, 1500);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
async function onComplete() {
|
||||
|
||||
Reference in New Issue
Block a user