完成创建靶点

This commit is contained in:
kron
2025-07-31 14:32:14 +08:00
parent 0ebe34cc1e
commit af888c68be
8 changed files with 269 additions and 12 deletions

View File

@@ -24,6 +24,10 @@ const ringColors = [
"#9B9B9B",
];
const onEdit = (arrows) => {
arrowGroups.value[currentGroup.value][currentArrow.value] = { ring };
};
const onBack = () => {
uni.navigateBack();
};
@@ -38,17 +42,22 @@ const onSubmit = () => {
};
const onClickRing = (ring) => {
if (arrowGroups.value[currentGroup.value]) {
arrowGroups.value[currentGroup.value][currentArrow.value] = ring;
arrowGroups.value[currentGroup.value][currentArrow.value] = { ring };
clickable.value = arrowGroups.value[currentGroup.value].every(
(item) => !!item
(item) => !!item.ring
);
if (currentArrow.value < amount.value - 1) {
currentArrow.value++;
}
if (currentArrow.value < amount.value - 1) currentArrow.value++;
}
};
const deleteArrow = () => {
arrowGroups.value[currentGroup.value][currentArrow.value] = "";
arrowGroups.value[currentGroup.value][currentArrow.value] = {};
};
const onEditDone = (arrow) => {
arrowGroups.value[currentGroup.value][currentArrow.value] = {
...arrow,
ring: 10,
};
if (currentArrow.value < amount.value - 1) currentArrow.value++;
};
onMounted(() => {
@@ -57,7 +66,7 @@ onMounted(() => {
groups.value = Number(pointBook.amountGroup.split("/")[0]);
amount.value = Number(pointBook.amountGroup.split("/")[1]);
for (let i = 1; i <= groups.value; i++) {
arrowGroups.value[i] = new Array(amount.value).fill("");
arrowGroups.value[i] = new Array(amount.value).fill({});
}
}
});
@@ -71,7 +80,10 @@ onMounted(() => {
:onBack="() => (showTip = true)"
>
<view class="container">
<BowTargetEdit />
<BowTargetEdit
:onChange="onEditDone"
:arrows="arrowGroups[currentGroup]"
/>
<view class="title-bar">
<view>
<view />
@@ -92,7 +104,13 @@ onMounted(() => {
borderColor: currentArrow === index ? '#FED847' : '#eeeeee',
borderWidth: currentArrow === index ? '2px' : '1px',
}"
>{{ isNaN(arrow) ? arrow : arrow ? arrow + " 环" : "" }}</view
>{{
isNaN(arrow.ring)
? arrow.ring
: arrow.ring
? arrow.ring + " 环"
: ""
}}</view
>
</view>
<text>输入分值的情况下系统不提供落点稳定性分</text>