计分本配置接口接入

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,15 +3,23 @@ import { ref, onMounted, onUnmounted } from "vue";
import Container from "@/components/Container.vue";
import EditOption from "@/components/EditOption.vue";
import SButton from "@/components/SButton.vue";
import { getPointBookConfigAPI } from "@/apis";
const clickable = ref(false);
const expandIndex = ref(-1);
const bowType = ref("");
const bowType = ref({});
const distance = ref(0);
const bowtargetType = ref("");
const amountGroup = ref("");
const onExpandChange = (index, expand) => {
expandIndex.value = !expand ? -1 : index;
if (expandIndex.value !== -1) {
expandIndex.value = -1;
setTimeout(() => {
expandIndex.value = !expand ? -1 : index;
}, 100);
} else {
expandIndex.value = !expand ? -1 : index;
}
};
const toListPage = () => {
@@ -41,11 +49,16 @@ const onSelect = (itemIndex, value) => {
}
};
const toEditPage = () => {
expandIndex.value = -1;
uni.navigateTo({
url: "/pages/point-book-edit",
});
};
onMounted(() => {
onMounted(async () => {
const config = await getPointBookConfigAPI();
if (config) {
uni.setStorageSync("point-book-config", config);
}
const pointBook = uni.getStorageSync("point-book");
if (pointBook) {
bowType.value = pointBook.bowType;
@@ -73,7 +86,7 @@ onMounted(() => {
:expand="expandIndex === 0"
:onExpand="onExpandChange"
:onSelect="onSelect"
:value="bowType"
:value="bowType.name"
/>
<EditOption
:itemIndex="1"
@@ -87,7 +100,7 @@ onMounted(() => {
:expand="expandIndex === 2"
:onExpand="onExpandChange"
:onSelect="onSelect"
:value="bowtargetType"
:value="bowtargetType.name"
/>
<EditOption
:itemIndex="3"

View File

@@ -12,17 +12,20 @@ const amount = ref(0);
const currentGroup = ref(1);
const currentArrow = ref(0);
const arrowGroups = ref({});
const ringColors = [
"#FADB80",
"#FADB80",
"#FADB80",
"#F97E81",
"#F97E81",
"#7AC7FF",
"#7AC7FF",
"#9B9B9B",
"#9B9B9B",
];
const bowtarget = ref({});
const ringTypes = ref([
{ ring: "X", color: "#FADB80" },
{ ring: "10", color: "#FADB80" },
{ ring: "9", color: "#FADB80" },
{ ring: "8", color: "#F97E81" },
{ ring: "7", color: "#F97E81" },
{ ring: "6", color: "#7AC7FF" },
{ ring: "5", color: "#7AC7FF" },
{ ring: "4", color: "#9B9B9B" },
{ ring: "3", color: "#9B9B9B" },
{ ring: "2", color: "#d8d8d8" },
{ ring: "1", color: "#d8d8d8" },
]);
const onEdit = (arrows) => {
arrowGroups.value[currentGroup.value][currentArrow.value] = { ring };
@@ -61,6 +64,15 @@ const onEditDone = (arrow) => {
onMounted(() => {
const pointBook = uni.getStorageSync("point-book");
if (pointBook.bowtargetType) {
bowtarget.value = pointBook.bowtargetType;
if (bowtarget.value.id > 3) {
ringTypes.value = ringTypes.value.slice(0, 6);
if (bowtarget.value.id > 8) {
ringTypes.value = ringTypes.value.slice(1);
}
}
}
if (pointBook.amountGroup) {
groups.value = Number(pointBook.amountGroup.split("/")[0]);
amount.value = Number(pointBook.amountGroup.split("/")[1]);
@@ -82,6 +94,8 @@ onMounted(() => {
<BowTargetEdit
:onChange="onEditDone"
:arrows="arrowGroups[currentGroup]"
:id="bowtarget.id"
:src="bowtarget.icon"
/>
<view class="title-bar">
<view>
@@ -114,15 +128,18 @@ onMounted(() => {
</view>
<text>输入分值的情况下系统不提供落点稳定性分</text>
<view class="bow-rings">
<view @click="() => onClickRing('X')">X</view>
<view
v-for="i in 10"
:key="i"
@click="() => onClickRing(11 - i)"
:style="{ backgroundColor: ringColors[i] || '#d8d8d8' }"
>{{ 11 - i }}</view
v-for="(item, index) in ringTypes"
:key="index"
@click="() => onClickRing(item.ring)"
:style="{ backgroundColor: item.color }"
>{{ item.ring }}</view
>
<view
:style="{ backgroundColor: '#d8d8d8' }"
@click="() => onClickRing('M')"
>M</view
>
<view @click="() => onClickRing('M')">M</view>
</view>
<ScreenHint2 :show="showTip">
<view class="tip-content">
@@ -188,9 +205,6 @@ onMounted(() => {
color: #fff;
background-color: #d8d8d8;
}
.bow-rings > view:first-child {
background-color: #fadb80;
}
.tip-content {
width: 100%;
padding: 25px;