更换测距页面

This commit is contained in:
kron
2025-07-05 14:52:41 +08:00
parent 054bf2ef21
commit 1c70471959
10 changed files with 224 additions and 179 deletions

View File

@@ -10,8 +10,9 @@ import ScorePanel from "@/components/ScorePanel.vue";
import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue";
import BowPower from "@/components/BowPower.vue";
import TestDistance from "@/components/TestDistance.vue";
import { createPractiseAPI } from "@/apis";
import { generateCanvasImage, checkConnection } from "@/util";
import { generateCanvasImage } from "@/util";
import { MESSAGETYPES } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
@@ -33,7 +34,7 @@ const title = ref("新手试炼场");
const start = ref(false);
const practiseResult = ref({});
const power = ref(0);
const btnDisabled = ref(false);
// const btnDisabled = ref(false);
const practiseId = ref("");
const createPractise = async (arrows) => {
@@ -47,9 +48,9 @@ async function onReceiveMessage(messages = []) {
scores.value.push(msg.target);
power.value = msg.target.battery;
// if (step.value === 2 && msg.target.dst / 100 > 5) {
if (step.value === 2 && msg.target.dst > 5) {
btnDisabled.value = false;
}
// if (step.value === 2 && msg.target.dst > 5) {
// btnDisabled.value = false;
// }
}
if (msg.constructor === MESSAGETYPES.ShootSyncMePracticeID) {
if (practiseId.value && practiseId.value === msg.practice.id) {
@@ -72,7 +73,6 @@ async function onReceiveMessage(messages = []) {
}
onMounted(() => {
checkConnection();
uni.$on("socket-inbox", onReceiveMessage);
});
@@ -85,7 +85,7 @@ const nextStep = async () => {
step.value = 1;
title.value = "凹造型";
} else if (step.value === 1) {
btnDisabled.value = true;
// btnDisabled.value = true;
step.value = 2;
title.value = "感知距离";
} else if (step.value === 2) {
@@ -201,29 +201,20 @@ const onClose = () => {
:total="100"
:start="start"
/>
<TestDistance v-if="step === 2" :guide="false" />
<view
class="infos"
v-if="step === 2 || step === 4"
v-if="step === 4"
:style="{ marginBottom: step === 2 ? '40px' : '0' }"
>
<text v-if="step === 2">大人请射箭</text>
<Avatar v-if="step === 4" :src="user.avatar" :size="35" />
<Avatar :src="user.avatar" :size="35" />
<BowPower :power="power" />
</view>
<BowTarget
v-if="step === 4"
:start="start"
:avatar="step === 2 ? user.avatar : ''"
:debug="step === 2"
v-if="step === 2 || step === 4"
:currentRound="step === 4 ? scores.length : 0"
:totalRound="step === 4 ? total : 0"
:tips="
step === 2 && scores.length > 0
? `本次射程${scores[scores.length - 1].dst / 100}米,${
scores[scores.length - 1].dst / 100 >= 5 ? '已' : '未'
}达到距离要求`
: ''
"
:scores="scores"
/>
<ScorePanel
@@ -245,7 +236,7 @@ const onClose = () => {
<canvas class="share-canvas" canvas-id="shareCanvas"></canvas>
</view>
<view :style="{ marginBottom: '20px' }">
<SButton v-if="step !== 4" :onClick="nextStep" :disabled="btnDisabled">{{
<SButton v-if="step !== 4" :onClick="nextStep">{{
stepButtonTexts[step]
}}</SButton>
</view>