This commit is contained in:
kron
2025-06-17 12:50:59 +08:00
parent 447c9e31f5
commit 16c1840cdd
4 changed files with 40 additions and 27 deletions

View File

@@ -6,6 +6,8 @@ import BowTarget from "@/components/BowTarget.vue";
import ScorePanel2 from "@/components/ScorePanel2.vue";
import ScoreResult from "@/components/ScoreResult.vue";
import SButton from "@/components/SButton.vue";
import Avatar from "@/components/Avatar.vue";
import BowPower from "@/components/BowPower.vue";
import { createPractiseAPI } from "@/apis";
import { MESSAGETYPES, roundsName } from "@/constants";
import useStore from "@/store";
@@ -16,8 +18,9 @@ const start = ref(false);
const showScore = ref(false);
const scores = ref([]);
const total = 12;
const currentRound = ref(0);
const practiseResult = ref({});
const power = ref(0);
const power = ref(10);
const onReady = async () => {
await createPractiseAPI(total);
@@ -30,6 +33,10 @@ async function onReceiveMessage(content) {
messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target);
currentRound.value += 1;
if (currentRound.value === 4) {
currentRound.value = 1;
}
power.value = msg.target.battery;
if (scores.value.length === total) {
showScore.value = true;
@@ -65,16 +72,18 @@ onUnmounted(() => {
:tips="`${
!start || scores.length === 12
? ''
: `请开始射箭第${roundsName[Math.ceil((scores.length + 1) / 4)]}轮`
: `请开始射箭第${roundsName[Math.ceil((scores.length + 1) / 3)]}轮`
}`"
:start="start"
:total="120"
/>
<view class="infos">
<Avatar :src="user.avatarUrl" :size="35" />
<BowPower :power="power" />
</view>
<BowTarget
:totalRound="total"
:currentRound="start ? scores.length + 1 : 0"
:avatar="user.avatarUrl"
:power="power"
:totalRound="total / 4"
:currentRound="currentRound"
:scores="scores"
:tips="
!start && scores.length > 0
@@ -99,4 +108,12 @@ onUnmounted(() => {
</Container>
</template>
<style scoped></style>
<style scoped>
.infos {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
padding-top: 15px;
}
</style>