...
This commit is contained in:
22
src/apis.js
22
src/apis.js
@@ -368,9 +368,31 @@ export const getPointBookConfigAPI = async () => {
|
|||||||
return request("GET", "/user/score/sheet/option");
|
return request("GET", "/user/score/sheet/option");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const savePointBookAPI = async (
|
||||||
|
bowType,
|
||||||
|
distance,
|
||||||
|
targetType,
|
||||||
|
groups,
|
||||||
|
arrows,
|
||||||
|
group_data = []
|
||||||
|
) => {
|
||||||
|
return request("POST", "/user/score/sheet/report", {
|
||||||
|
bowType,
|
||||||
|
distance,
|
||||||
|
targetType,
|
||||||
|
groups,
|
||||||
|
arrows,
|
||||||
|
group_data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const getPointBookListAPI = async (page = 1, size = 10) => {
|
export const getPointBookListAPI = async (page = 1, size = 10) => {
|
||||||
return request(
|
return request(
|
||||||
"GET",
|
"GET",
|
||||||
`/user/score/sheet/list?pageNum=${page}&pageSize=${size}`
|
`/user/score/sheet/list?pageNum=${page}&pageSize=${size}`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getPointBookDetailAPI = async (id) => {
|
||||||
|
return request("GET", `/user/score/sheet/detail?id=${id}`);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,9 +1,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
import { ref, onMounted, onUnmounted } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import BowTarget from "@/components/BowTarget.vue";
|
import BowTarget from "@/components/BowTarget.vue";
|
||||||
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
||||||
|
|
||||||
|
import { getPointBookDetailAPI } from "@/apis";
|
||||||
|
|
||||||
|
onLoad(async (options) => {
|
||||||
|
if (options.id) {
|
||||||
|
const result = await getPointBookDetailAPI(options.id);
|
||||||
|
console.log(1212, result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const selectedIndex = ref(0);
|
const selectedIndex = ref(0);
|
||||||
const showTip = ref(false);
|
const showTip = ref(false);
|
||||||
const showTip2 = ref(false);
|
const showTip2 = ref(false);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Container from "@/components/Container.vue";
|
|||||||
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
import BowTargetEdit from "@/components/BowTargetEdit.vue";
|
import BowTargetEdit from "@/components/BowTargetEdit.vue";
|
||||||
|
import { savePointBookAPI } from "@/apis";
|
||||||
|
|
||||||
const clickable = ref(false);
|
const clickable = ref(false);
|
||||||
const showTip = ref(false);
|
const showTip = ref(false);
|
||||||
@@ -27,22 +28,29 @@ const ringTypes = ref([
|
|||||||
{ ring: "1", color: "#d8d8d8" },
|
{ ring: "1", color: "#d8d8d8" },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onEdit = (arrows) => {
|
|
||||||
arrowGroups.value[currentGroup.value][currentArrow.value] = { ring };
|
|
||||||
};
|
|
||||||
|
|
||||||
const onBack = () => {
|
const onBack = () => {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
};
|
};
|
||||||
const onSubmit = () => {
|
const onSubmit = async () => {
|
||||||
if (currentGroup.value < groups.value) {
|
if (currentGroup.value < groups.value) {
|
||||||
currentGroup.value++;
|
currentGroup.value++;
|
||||||
currentArrow.value = 0;
|
currentArrow.value = 0;
|
||||||
clickable.value = false;
|
clickable.value = false;
|
||||||
} else {
|
} else {
|
||||||
uni.redirectTo({
|
const pointBook = uni.getStorageSync("point-book");
|
||||||
url: `/pages/point-book-detail`,
|
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) => {
|
const onClickRing = (ring) => {
|
||||||
@@ -59,6 +67,9 @@ 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++;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,25 @@ import Container from "@/components/Container.vue";
|
|||||||
import SModal from "@/components/SModal.vue";
|
import SModal from "@/components/SModal.vue";
|
||||||
import EditOption from "@/components/EditOption.vue";
|
import EditOption from "@/components/EditOption.vue";
|
||||||
import PointRecord from "@/components/PointRecord.vue";
|
import PointRecord from "@/components/PointRecord.vue";
|
||||||
|
import ScrollList from "@/components/ScrollList.vue";
|
||||||
|
import { getPointBookListAPI } from "@/apis";
|
||||||
|
|
||||||
const bowType = ref("");
|
const bowType = ref("");
|
||||||
const distance = ref(0);
|
const distance = ref(0);
|
||||||
const bowtargetType = ref("");
|
const bowtargetType = ref("");
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
const selectorIndex = ref(0);
|
const selectorIndex = ref(0);
|
||||||
|
const list = ref([]);
|
||||||
|
|
||||||
|
const onListLoading = async (page) => {
|
||||||
|
const result = await getPointBookListAPI(page, 1);
|
||||||
|
if (page === 1) {
|
||||||
|
list.value = result;
|
||||||
|
} else {
|
||||||
|
list.value = list.value.concat(result);
|
||||||
|
}
|
||||||
|
return result.length;
|
||||||
|
};
|
||||||
|
|
||||||
const openSelector = (index) => {
|
const openSelector = (index) => {
|
||||||
selectorIndex.value = index;
|
selectorIndex.value = index;
|
||||||
@@ -25,9 +38,9 @@ const onSelectOption = (itemIndex, value) => {
|
|||||||
bowtargetType.value = value;
|
bowtargetType.value = value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const toDetailPage = (record) => {
|
const toDetailPage = (id) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/point-book-detail?id=${record.id}`,
|
url: `/pages/point-book-detail?id=${id}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -61,9 +74,15 @@ const toDetailPage = (record) => {
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="point-records">
|
<view class="point-records">
|
||||||
<view v-for="i in 4" :key="i" @click="toDetailPage">
|
<ScrollList :onLoading="onMatchLoading">
|
||||||
<PointRecord />
|
<view
|
||||||
</view>
|
v-for="(item, index) in list"
|
||||||
|
:key="index"
|
||||||
|
@click="() => toDetailPage(item.id)"
|
||||||
|
>
|
||||||
|
<PointRecord />
|
||||||
|
</view>
|
||||||
|
</ScrollList>
|
||||||
</view>
|
</view>
|
||||||
<SModal
|
<SModal
|
||||||
:show="showModal"
|
:show="showModal"
|
||||||
|
|||||||
Reference in New Issue
Block a user