BUG修复

This commit is contained in:
kron
2026-02-10 11:32:53 +08:00
parent 61ff1af4c3
commit 303e1830d3
3 changed files with 31 additions and 43 deletions

View File

@@ -56,16 +56,20 @@ onMounted(() => {
); );
}); });
const validArrows = computed(() => {
return (props.result.details || []).filter(
(arrow) => arrow.x !== -30 && arrow.y !== -30
).length;
});
const getRing = (arrow) => { const getRing = (arrow) => {
if (arrow.ringX) return "X"; if (arrow.ringX) return "X";
return arrow.ring ? arrow.ring + "环" : "-"; return arrow.ring ? arrow.ring : "-";
}; };
const arrows = computed(() => {
const data = new Array(props.total).fill({});
(props.result.details || []).forEach((arrow, index) => {
data[index] = arrow;
});
return data;
});
const validArrows = computed(() => arrows.value.filter((a) => !!a.ring));
</script> </script>
<template> <template>
@@ -74,8 +78,8 @@ const getRing = (arrow) => {
<image :src="tipSrc" mode="widthFix" /> <image :src="tipSrc" mode="widthFix" />
<image src="../static/finish-frame.png" mode="widthFix" /> <image src="../static/finish-frame.png" mode="widthFix" />
<text <text
>完成<text class="gold-text">{{ validArrows }}</text >完成<text class="gold-text">{{ validArrows.length }}</text
>获得<text class="gold-text">{{ validArrows }}</text >获得<text class="gold-text">{{ validArrows.length }}</text
>点经验</text >点经验</text
> >
</view> </view>
@@ -96,8 +100,8 @@ const getRing = (arrow) => {
</view> </view>
<view :style="{ gridTemplateColumns: `repeat(${rowCount}, 1fr)` }"> <view :style="{ gridTemplateColumns: `repeat(${rowCount}, 1fr)` }">
<view v-for="(_, index) in new Array(total).fill(0)" :key="index"> <view v-for="(_, index) in new Array(total).fill(0)" :key="index">
{{ getRing(result.details[index]) {{ getRing(arrows[index])
}}<text v-if="getRing(result.details[index]) !== '-'"></text> }}<text v-if="getRing(arrows[index]) !== '-'"></text>
</view> </view>
</view> </view>
<view> <view>
@@ -160,8 +164,8 @@ const getRing = (arrow) => {
</view> </view>
</ScreenHint> </ScreenHint>
<BowData <BowData
:total="result.details.length" :total="arrows.length"
:arrows="result.details" :arrows="arrows"
:show="showBowData" :show="showBowData"
:onClose="() => (showBowData = false)" :onClose="() => (showBowData = false)"
/> />

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount } from "vue"; import { ref, onMounted, computed, onBeforeUnmount } from "vue";
import { onShow, onLoad, onShareAppMessage } from "@dcloudio/uni-app"; import { onShow, onLoad, onShareAppMessage } 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";
@@ -188,6 +188,18 @@ const removePlayer = async (player) => {
await kickPlayerAPI(roomNumber.value, player.id); 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(() => { onShareAppMessage(() => {
return { return {
title: "邀请您进入房间对战", title: "邀请您进入房间对战",
@@ -373,15 +385,7 @@ onBeforeUnmount(() => {
:removePlayer="removePlayer" :removePlayer="removePlayer"
/> />
<view> <view>
<SButton <SButton :disabled="!canClick" :onClick="getReady">
:disabled="
ready ||
(room.members || []).some(
(m) => !m.userInfo.state && m.userInfo.id !== user.id
)
"
:onClick="getReady"
>
{{ {{
allReady.value allReady.value
? "即将进入对局..." ? "即将进入对局..."

View File

@@ -56,26 +56,6 @@ async function onReceiveMessage(msg) {
} else if (msg.type === MESSAGETYPESV2.BattleEnd) { } else if (msg.type === MESSAGETYPESV2.BattleEnd) {
setTimeout(onOver, 1500); 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() { async function onComplete() {