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