细节优化
This commit is contained in:
@@ -22,13 +22,15 @@ const power = ref(0);
|
||||
const onReady = async () => {
|
||||
await createPractiseAPI(total);
|
||||
start.value = true;
|
||||
scores.value = [];
|
||||
};
|
||||
|
||||
async function onReceiveMessage(content) {
|
||||
const messages = JSON.parse(content).data.updates || [];
|
||||
messages.forEach((msg) => {
|
||||
if (start.value && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
|
||||
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
|
||||
scores.value.push(msg.target);
|
||||
power.value = msg.target.battery;
|
||||
if (scores.value.length === total) {
|
||||
showScore.value = true;
|
||||
}
|
||||
@@ -59,13 +61,24 @@ onUnmounted(() => {
|
||||
<template>
|
||||
<Container :bgType="1" title="个人单组练习">
|
||||
<view>
|
||||
<ShootProgress :tips="`请连续射箭${total}支`" :total="120" />
|
||||
<ShootProgress
|
||||
:start="start"
|
||||
:tips="`请连续射箭${total}支`"
|
||||
:total="120"
|
||||
/>
|
||||
<BowTarget
|
||||
:totalRound="total"
|
||||
:currentRound="scores.length + 1"
|
||||
:avatar="user.avatarUrl"
|
||||
:power="power"
|
||||
:scores="scores"
|
||||
:tips="
|
||||
!start && scores.length > 0
|
||||
? `本次射程${scores[scores.length - 1].dst / 100}米,${
|
||||
scores[scores.length - 1].dst / 100 >= 5 ? '已' : '未'
|
||||
}达到距离要求`
|
||||
: ''
|
||||
"
|
||||
/>
|
||||
<ScorePanel
|
||||
v-if="start"
|
||||
|
||||
Reference in New Issue
Block a user