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

View File

@@ -27,7 +27,10 @@ const createRoom = async () => {
if (battleMode.value === 2) size = 10;
if (battleMode.value === 3) size = 4;
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;
step.value = 2;
loading.value = false;

View File

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

View File

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

View File

@@ -101,50 +101,13 @@ const onPractiseLoading = async (page) => {
<text>{{ item.createdAt }}</text>
<image src="../static/back.png" mode="widthFix" />
</view>
<view v-if="item.mode === 1" class="contest-team">
<block v-if="item.bluePlayers[0]">
<view class="player">
<Avatar
:rankLvl="item.bluePlayers[0].rankLvl"
:src="item.bluePlayers[0].avatar"
/>
<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>
<BattleHeader
:players="item.mode === 1 ? [] : item.players"
:blueTeam="item.bluePlayers"
:redTeam="item.redPlayers"
:winner="item.winner"
:showHeader="false"
/>
</view>
</ScrollList>
<ScrollList