2025-06-05 21:32:15 +08:00
|
|
|
|
<script setup>
|
2025-06-06 00:34:54 +08:00
|
|
|
|
import { ref, onMounted } from "vue";
|
2025-06-05 21:32:15 +08:00
|
|
|
|
import { onLoad } from "@dcloudio/uni-app";
|
2025-06-06 00:34:54 +08:00
|
|
|
|
import { getGameAPI } from "@/apis";
|
2025-06-08 12:52:49 +08:00
|
|
|
|
import TeamResult from "@/components/TeamResult.vue";
|
|
|
|
|
|
import MeleeResult from "@/components/MeleeResult.vue";
|
2025-06-08 20:59:41 +08:00
|
|
|
|
import useStore from "@/store";
|
|
|
|
|
|
import { storeToRefs } from "pinia";
|
|
|
|
|
|
const store = useStore();
|
|
|
|
|
|
const { user } = storeToRefs(store);
|
2025-06-05 21:32:15 +08:00
|
|
|
|
|
|
|
|
|
|
const battleId = ref("");
|
2025-06-08 20:59:41 +08:00
|
|
|
|
const ifWin = ref(false);
|
|
|
|
|
|
const data = ref({});
|
|
|
|
|
|
const totalPoints = ref(0);
|
|
|
|
|
|
const show = ref(false);
|
2025-06-05 21:32:15 +08:00
|
|
|
|
|
2025-06-08 20:59:41 +08:00
|
|
|
|
onLoad(async (options) => {
|
|
|
|
|
|
battleId.value = options.battleId;
|
|
|
|
|
|
const result = await getGameAPI(
|
|
|
|
|
|
options.battleId || "BATTLE-1749386862250435325-854"
|
|
|
|
|
|
);
|
|
|
|
|
|
data.value = result;
|
|
|
|
|
|
if (result.redPlayers[user.value.id]) {
|
|
|
|
|
|
totalPoints.value = result.redTotal;
|
|
|
|
|
|
ifWin.value = result.winner === 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result.bluePlayers[user.value.id]) {
|
|
|
|
|
|
totalPoints.value = result.redTotal;
|
|
|
|
|
|
ifWin.value = result.winner === 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-06-05 21:32:15 +08:00
|
|
|
|
function exit() {
|
|
|
|
|
|
uni.navigateBack();
|
|
|
|
|
|
}
|
2025-06-08 12:52:49 +08:00
|
|
|
|
onMounted(async () => {});
|
2025-06-05 21:32:15 +08:00
|
|
|
|
</script>
|
2025-06-04 16:26:07 +08:00
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<view class="container">
|
2025-06-08 20:59:41 +08:00
|
|
|
|
<image
|
|
|
|
|
|
:style="{ opacity: ifWin ? '1' : '0' }"
|
|
|
|
|
|
class="tag"
|
|
|
|
|
|
src="../static/winner-yellow.png"
|
|
|
|
|
|
mode="widthFix"
|
|
|
|
|
|
/>
|
2025-06-04 16:26:07 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<image src="../static/battle-result.png" mode="widthFix" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<image src="../static/shining-bg.png" mode="widthFix" />
|
|
|
|
|
|
<image src="../static/throphy.png" mode="widthFix" />
|
2025-06-08 20:59:41 +08:00
|
|
|
|
<text>{{ ifWin && data.winner === 1 ? "蓝队" : "红队" }}获胜</text>
|
2025-06-04 16:26:07 +08:00
|
|
|
|
<text>强势登顶,荣耀加冕</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<image src="../static/row-yellow-bg.png" mode="widthFix" />
|
2025-06-08 20:59:41 +08:00
|
|
|
|
<text>经验 +{{ totalPoints }}</text>
|
2025-06-04 16:26:07 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<text>你是朋友中的佼佼者哦</text>
|
|
|
|
|
|
<view>
|
2025-06-08 12:52:49 +08:00
|
|
|
|
<view @click="() => (show = true)">查看靶纸</view>
|
2025-06-05 21:32:15 +08:00
|
|
|
|
<view @click="exit">退出</view>
|
2025-06-04 16:26:07 +08:00
|
|
|
|
</view>
|
2025-06-08 20:59:41 +08:00
|
|
|
|
<TeamResult :show="show" :onClose="() => (show = false)" :data="data" />
|
|
|
|
|
|
<!-- <MeleeResult :show="show" :onClose="() => (show = false)" /> -->
|
2025-06-04 16:26:07 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.container {
|
|
|
|
|
|
width: 100vw;
|
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
background-color: #000;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.tag {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 32vw;
|
2025-06-06 00:34:54 +08:00
|
|
|
|
top: 0;
|
2025-06-04 16:26:07 +08:00
|
|
|
|
right: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(2) {
|
|
|
|
|
|
width: 80%;
|
|
|
|
|
|
margin: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(2) > image {
|
|
|
|
|
|
width: 20vw;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(3) {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 38%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
color: #fff9;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(3) > image {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 100vw;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(3) > image:nth-child(2) {
|
|
|
|
|
|
top: 6vw;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(3) > text:nth-child(3) {
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
margin: 10px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #fed847;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(4) {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 60px;
|
|
|
|
|
|
margin: 20px 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(4) > image {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 100vw;
|
|
|
|
|
|
top: 45%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(4) > text {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
top: 54%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > text:nth-child(5) {
|
|
|
|
|
|
margin: 50px 0;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: #fed847;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(6) {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(6) > view {
|
|
|
|
|
|
width: 36%;
|
|
|
|
|
|
margin: 0 10px;
|
|
|
|
|
|
background-color: #fed847;
|
|
|
|
|
|
border-radius: 20px;
|
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.container > view:nth-child(6) > view:last-child {
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
background-color: #757575;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|