bug 修复

This commit is contained in:
kron
2025-08-21 18:32:28 +08:00
parent 4347dea41e
commit 17e463a884
5 changed files with 25 additions and 58 deletions

View File

@@ -98,13 +98,13 @@ watch(
} }
); );
function calcRealX(num) { function calcRealX(num, offset = 3.4) {
const len = 20.4 + num; const len = 20.4 + num;
return `calc(${(len / 40.8) * 100 - 1.5}%)`; return `calc(${(len / 40.8) * 100 - offset / 2}%)`;
} }
function calcRealY(num) { function calcRealY(num, offset = 3.4) {
const len = num < 0 ? Math.abs(num) + 20.4 : 20.4 - num; const len = num < 0 ? Math.abs(num) + 20.4 : 20.4 - num;
return `calc(${(len / 40.8) * 100 - 1.5}%)`; return `calc(${(len / 40.8) * 100 - offset / 2}%)`;
} }
const simulShoot = async () => { const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId); if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
@@ -136,8 +136,8 @@ onMounted(() => {
v-if="latestOne && user.id === latestOne.playerId" v-if="latestOne && user.id === latestOne.playerId"
class="e-value fade-in-out" class="e-value fade-in-out"
:style="{ :style="{
left: calcRealX(latestOne.ring ? latestOne.x : 0, 66), left: calcRealX(latestOne.ring ? latestOne.x : 0, 20),
top: calcRealY(latestOne.ring ? latestOne.y : 0, 150), top: calcRealY(latestOne.ring ? latestOne.y : 0, 40),
}" }"
> >
经验 +1 经验 +1
@@ -146,8 +146,8 @@ onMounted(() => {
v-if="latestOne" v-if="latestOne"
class="round-tip fade-in-out" class="round-tip fade-in-out"
:style="{ :style="{
left: calcRealX(latestOne.ring ? latestOne.x : 0, 100), left: calcRealX(latestOne.ring ? latestOne.x : 0, 28),
top: calcRealY(latestOne.ring ? latestOne.y : 0, 100), top: calcRealY(latestOne.ring ? latestOne.y : 0, 28),
}" }"
>{{ latestOne.ring || "未上靶" >{{ latestOne.ring || "未上靶"
}}<text v-if="latestOne.ring"></text></view }}<text v-if="latestOne.ring"></text></view
@@ -246,10 +246,10 @@ onMounted(() => {
} }
.hit { .hit {
position: absolute; position: absolute;
width: 3%; width: 3.4%;
height: 3%; height: 3.4%;
min-width: 3%; min-width: 3.4%;
min-height: 3%; min-height: 3.4%;
border-radius: 50%; border-radius: 50%;
border: 1px solid #fff; border: 1px solid #fff;
z-index: 1; z-index: 1;

View File

@@ -27,7 +27,10 @@ const createRoom = async () => {
if (battleMode.value === 2) size = 10; if (battleMode.value === 2) size = 10;
if (battleMode.value === 3) size = 4; if (battleMode.value === 3) size = 4;
if (battleMode.value === 4) size = 6; if (battleMode.value === 4) size = 6;
const result = await createRoomAPI(battleMode.value === 2 ? 2 : 1, size); const result = await createRoomAPI(
battleMode.value === 2 ? 2 : 1,
battleMode.value === 2 ? 10 : size
);
if (result.number) roomNumber.value = result.number; if (result.number) roomNumber.value = result.number;
step.value = 2; step.value = 2;
loading.value = false; loading.value = false;

View File

@@ -65,7 +65,7 @@ const seats = new Array(props.total).fill(1);
} }
.players > view > image:nth-child(2) { .players > view > image:nth-child(2) {
width: 40px; width: 40px;
height: 40px; min-height: 40px;
margin: 0 10px; margin: 0 10px;
border: 1px solid #fff; border: 1px solid #fff;
border-radius: 50%; border-radius: 50%;

View File

@@ -34,6 +34,7 @@ const refreshRoomTimer = ref(null);
async function refreshRoomData() { async function refreshRoomData() {
if (!roomNumber.value) return; if (!roomNumber.value) return;
const result = await getRoomAPI(roomNumber.value); const result = await getRoomAPI(roomNumber.value);
if (result.started) return;
room.value = result; room.value = result;
battleType.value = result.battleType; battleType.value = result.battleType;
(result.members || []).some((m) => { (result.members || []).some((m) => {

View File

@@ -101,50 +101,13 @@ const onPractiseLoading = async (page) => {
<text>{{ item.createdAt }}</text> <text>{{ item.createdAt }}</text>
<image src="../static/back.png" mode="widthFix" /> <image src="../static/back.png" mode="widthFix" />
</view> </view>
<view v-if="item.mode === 1" class="contest-team"> <BattleHeader
<block v-if="item.bluePlayers[0]"> :players="item.mode === 1 ? [] : item.players"
<view class="player"> :blueTeam="item.bluePlayers"
<Avatar :redTeam="item.redPlayers"
:rankLvl="item.bluePlayers[0].rankLvl" :winner="item.winner"
:src="item.bluePlayers[0].avatar" :showHeader="false"
/> />
<text>{{ item.bluePlayers[0].name }}</text>
<image
v-if="item.winner === 1"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view>
</block>
<block v-if="item.redPlayers[0]">
<view class="player">
<Avatar
:rankLvl="item.redPlayers[0].rankLvl"
:src="item.redPlayers[0].avatar"
/>
<text>{{ item.redPlayers[0].name }}</text>
<image
v-if="item.winner === 0"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view>
</block>
</view>
<view v-if="item.mode === 2" class="contest-melee">
<view
class="player"
v-for="(p, index2) in item.players"
:key="index2"
:style="{
width: `${Math.max(100 / item.players.length, 18)}vw`,
backgroundColor: meleeAvatarColors[index2],
}"
>
<Avatar :rank="index2 + 1" :src="p.avatar" />
<text>{{ p.name }}</text>
</view>
</view>
</view> </view>
</ScrollList> </ScrollList>
<ScrollList <ScrollList