1v1排位数据交互完善
This commit is contained in:
@@ -4,15 +4,32 @@ import { onLoad } from "@dcloudio/uni-app";
|
||||
import { getGameAPI } from "@/apis";
|
||||
import TeamResult from "@/components/TeamResult.vue";
|
||||
import MeleeResult from "@/components/MeleeResult.vue";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { user } = storeToRefs(store);
|
||||
|
||||
const battleId = ref("");
|
||||
const show = ref(true);
|
||||
const ifWin = ref(false);
|
||||
const data = ref({});
|
||||
const totalPoints = ref(0);
|
||||
const show = ref(false);
|
||||
|
||||
// onLoad(async (options) => {
|
||||
// battleId.value = options.battleId;
|
||||
// const result = await getGameAPI(options.battleId);
|
||||
// console.log(1111, result);
|
||||
// });
|
||||
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;
|
||||
}
|
||||
});
|
||||
function exit() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
@@ -21,27 +38,32 @@ onMounted(async () => {});
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<image class="tag" src="../static/winner-yellow.png" mode="widthFix" />
|
||||
<image
|
||||
:style="{ opacity: ifWin ? '1' : '0' }"
|
||||
class="tag"
|
||||
src="../static/winner-yellow.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<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" />
|
||||
<text>蓝队获胜</text>
|
||||
<text>{{ ifWin && data.winner === 1 ? "蓝队" : "红队" }}获胜</text>
|
||||
<text>强势登顶,荣耀加冕</text>
|
||||
</view>
|
||||
<view>
|
||||
<image src="../static/row-yellow-bg.png" mode="widthFix" />
|
||||
<text>经验 +20</text>
|
||||
<text>经验 +{{ totalPoints }}</text>
|
||||
</view>
|
||||
<text>你是朋友中的佼佼者哦</text>
|
||||
<view>
|
||||
<view @click="() => (show = true)">查看靶纸</view>
|
||||
<view @click="exit">退出</view>
|
||||
</view>
|
||||
<!-- <TeamResult :show="show" :onClose="() => (show = false)" /> -->
|
||||
<MeleeResult :show="show" :onClose="() => (show = false)" />
|
||||
<TeamResult :show="show" :onClose="() => (show = false)" :data="data" />
|
||||
<!-- <MeleeResult :show="show" :onClose="() => (show = false)" /> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user