细节完善

This commit is contained in:
kron
2025-08-11 09:13:43 +08:00
parent ae245872f4
commit 42324e8755
3 changed files with 15 additions and 16 deletions

View File

@@ -73,6 +73,10 @@ const onClick = async (e) => {
// 确认添加箭矢 // 确认添加箭矢
const confirmAdd = () => { const confirmAdd = () => {
if (props.onChange) { if (props.onChange) {
targetPos.value = {
x: zoomPos.value.x,
y: zoomPos.value.y,
};
props.onChange({ props.onChange({
x: arrow.value.x / scale.value, x: arrow.value.x / scale.value,
y: arrow.value.y / scale.value, y: arrow.value.y / scale.value,

View File

@@ -148,7 +148,7 @@ onMounted(async () => {
<style scoped> <style scoped>
.container { .container {
width: calc(100% - 20px); width: calc(100% - 20px);
padding: 0 15px; padding: 0 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;

View File

@@ -6,7 +6,6 @@ import SButton from "@/components/SButton.vue";
import BowTargetEdit from "@/components/BowTargetEdit.vue"; import BowTargetEdit from "@/components/BowTargetEdit.vue";
import { savePointBookAPI } from "@/apis"; import { savePointBookAPI } from "@/apis";
const clickable = ref(false);
const showTip = ref(false); const showTip = ref(false);
const groups = ref(0); const groups = ref(0);
const amount = ref(0); const amount = ref(0);
@@ -32,10 +31,18 @@ const onBack = () => {
uni.navigateBack(); uni.navigateBack();
}; };
const onSubmit = async () => { const onSubmit = async () => {
const isComplete = arrowGroups.value[currentGroup.value].every(
(item) => !!item.ring
);
if (!isComplete) {
return uni.showToast({
title: "请完善信息",
icon: "none",
});
}
if (currentGroup.value < groups.value) { if (currentGroup.value < groups.value) {
currentGroup.value++; currentGroup.value++;
currentArrow.value = 0; currentArrow.value = 0;
clickable.value = false;
} else { } else {
const pointBook = uni.getStorageSync("point-book"); const pointBook = uni.getStorageSync("point-book");
const res = await savePointBookAPI( const res = await savePointBookAPI(
@@ -56,9 +63,6 @@ const onSubmit = async () => {
const onClickRing = (ring) => { const onClickRing = (ring) => {
if (arrowGroups.value[currentGroup.value]) { 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.ring
);
if (currentArrow.value < amount.value - 1) currentArrow.value++; if (currentArrow.value < amount.value - 1) currentArrow.value++;
} }
}; };
@@ -67,9 +71,6 @@ const deleteArrow = () => {
}; };
const onEditDone = (arrow) => { const onEditDone = (arrow) => {
arrowGroups.value[currentGroup.value][currentArrow.value] = arrow; arrowGroups.value[currentGroup.value][currentArrow.value] = arrow;
clickable.value = arrowGroups.value[currentGroup.value].every(
(item) => !!item.ring
);
if (currentArrow.value < amount.value - 1) currentArrow.value++; if (currentArrow.value < amount.value - 1) currentArrow.value++;
}; };
@@ -166,13 +167,7 @@ onMounted(() => {
</ScreenHint2> </ScreenHint2>
</view> </view>
<view :style="{ marginBottom: '20px' }"> <view :style="{ marginBottom: '20px' }">
<SButton <SButton :rounded="50" :onClick="onSubmit">
:rounded="50"
:disabled="!clickable"
:onClick="onSubmit"
disabledColor="#DDDDDD"
:color="clickable ? '#000' : '#fff'"
>
{{ currentGroup === groups ? "记完了,提交看分析" : "下一组" }} {{ currentGroup === groups ? "记完了,提交看分析" : "下一组" }}
</SButton> </SButton>
</view> </view>