排位房间内容完善
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { getGameAPI } from "@/apis";
|
||||
|
||||
const battleId = ref("");
|
||||
|
||||
@@ -10,6 +11,10 @@ onLoad((options) => {
|
||||
function exit() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
onMounted(async () => {
|
||||
const result = await getGameAPI("BATTLE-1749121128909437828-799");
|
||||
conosle.log(1111, result);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -50,7 +55,7 @@ function exit() {
|
||||
.tag {
|
||||
position: absolute;
|
||||
width: 32vw;
|
||||
top: 4%;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
.container > view {
|
||||
|
||||
@@ -6,14 +6,10 @@ import BowTarget from "@/components/BowTarget.vue";
|
||||
import ShootProgress from "@/components/ShootProgress.vue";
|
||||
import PlayersRow from "@/components/PlayersRow.vue";
|
||||
import Timer from "@/components/Timer.vue";
|
||||
import PlayerScore from "@/components/PlayerScore.vue";
|
||||
import BattleFooter from "@/components/BattleFooter.vue";
|
||||
import SButton from "@/components/SButton.vue";
|
||||
import { matchGameAPI, readyGameAPI } from "@/apis";
|
||||
import { MESSAGETYPES, roundsName } from "@/constants";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { user } = storeToRefs(store);
|
||||
const gameType = ref(0);
|
||||
const teamSize = ref(0);
|
||||
const matching = ref(false);
|
||||
@@ -29,6 +25,12 @@ const currentShooterId = ref(0);
|
||||
const tips = ref("即将开始...");
|
||||
const seq = ref(0);
|
||||
const timerSeq = ref(0);
|
||||
const roundResults = ref([
|
||||
// {
|
||||
// blueArrows: [{ ring: 2 }, { ring: 2 }],
|
||||
// redArrows: [{ ring: 2 }, { ring: 3 }],
|
||||
// },
|
||||
]);
|
||||
|
||||
onLoad((options) => {
|
||||
gameType.value = options.gameType;
|
||||
@@ -91,14 +93,13 @@ async function onReceiveMessage(content) {
|
||||
scores.value = [msg.target];
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
|
||||
const result = msg.preRoundResult;
|
||||
scores.value = [];
|
||||
currentShooterId.value = 0;
|
||||
if (
|
||||
msg.preRoundResult.currentRound > 0 &&
|
||||
msg.preRoundResult.currentRound < totalRounds.value
|
||||
) {
|
||||
if (result.currentRound > 0 && result.currentRound < totalRounds.value) {
|
||||
// 开始下一轮;
|
||||
currentRound.value = msg.preRoundResult.currentRound + 1;
|
||||
roundResults.value = result.roundResults;
|
||||
currentRound.value = result.currentRound + 1;
|
||||
}
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
@@ -136,19 +137,16 @@ onUnmounted(() => {
|
||||
:totalRound="totalRounds"
|
||||
:scores="scores"
|
||||
/>
|
||||
<!-- <PlayerScore
|
||||
name="某某选手"
|
||||
avatar="../static/avatar.png"
|
||||
:scores="[1, 4, 7, 4, 2, 2, 4, 4, 5, 8]"
|
||||
/> -->
|
||||
<BattleFooter
|
||||
v-if="roundResults.length > 0"
|
||||
:roundResults="roundResults"
|
||||
/>
|
||||
<Timer :seq="timerSeq" :callBack="readyToGo" />
|
||||
</view>
|
||||
<view class="footer">
|
||||
<SButton v-if="!battleId" :onClick="matching ? stopMatch : startMatch">{{
|
||||
matching ? "取消匹配" : "开始匹配"
|
||||
}}</SButton>
|
||||
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
||||
</view>
|
||||
<SButton v-if="!battleId" :onClick="matching ? stopMatch : startMatch">{{
|
||||
matching ? "取消匹配" : "开始匹配"
|
||||
}}</SButton>
|
||||
<SButton v-if="battleId && !start" :onClick="readyToGo">准备完毕</SButton>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
@@ -156,7 +154,4 @@ onUnmounted(() => {
|
||||
.container {
|
||||
width: 100%;
|
||||
}
|
||||
.footer {
|
||||
margin: 25px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user