2025-05-27 12:38:39 +08:00
|
|
|
<script setup>
|
2025-06-09 12:29:48 +08:00
|
|
|
import { onMounted } from "vue";
|
2025-05-27 12:38:39 +08:00
|
|
|
import Container from "@/components/Container.vue";
|
|
|
|
|
import Avatar from "@/components/Avatar.vue";
|
2025-06-15 15:53:57 +08:00
|
|
|
import BowData from "@/components/BowData.vue";
|
|
|
|
|
import {
|
|
|
|
|
getBattleListAPI,
|
|
|
|
|
getPractiseResultListAPI,
|
|
|
|
|
getPractiseAPI,
|
|
|
|
|
} from "@/apis";
|
2025-05-27 12:38:39 +08:00
|
|
|
|
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
|
|
|
|
|
const selectedIndex = ref(0);
|
2025-06-11 23:57:03 +08:00
|
|
|
const matchPage = ref(1);
|
|
|
|
|
const matchList = ref([]);
|
|
|
|
|
const battlePage = ref(1);
|
|
|
|
|
const battleList = ref([]);
|
2025-06-13 14:05:30 +08:00
|
|
|
const practiseList = ref([]);
|
2025-06-15 15:53:57 +08:00
|
|
|
const showBowData = ref(false);
|
|
|
|
|
const arrows = ref([]);
|
2025-05-27 12:38:39 +08:00
|
|
|
|
2025-05-31 15:03:14 +08:00
|
|
|
const handleSelect = async (index) => {
|
2025-06-12 00:24:14 +08:00
|
|
|
if (index === 0 && matchList.value.length === 0) {
|
2025-06-11 23:57:03 +08:00
|
|
|
const result = await getBattleListAPI(matchPage.value, 2);
|
2025-06-13 14:05:30 +08:00
|
|
|
matchList.value = result;
|
2025-06-11 23:57:03 +08:00
|
|
|
matchPage.value += 1;
|
2025-06-09 12:29:48 +08:00
|
|
|
}
|
2025-06-12 00:24:14 +08:00
|
|
|
if (index === 1 && battleList.value.length === 0) {
|
2025-06-13 14:05:30 +08:00
|
|
|
const result = await getBattleListAPI(battlePage.value, 1);
|
|
|
|
|
battleList.value = result;
|
|
|
|
|
battlePage.value += 1;
|
2025-06-09 12:29:48 +08:00
|
|
|
}
|
2025-06-12 00:24:14 +08:00
|
|
|
if (index === 2 && practiseList.value.length === 0) {
|
2025-05-31 15:03:14 +08:00
|
|
|
const result = await getPractiseResultListAPI();
|
|
|
|
|
practiseList.value = result.list;
|
|
|
|
|
}
|
2025-05-27 12:38:39 +08:00
|
|
|
selectedIndex.value = index;
|
|
|
|
|
};
|
2025-06-08 12:52:49 +08:00
|
|
|
|
2025-06-11 23:57:03 +08:00
|
|
|
const toMatchDetail = (id) => {
|
2025-06-08 12:52:49 +08:00
|
|
|
uni.navigateTo({
|
2025-06-11 23:57:03 +08:00
|
|
|
url: `/pages/match-detail?id=${id}`,
|
2025-06-08 12:52:49 +08:00
|
|
|
});
|
|
|
|
|
};
|
2025-06-15 15:53:57 +08:00
|
|
|
const getPractiseDetail = async (id) => {
|
|
|
|
|
const result = await getPractiseAPI(id);
|
|
|
|
|
arrows.value = JSON.parse(result.UserPracticeRound.arrows);
|
|
|
|
|
showBowData.value = true;
|
|
|
|
|
};
|
2025-06-09 12:29:48 +08:00
|
|
|
onMounted(async () => {
|
2025-06-11 23:57:03 +08:00
|
|
|
const result = await getBattleListAPI(matchPage.value, 2);
|
|
|
|
|
matchList.value = result;
|
|
|
|
|
matchPage.value += 1;
|
2025-06-09 12:29:48 +08:00
|
|
|
});
|
2025-05-27 12:38:39 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<Container title="我的成长脚印">
|
2025-06-08 12:52:49 +08:00
|
|
|
<view class="container">
|
|
|
|
|
<view class="tabs">
|
|
|
|
|
<view
|
|
|
|
|
v-for="(rankType, index) in ['排位赛', '好友约战', '射馆练习']"
|
|
|
|
|
:key="index"
|
|
|
|
|
:style="{
|
|
|
|
|
color: index === selectedIndex ? '#000' : '#fff',
|
|
|
|
|
backgroundColor:
|
|
|
|
|
index === selectedIndex ? '#FFD947' : 'transparent',
|
|
|
|
|
}"
|
|
|
|
|
@tap="handleSelect(index)"
|
|
|
|
|
>
|
|
|
|
|
{{ rankType }}
|
2025-05-27 12:38:39 +08:00
|
|
|
</view>
|
2025-06-08 12:52:49 +08:00
|
|
|
</view>
|
|
|
|
|
<view class="contents">
|
|
|
|
|
<view
|
|
|
|
|
:style="{
|
2025-06-11 23:57:03 +08:00
|
|
|
display: selectedIndex === 0 ? 'flex' : 'none',
|
2025-06-08 12:52:49 +08:00
|
|
|
}"
|
|
|
|
|
>
|
2025-06-11 23:57:03 +08:00
|
|
|
<view
|
|
|
|
|
v-for="(item, index) in matchList"
|
|
|
|
|
:key="index"
|
|
|
|
|
@click="() => toMatchDetail(item.battleId)"
|
|
|
|
|
>
|
2025-06-08 12:52:49 +08:00
|
|
|
<view class="contest-header">
|
2025-06-11 23:57:03 +08:00
|
|
|
<text>{{ item.name }}</text>
|
|
|
|
|
<text>{{ item.createdAt }}</text>
|
2025-06-08 12:52:49 +08:00
|
|
|
<image src="../static/back.png" mode="widthFix" />
|
2025-05-27 12:38:39 +08:00
|
|
|
</view>
|
2025-06-11 23:57:03 +08:00
|
|
|
<view v-if="item.mode === 1" class="contest-team">
|
2025-06-18 02:02:09 +08:00
|
|
|
<block v-if="item.bluePlayers[0]">
|
|
|
|
|
<view class="player">
|
|
|
|
|
<Avatar frame :src="item.bluePlayers[0].avatar" />
|
|
|
|
|
<text>{{ item.bluePlayers[0].name }}</text>
|
|
|
|
|
<image
|
|
|
|
|
v-if="item.winner === 1"
|
|
|
|
|
src="../static/winner-badge.png"
|
|
|
|
|
mode="widthFix"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
</block>
|
|
|
|
|
<block v-if="item.redPlayers[0]">
|
|
|
|
|
<view class="player">
|
|
|
|
|
<Avatar frame :src="item.redPlayers[0].avatar" />
|
|
|
|
|
<text>{{ item.redPlayers[0].name }}</text>
|
|
|
|
|
<image
|
|
|
|
|
v-if="item.winner === 0"
|
|
|
|
|
src="../static/winner-badge.png"
|
|
|
|
|
mode="widthFix"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
</block>
|
2025-05-27 12:38:39 +08:00
|
|
|
</view>
|
2025-06-11 23:57:03 +08:00
|
|
|
<view v-if="item.mode === 2" class="contest-multi">
|
|
|
|
|
<view
|
|
|
|
|
class="player"
|
|
|
|
|
v-for="(p, index2) in item.players"
|
|
|
|
|
:key="index2"
|
|
|
|
|
>
|
|
|
|
|
<Avatar :rank="index2 + 1" :src="p.avatar" />
|
|
|
|
|
<text>{{ p.name }}</text>
|
2025-06-08 12:52:49 +08:00
|
|
|
</view>
|
2025-05-27 12:38:39 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-06-11 23:57:03 +08:00
|
|
|
<view
|
|
|
|
|
:style="{
|
|
|
|
|
display: selectedIndex === 1 ? 'flex' : 'none',
|
|
|
|
|
}"
|
2025-06-13 14:05:30 +08:00
|
|
|
>
|
|
|
|
|
<view
|
|
|
|
|
v-for="(item, index) in battleList"
|
|
|
|
|
:key="index"
|
|
|
|
|
@click="() => toMatchDetail(item.battleId)"
|
|
|
|
|
>
|
|
|
|
|
<view class="contest-header">
|
|
|
|
|
<text>{{ item.name }}</text>
|
|
|
|
|
<text>{{ item.createdAt }}</text>
|
|
|
|
|
<image src="../static/back.png" mode="widthFix" />
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="item.mode === 1" class="contest-team">
|
|
|
|
|
<view
|
|
|
|
|
class="player"
|
|
|
|
|
v-for="(p, index2) in item.players"
|
|
|
|
|
:key="index2"
|
|
|
|
|
>
|
|
|
|
|
<Avatar frame :src="p.avatar" />
|
|
|
|
|
<text>{{ p.name }}</text>
|
|
|
|
|
<image
|
|
|
|
|
v-if="index2 === 0"
|
|
|
|
|
src="../static/winner-badge.png"
|
|
|
|
|
mode="widthFix"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="item.mode === 2" class="contest-multi">
|
|
|
|
|
<view
|
|
|
|
|
class="player"
|
|
|
|
|
v-for="(p, index2) in item.players"
|
|
|
|
|
:key="index2"
|
|
|
|
|
>
|
|
|
|
|
<Avatar :rank="index2 + 1" :src="p.avatar" />
|
|
|
|
|
<text>{{ p.name }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-05-27 12:38:39 +08:00
|
|
|
<view
|
2025-06-08 12:52:49 +08:00
|
|
|
:style="{
|
|
|
|
|
display: selectedIndex === 2 ? 'flex' : 'none',
|
|
|
|
|
}"
|
2025-05-27 12:38:39 +08:00
|
|
|
>
|
2025-06-08 12:52:49 +08:00
|
|
|
<view
|
|
|
|
|
v-for="(item, index) in practiseList"
|
|
|
|
|
:key="index"
|
|
|
|
|
class="practice-record"
|
2025-06-15 15:53:57 +08:00
|
|
|
@click="() => getPractiseDetail(item.id)"
|
2025-06-08 12:52:49 +08:00
|
|
|
>
|
|
|
|
|
<text>单组练习 {{ item.createdAt }}</text>
|
|
|
|
|
<image src="../static/back.png" mode="widthFix" />
|
|
|
|
|
</view>
|
2025-05-27 12:38:39 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-06-15 15:53:57 +08:00
|
|
|
<BowData
|
|
|
|
|
:arrows="arrows"
|
|
|
|
|
:show="showBowData"
|
|
|
|
|
:onClose="() => (showBowData = false)"
|
|
|
|
|
/>
|
2025-05-27 12:38:39 +08:00
|
|
|
</view>
|
|
|
|
|
</Container>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2025-06-08 12:52:49 +08:00
|
|
|
.container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2025-05-27 12:38:39 +08:00
|
|
|
.tabs {
|
|
|
|
|
width: calc(100% - 30px);
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
padding: 15px;
|
|
|
|
|
padding-top: 0;
|
|
|
|
|
}
|
|
|
|
|
.tabs > view {
|
|
|
|
|
width: 33.3%;
|
|
|
|
|
padding: 7px 10px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
border-radius: 20px;
|
|
|
|
|
}
|
|
|
|
|
.contents > view {
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
|
|
|
|
.contest-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
padding: 7px 12px;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
background: linear-gradient(180deg, #323845 0%, #2e2e39 100%);
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
.contest-header > text:first-child {
|
|
|
|
|
color: #ffd947;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
|
|
|
|
.contest-header > text:nth-child(2) {
|
|
|
|
|
color: #fff9;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
}
|
|
|
|
|
.contest-header > image {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 8px;
|
|
|
|
|
right: 10px;
|
|
|
|
|
width: 15px;
|
|
|
|
|
transform: rotate(180deg);
|
|
|
|
|
}
|
|
|
|
|
.player {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
color: #fff9;
|
|
|
|
|
padding-top: 10px;
|
|
|
|
|
padding-bottom: 5px;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
.player > text {
|
|
|
|
|
margin-top: 5px;
|
2025-06-11 23:57:03 +08:00
|
|
|
font-size: 14px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
width: 90%;
|
|
|
|
|
text-align: center;
|
2025-05-27 12:38:39 +08:00
|
|
|
}
|
|
|
|
|
.player > image:last-child {
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: 60px;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
}
|
2025-06-11 23:57:03 +08:00
|
|
|
.contest-team,
|
2025-05-27 12:38:39 +08:00
|
|
|
.contest-multi {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
2025-06-11 23:57:03 +08:00
|
|
|
.contest-team > view {
|
2025-05-27 12:38:39 +08:00
|
|
|
width: 50%;
|
|
|
|
|
}
|
2025-06-11 23:57:03 +08:00
|
|
|
.contest-team > view:first-child {
|
2025-05-27 12:38:39 +08:00
|
|
|
background-color: #364469;
|
|
|
|
|
}
|
2025-06-11 23:57:03 +08:00
|
|
|
.contest-team > view:last-child {
|
2025-05-27 12:38:39 +08:00
|
|
|
background-color: #692735;
|
|
|
|
|
}
|
|
|
|
|
.contest-multi > view {
|
|
|
|
|
width: 20%;
|
|
|
|
|
}
|
|
|
|
|
.contest-multi > view:nth-child(1) {
|
|
|
|
|
background-color: #364469;
|
|
|
|
|
}
|
|
|
|
|
.contest-multi > view:nth-child(2) {
|
|
|
|
|
background-color: #692735;
|
|
|
|
|
}
|
|
|
|
|
.contest-multi > view:nth-child(3) {
|
|
|
|
|
background-color: #934b4b;
|
|
|
|
|
}
|
|
|
|
|
.contest-multi > view:nth-child(4) {
|
|
|
|
|
background-color: #a98b69;
|
|
|
|
|
}
|
|
|
|
|
.contest-multi > view:nth-child(5) {
|
|
|
|
|
background-color: #8268a2;
|
|
|
|
|
}
|
|
|
|
|
.practice-record {
|
|
|
|
|
color: #fff9;
|
|
|
|
|
border-bottom: 1px solid #fff9;
|
|
|
|
|
padding: 15px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
.practice-record > image {
|
|
|
|
|
width: 15px;
|
|
|
|
|
transform: rotate(180deg);
|
|
|
|
|
}
|
|
|
|
|
</style>
|