计分本配置接口接入

This commit is contained in:
kron
2025-08-04 16:28:34 +08:00
parent 54a51d2a28
commit 97d23aa731
9 changed files with 181 additions and 129 deletions

View File

@@ -3,6 +3,14 @@ import { ref, onMounted } from "vue";
import { getElementRect, calcRing } from "@/util";
const props = defineProps({
id: {
type: Number,
default: 0,
},
src: {
type: String,
default: "",
},
arrows: {
type: Array,
default: () => [],
@@ -26,6 +34,7 @@ const onClick = async (e) => {
y: e.detail.y - rect.value.top - 10,
};
newArrow.ring = calcRing(
props.id,
newArrow.x,
newArrow.y,
rect.value.width * 0.9,
@@ -72,7 +81,13 @@ const onDrag = async (e) => {
// 更新坐标
arrow.value.x = Math.max(0, Math.min(width, arrow.value.x + deltaX));
arrow.value.y = Math.max(0, Math.min(height, arrow.value.y + deltaY));
arrow.value.ring = calcRing(arrow.value.x, arrow.value.y, width, height);
arrow.value.ring = calcRing(
props.id,
arrow.value.x,
arrow.value.y,
width,
height
);
// 更新拖拽起始位置
dragStartPos.value = { x: clientX, y: clientY };
@@ -96,7 +111,7 @@ onMounted(async () => {
@touchmove="onDrag"
@touchend="endDrag"
>
<image src="../static/bow-target.png" mode="widthFix" />
<image :src="src" mode="widthFix" />
<view
v-for="(arrow, index) in arrows"
:key="index"