完成耐力赛接口调试

This commit is contained in:
kron
2025-05-29 23:56:42 +08:00
parent 9db31ce664
commit 57b25e7805
3 changed files with 50 additions and 17 deletions

View File

@@ -13,10 +13,10 @@ import websocket from "@/websocket";
const start = ref(false);
const showScore = ref(false);
const scores = ref([]);
const total = 12;
const onReady = async () => {
const result = await createPractiseAPI(12);
console.log("result", result);
const result = await createPractiseAPI(total);
start.value = true;
const token = uni.getStorageSync("token");
@@ -25,8 +25,7 @@ const onReady = async () => {
messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target);
console.log("msg:", msg.target);
if (scores.value.length === 12) {
if (scores.value.length === total) {
showScore.value = true;
websocket.closeWebSocket();
}
@@ -46,7 +45,7 @@ onUnmounted(() => {
<Header title="个人单组练习" />
<ShootProgress tips="请开始射箭第一轮" :start="start" :total="120" />
<BowTarget
:totalRound="12"
:totalRound="total"
:currentRound="scores.length + 1"
avatar="../static/avatar.png"
:power="45"
@@ -54,7 +53,7 @@ onUnmounted(() => {
/>
<ScorePanel2 v-if="start" :scores="scores.map((s) => s.ring)" />
<ScoreResult
:total="12"
:total="total"
:rowCount="6"
:show="showScore"
:onClose="() => (showScore = false)"