更换测距页面

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

@@ -8,8 +8,9 @@ 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 TestDistance from "@/components/TestDistance.vue";
import { createPractiseAPI, getHomeData } from "@/apis";
import { generateCanvasImage, checkConnection } from "@/util";
import { generateCanvasImage } from "@/util";
import { MESSAGETYPES } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
@@ -74,7 +75,6 @@ async function onComplete() {
}
onMounted(() => {
checkConnection();
uni.$on("socket-inbox", onReceiveMessage);
});
@@ -86,47 +86,43 @@ onUnmounted(() => {
<template>
<Container :bgType="1" title="个人单组练习">
<view>
<ShootProgress
:start="start"
:tips="`请连续射箭${total}支`"
:total="120"
/>
<view class="infos">
<Avatar :src="user.avatar" :size="35" />
<BowPower :power="power" />
</view>
<BowTarget
:start="start"
:totalRound="start ? total : 0"
:currentRound="currentRound"
:scores="scores"
:tips="
!start && scores.length > 0
? `本次射程${scores[scores.length - 1].dst / 100}米,${
scores[scores.length - 1].dst / 100 >= 5 ? '已' : '未'
}达到距离要求`
: ''
"
/>
<ScorePanel
v-if="start"
:scores="scores.map((s) => s.ring)"
:total="total"
:rowCount="total / 4"
:margin="1.5"
:font-size="20"
/>
<ScoreResult
v-if="practiseResult.arrows"
:total="total"
:rowCount="9"
:onClose="onComplete"
:result="practiseResult"
:tipSrc="`../static/${
practiseResult.arrows.length < total ? '2un' : ''
}finish-tip.png`"
/>
<canvas class="share-canvas" canvas-id="shareCanvas"></canvas>
<TestDistance v-if="!start && !practiseResult.arrows" />
<block v-if="start || practiseResult.arrows">
<ShootProgress
:start="start"
:tips="`请连续射箭${total}支`"
:total="120"
/>
<view class="infos">
<Avatar :src="user.avatar" :size="35" />
<BowPower :power="power" />
</view>
<BowTarget
:start="start"
:totalRound="start ? total : 0"
:currentRound="currentRound"
:scores="scores"
/>
<ScorePanel
v-if="start"
:scores="scores.map((s) => s.ring)"
:total="total"
:rowCount="total / 4"
:margin="1.5"
:font-size="20"
/>
<ScoreResult
v-if="practiseResult.arrows"
:total="total"
:rowCount="9"
:onClose="onComplete"
:result="practiseResult"
:tipSrc="`../static/${
practiseResult.arrows.length < total ? '2un' : ''
}finish-tip.png`"
/>
<canvas class="share-canvas" canvas-id="shareCanvas"></canvas>
</block>
</view>
<view :style="{ marginBottom: '20px' }">
<SButton v-if="!start" :onClick="onReady">准备好了直接开始</SButton>