...
This commit is contained in:
@@ -4,6 +4,7 @@ import Container from "@/components/Container.vue";
|
||||
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
||||
import SButton from "@/components/SButton.vue";
|
||||
import BowTargetEdit from "@/components/BowTargetEdit.vue";
|
||||
import { savePointBookAPI } from "@/apis";
|
||||
|
||||
const clickable = ref(false);
|
||||
const showTip = ref(false);
|
||||
@@ -27,22 +28,29 @@ const ringTypes = ref([
|
||||
{ ring: "1", color: "#d8d8d8" },
|
||||
]);
|
||||
|
||||
const onEdit = (arrows) => {
|
||||
arrowGroups.value[currentGroup.value][currentArrow.value] = { ring };
|
||||
};
|
||||
|
||||
const onBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
const onSubmit = () => {
|
||||
const onSubmit = async () => {
|
||||
if (currentGroup.value < groups.value) {
|
||||
currentGroup.value++;
|
||||
currentArrow.value = 0;
|
||||
clickable.value = false;
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: `/pages/point-book-detail`,
|
||||
});
|
||||
const pointBook = uni.getStorageSync("point-book");
|
||||
const res = await savePointBookAPI(
|
||||
pointBook.bowType.id,
|
||||
pointBook.distance,
|
||||
pointBook.bowtargetType.id,
|
||||
groups.value,
|
||||
amount.value,
|
||||
Object.values(arrowGroups.value)
|
||||
);
|
||||
if (res.id) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/point-book-detail?id=${res.id}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const onClickRing = (ring) => {
|
||||
@@ -59,6 +67,9 @@ const deleteArrow = () => {
|
||||
};
|
||||
const onEditDone = (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++;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user