添加比赛记录接口

This commit is contained in:
kron
2025-06-09 12:29:48 +08:00
parent 0420f770c3
commit 6614e44688
2 changed files with 15 additions and 1 deletions

View File

@@ -176,3 +176,7 @@ export const simulShootAPI = (device_id, x, y) => {
}
return request("POST", "/index/arrow", data);
};
export const getBattleListAPI = (battleType) => {
return request("POST", "/user/battle/list", { battleType });
};

View File

@@ -1,7 +1,8 @@
<script setup>
import { onMounted } from "vue";
import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue";
import { getPractiseResultListAPI } from "@/apis";
import { getBattleListAPI, getPractiseResultListAPI } from "@/apis";
import { ref } from "vue";
@@ -9,6 +10,12 @@ const selectedIndex = ref(0);
const practiseList = ref([]);
const handleSelect = async (index) => {
if (index === 0) {
const result = await getBattleListAPI(1);
}
if (index === 1) {
const result = await getBattleListAPI(2);
}
if (index === 2) {
const result = await getPractiseResultListAPI();
practiseList.value = result.list;
@@ -21,6 +28,9 @@ const toMatchDetail = () => {
url: "/pages/match-detail",
});
};
onMounted(async () => {
const result = await getBattleListAPI(2);
});
</script>
<template>