bug修复

This commit is contained in:
kron
2026-02-07 11:59:21 +08:00
parent 6101cd80ce
commit 715e614f9d
8 changed files with 22 additions and 22 deletions

View File

@@ -59,26 +59,25 @@ const seats = new Array(props.total).fill(1);
<style scoped> <style scoped>
.players { .players {
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(2, 1fr);
justify-content: flex-start; row-gap: 20rpx;
-moz-column-gap: 20px; column-gap: 25rpx;
column-gap: 14px;
margin-bottom: 20px; margin-bottom: 20px;
font-size: 14px; font-size: 14px;
padding: 0 14px; padding: 0 14px;
} }
.players > view { .players > view {
width: calc(50% - 7px);
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;
color: #fff; color: #fff;
height: 100px; height: 176rpx;
overflow: hidden; overflow: hidden;
} }
.players > view > image:first-child { .players > view > image:first-child {
width: 100%; width: 100%;
height: 100%;
position: absolute; position: absolute;
z-index: -1; z-index: -1;
} }

View File

@@ -96,8 +96,12 @@ const resetTimer = (count) => {
watch( watch(
() => props.start, () => props.start,
(newVal) => { (newVal) => {
if (newVal) resetTimer(props.total); if (newVal) {
else if (timer.value) clearInterval(timer.value); resetTimer(props.total);
} else {
remain.value = 0;
clearInterval(timer.value);
}
}, },
{ {
immediate: true, immediate: true,

View File

@@ -32,7 +32,6 @@ onLoad(async (options) => {
if (!options.battleId) return; if (!options.battleId) return;
const myId = user.value.id; const myId = user.value.id;
const result = await getBattleAPI(options.battleId || "59090720979554304"); const result = await getBattleAPI(options.battleId || "59090720979554304");
console.log("result", result);
data.value = result; data.value = result;
if (result.winTeam) { if (result.winTeam) {
ifWin.value = result.teams[result.winTeam].players.some( ifWin.value = result.teams[result.winTeam].players.some(
@@ -74,7 +73,7 @@ const myTeam = computed(() => {
const checkBowData = () => { const checkBowData = () => {
uni.navigateTo({ uni.navigateTo({
url: `/pages/match-detail?id=${data.value.matchId}`, url: `/pages/match-detail?battleId=${data.value.matchId}`,
}); });
}; };
</script> </script>

View File

@@ -153,7 +153,7 @@ async function onReceiveMessage(message) {
uni.setStorageSync("blue-team", message.teams[1].players || []); uni.setStorageSync("blue-team", message.teams[1].players || []);
uni.setStorageSync("red-team", message.teams[2].players || []); uni.setStorageSync("red-team", message.teams[2].players || []);
uni.redirectTo({ uni.redirectTo({
url: "/pages/team-battle?battleId" + message.matchId, url: "/pages/team-battle?battleId=" + message.matchId,
}); });
} else { } else {
uni.redirectTo({ uni.redirectTo({
@@ -252,7 +252,7 @@ onBeforeUnmount(() => {
</view> </view>
<image src="../static/versus.png" mode="widthFix" /> <image src="../static/versus.png" mode="widthFix" />
<view <view
v-if="!opponent.id" v-if="opponent.id"
class="player" class="player"
:style="{ transform: 'translateY(60px)' }" :style="{ transform: 'translateY(60px)' }"
> >

View File

@@ -26,6 +26,7 @@ const roomID = ref("");
const loading = ref(false); const loading = ref(false);
const enterRoom = debounce(async (number) => { const enterRoom = debounce(async (number) => {
if (loading.value) return;
if (!canEenter(user.value, device.value, online.value)) return; if (!canEenter(user.value, device.value, online.value)) return;
if (game.value.inBattle) { if (game.value.inBattle) {
uni.$showHint(1); uni.$showHint(1);

View File

@@ -15,8 +15,8 @@ const data = ref({
const players = ref([]); const players = ref([]);
onLoad(async (options) => { onLoad(async (options) => {
if (!options.id) return; if (!options.battleId) return;
battleId.value = options.id || "59090720979554304"; battleId.value = options.battleId || "59090720979554304";
const result = await getBattleAPI(battleId.value); const result = await getBattleAPI(battleId.value);
data.value = result; data.value = result;
if (result.mode > 3) { if (result.mode > 3) {
@@ -43,11 +43,11 @@ onLoad(async (options) => {
}); });
const checkBowData = (selected) => { const checkBowData = (selected) => {
if (data.value.way === 1) { if (data.value.mode <= 3) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/team-bow-data?battleId=${battleId.value}&selected=${selected}`, url: `/pages/team-bow-data?battleId=${battleId.value}&selected=${selected}`,
}); });
} else if (data.value.way === 2) { } else {
uni.navigateTo({ uni.navigateTo({
url: `/pages/melee-bow-data?battleId=${battleId.value}`, url: `/pages/melee-bow-data?battleId=${battleId.value}`,
}); });

View File

@@ -30,7 +30,6 @@ const halfTimeTip = ref(false);
const halfRest = ref(false); const halfRest = ref(false);
function recoverData(battleInfo, { force = false } = {}) { function recoverData(battleInfo, { force = false } = {}) {
console.log("battleInfo", battleInfo);
if (battleInfo.way === 1) title.value = "好友约战 - 大乱斗"; if (battleInfo.way === 1) title.value = "好友约战 - 大乱斗";
if (battleInfo.way === 2) title.value = "排位赛 - 大乱斗"; if (battleInfo.way === 2) title.value = "排位赛 - 大乱斗";
players.value = battleInfo.teams[0].players; players.value = battleInfo.teams[0].players;
@@ -82,8 +81,6 @@ function recoverData(battleInfo, { force = false } = {}) {
uni.$emit("update-remain", 90 - remain - 0.2); uni.$emit("update-remain", 90 - remain - 0.2);
}, 200); }, 200);
} }
} else {
uni.$emit("update-remain", battleInfo.readyTime);
} }
} }

View File

@@ -14,8 +14,8 @@ const currentUser = ref({
const players = ref([]); const players = ref([]);
onLoad(async (options) => { onLoad(async (options) => {
if (!options.id) return; if (!options.battleId) return;
const result = await getBattleAPI(options.battleId || "59090720979554304"); const result = await getBattleAPI(options.battleId || "59348111700660224");
players.value = result.resultList.map((item, index) => { players.value = result.resultList.map((item, index) => {
const plist = result.teams[0] ? result.teams[0].players : []; const plist = result.teams[0] ? result.teams[0].players : [];
const p = plist.find((p) => p.id === item.userId); const p = plist.find((p) => p.id === item.userId);