This commit is contained in:
kron
2025-06-20 01:47:57 +08:00
parent 6d063d56ab
commit bfdd76e15b
4 changed files with 58 additions and 21 deletions

View File

@@ -77,7 +77,7 @@ function calcRealY(num) {
<template> <template>
<view class="container"> <view class="container">
<view class="header"> <view class="header" v-if="debug || totalRound > 0 || power">
<text v-if="debug" class="header-tips">大人请射箭</text> <text v-if="debug" class="header-tips">大人请射箭</text>
<text v-if="totalRound > 0" class="round-count">{{ <text v-if="totalRound > 0" class="round-count">{{
(currentRound > totalRound ? totalRound : currentRound) + (currentRound > totalRound ? totalRound : currentRound) +
@@ -127,7 +127,6 @@ function calcRealY(num) {
}" }"
/> />
</block> </block>
<image src="../static/bow-target.png" mode="widthFix" /> <image src="../static/bow-target.png" mode="widthFix" />
</view> </view>
<view v-if="avatar" class="footer"> <view v-if="avatar" class="footer">
@@ -206,7 +205,7 @@ function calcRealY(num) {
} }
.footer > image { .footer > image {
width: 40px; width: 40px;
height: 40px; min-height: 40px;
border-radius: 50%; border-radius: 50%;
} }
.container > text { .container > text {

View File

@@ -7,6 +7,7 @@ import { storeToRefs } from "pinia";
const store = useStore(); const store = useStore();
const { user } = storeToRefs(store); const { user } = storeToRefs(store);
const scores = ref([]); const scores = ref([]);
const currentUser = ref({});
const props = defineProps({ const props = defineProps({
show: { show: {
type: Boolean, type: Boolean,
@@ -25,12 +26,20 @@ watch(
() => props.data, () => props.data,
(value) => { (value) => {
const mine = value.players.find((p) => p.playerId === user.value.id); const mine = value.players.find((p) => p.playerId === user.value.id);
currentUser.value = mine;
if (mine && mine.arrowHistory) { if (mine && mine.arrowHistory) {
scores.value = mine.arrowHistory; scores.value = mine.arrowHistory;
} }
}, },
{ deep: true, immediate: true } { deep: true, immediate: true }
); );
const onSelect = (userId) => {
const user = props.data.players.find((p) => p.playerId === userId);
currentUser.value = user;
if (user && user.arrowHistory) {
scores.value = user.arrowHistory;
}
};
</script> </script>
<template> <template>
@@ -42,7 +51,11 @@ watch(
</view> </view>
</view> </view>
<view class="rank-rows"> <view class="rank-rows">
<view v-for="(player, index) in data.players" :key="index"> <view
v-for="(player, index) in data.players"
:key="index"
@click="() => onSelect(player.playerId)"
>
<image v-if="index === 0" src="../static/champ1.png" mode="widthFix" /> <image v-if="index === 0" src="../static/champ1.png" mode="widthFix" />
<image v-if="index === 1" src="../static/champ2.png" mode="widthFix" /> <image v-if="index === 1" src="../static/champ2.png" mode="widthFix" />
<image v-if="index === 2" src="../static/champ3.png" mode="widthFix" /> <image v-if="index === 2" src="../static/champ3.png" mode="widthFix" />
@@ -61,7 +74,11 @@ watch(
</view> </view>
</view> </view>
<view :style="{ width: '95%' }"> <view :style="{ width: '95%' }">
<BowTarget :scores="scores" :showLatestArrow="false" /> <BowTarget
:scores="scores"
:showLatestArrow="false"
:avatar="currentUser.avatar"
/>
</view> </view>
<view class="score-text" <view class="score-text"
><text :style="{ color: '#fed847' }">12</text>支箭<text ><text :style="{ color: '#fed847' }">12</text>支箭<text

View File

@@ -96,7 +96,7 @@ const handleLogin = () => {
type="nickname" type="nickname"
class="nickname-input" class="nickname-input"
placeholder="请输入昵称" placeholder="请输入昵称"
placeholder-style="color: #ccc" placeholder-style="color: #fff9"
@change="onNicknameChange" @change="onNicknameChange"
@blur="onNicknameBlur" @blur="onNicknameBlur"
/> />
@@ -136,7 +136,9 @@ const handleLogin = () => {
width: 80%; width: 80%;
display: flex; display: flex;
align-items: center; align-items: center;
margin: 20px 0; margin-bottom: 20px;
border-bottom: 1px solid #fff3;
padding: 20px 2px;
} }
.avatar { .avatar {
margin: 0; margin: 0;
@@ -144,14 +146,15 @@ const handleLogin = () => {
.avatar > text, .avatar > text,
.nickname > text { .nickname > text {
width: 20%; width: 20%;
margin-right: 10px;
color: #fff9; color: #fff9;
font-size: 14px;
}
.avatar > button > text {
color: #fff9;
font-size: 14px;
} }
.nickname > input { .nickname > input {
flex: 1; flex: 1;
background-color: #fff;
border-radius: 20px;
padding: 7px 15px;
font-size: 14px; font-size: 14px;
color: #000; color: #000;
} }
@@ -169,13 +172,13 @@ const handleLogin = () => {
color: #8a8a8a; color: #8a8a8a;
} }
.protocol > image { .protocol > image {
width: 18px; width: 16px;
height: 18px; height: 16px;
margin-right: 10px; margin-right: 10px;
} }
.protocol > view:first-child { .protocol > view:first-child {
width: 16px; width: 14px;
height: 16px; height: 14px;
border-radius: 50%; border-radius: 50%;
margin-right: 10px; margin-right: 10px;
border: 1px solid #fff; border: 1px solid #fff;

View File

@@ -6,13 +6,15 @@ import BattleHeader from "@/components/BattleHeader.vue";
import Avatar from "@/components/Avatar.vue"; import Avatar from "@/components/Avatar.vue";
import TeamResult from "@/components/TeamResult.vue"; import TeamResult from "@/components/TeamResult.vue";
import MeleeResult from "@/components/MeleeResult.vue"; import MeleeResult from "@/components/MeleeResult.vue";
import PlayerScore from "@/components/PlayerScore.vue";
import { getGameAPI } from "@/apis"; import { getGameAPI } from "@/apis";
const blueTeam = ref([]); const blueTeam = ref([]);
const redTeam = ref([]); const redTeam = ref([]);
const players = ref([]);
const roundsData = ref([]); const roundsData = ref([]);
const data = ref({}); const data = ref({
players: [],
});
const show = ref(false); const show = ref(false);
onLoad(async (options) => { onLoad(async (options) => {
@@ -46,8 +48,6 @@ onLoad(async (options) => {
}, },
}); });
}); });
} else if (result.mode === 2) {
players.value = result.players;
} }
} }
}); });
@@ -60,7 +60,7 @@ onLoad(async (options) => {
:winner="data.winner" :winner="data.winner"
:blueTeam="blueTeam" :blueTeam="blueTeam"
:redTeam="redTeam" :redTeam="redTeam"
:players="players" :players="data.players"
:showRank="true" :showRank="true"
/> />
<!-- <view class="score-header"> <!-- <view class="score-header">
@@ -87,7 +87,25 @@ onLoad(async (options) => {
<text>7</text> <text>7</text>
</view> </view>
</view> --> </view> -->
<view v-if="players.length" @click="() => (show = true)">查看靶纸</view> <view
v-if="data.players && data.players.length"
class="score-header"
:style="{ border: 'none', padding: '5px 15px' }"
>
<text>大乱斗</text>
<view @click="() => (show = true)">
<text>查看靶纸</text>
<image src="../static/back.png" mode="widthFix" />
</view>
</view>
<PlayerScore
v-if="data.players && data.players.length"
v-for="(player, index) in data.players"
:key="index"
:name="player.name"
:avatar="player.avatar"
:scores="player.arrowHistory"
/>
<view <view
v-for="(round, index) in roundsData" v-for="(round, index) in roundsData"
:key="index" :key="index"