细节完善

This commit is contained in:
kron
2025-08-07 09:21:30 +08:00
parent e12252beed
commit 425be211e7
2 changed files with 21 additions and 23 deletions

View File

@@ -238,6 +238,7 @@ onMounted(async () => {
font-size: 24px; font-size: 24px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
text-align: center;
} }
.edit-btn { .edit-btn {

View File

@@ -1,12 +1,12 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onUnmounted } from "vue";
import { onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import EditOption from "@/components/EditOption.vue"; import EditOption from "@/components/EditOption.vue";
import SButton from "@/components/SButton.vue"; import SButton from "@/components/SButton.vue";
import { getPractiseDataAPI } from "@/apis"; import { getPractiseDataAPI } from "@/apis";
const clickable = ref(false); const expandIndex = ref(0);
const expandIndex = ref(-1);
const bowType = ref({}); const bowType = ref({});
const distance = ref(0); const distance = ref(0);
const bowtargetType = ref(""); const bowtargetType = ref("");
@@ -35,6 +35,8 @@ const onSelect = (itemIndex, value) => {
else if (itemIndex === 1) distance.value = value; else if (itemIndex === 1) distance.value = value;
else if (itemIndex === 2) bowtargetType.value = value; else if (itemIndex === 2) bowtargetType.value = value;
else if (itemIndex === 3) amountGroup.value = value; else if (itemIndex === 3) amountGroup.value = value;
};
const toEditPage = () => {
if ( if (
bowType.value && bowType.value &&
distance.value && distance.value &&
@@ -47,15 +49,23 @@ const onSelect = (itemIndex, value) => {
bowtargetType: bowtargetType.value, bowtargetType: bowtargetType.value,
amountGroup: amountGroup.value, amountGroup: amountGroup.value,
}); });
clickable.value = true; uni.navigateTo({
url: "/pages/point-book-edit",
});
} else {
uni.showToast({
title: "请完善信息",
icon: "none",
});
} }
}; };
const toEditPage = () => { onShow(async () => {
expandIndex.value = -1; const result = await getPractiseDataAPI();
uni.navigateTo({ if (result) {
url: "/pages/point-book-edit", days.value = result.total_day || 0;
}); arrows.value = result.total_arrow || 0;
}; }
});
onMounted(async () => { onMounted(async () => {
const pointBook = uni.getStorageSync("point-book"); const pointBook = uni.getStorageSync("point-book");
if (pointBook) { if (pointBook) {
@@ -63,11 +73,6 @@ onMounted(async () => {
distance.value = pointBook.distance; distance.value = pointBook.distance;
bowtargetType.value = pointBook.bowtargetType; bowtargetType.value = pointBook.bowtargetType;
} }
const result = await getPractiseDataAPI();
if (result) {
days.value = result.total_day || 0;
arrows.value = result.total_arrow || 0;
}
}); });
</script> </script>
@@ -130,15 +135,7 @@ onMounted(async () => {
</view> </view>
</view> </view>
<view :style="{ marginBottom: '20px' }"> <view :style="{ marginBottom: '20px' }">
<SButton <SButton :rounded="50" :onClick="toEditPage">开始计分</SButton>
:rounded="50"
:disabled="!clickable"
:onClick="toEditPage"
disabledColor="#DDDDDD"
:color="clickable ? '#000' : '#fff'"
>
开始计分
</SButton>
<view class="see-more" @click="toListPage"> <view class="see-more" @click="toListPage">
<text>历史计分记录</text> <text>历史计分记录</text>
<image src="../static/enter-arrow-blue.png" mode="widthFix" /> <image src="../static/enter-arrow-blue.png" mode="widthFix" />