添加比赛记录接口
This commit is contained in:
@@ -176,3 +176,7 @@ export const simulShootAPI = (device_id, x, y) => {
|
|||||||
}
|
}
|
||||||
return request("POST", "/index/arrow", data);
|
return request("POST", "/index/arrow", data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getBattleListAPI = (battleType) => {
|
||||||
|
return request("POST", "/user/battle/list", { battleType });
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { onMounted } from "vue";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
import { getPractiseResultListAPI } from "@/apis";
|
import { getBattleListAPI, getPractiseResultListAPI } from "@/apis";
|
||||||
|
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
@@ -9,6 +10,12 @@ const selectedIndex = ref(0);
|
|||||||
const practiseList = ref([]);
|
const practiseList = ref([]);
|
||||||
|
|
||||||
const handleSelect = async (index) => {
|
const handleSelect = async (index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
const result = await getBattleListAPI(1);
|
||||||
|
}
|
||||||
|
if (index === 1) {
|
||||||
|
const result = await getBattleListAPI(2);
|
||||||
|
}
|
||||||
if (index === 2) {
|
if (index === 2) {
|
||||||
const result = await getPractiseResultListAPI();
|
const result = await getPractiseResultListAPI();
|
||||||
practiseList.value = result.list;
|
practiseList.value = result.list;
|
||||||
@@ -21,6 +28,9 @@ const toMatchDetail = () => {
|
|||||||
url: "/pages/match-detail",
|
url: "/pages/match-detail",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
onMounted(async () => {
|
||||||
|
const result = await getBattleListAPI(2);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user