细节修改
This commit is contained in:
@@ -3,7 +3,7 @@ import { ref, onMounted } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import { getGameAPI, getHomeData } from "@/apis";
|
||||
import { topThreeColors } from "@/constants";
|
||||
import { topThreeColors, getBattleResultTips } from "@/constants";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
@@ -13,6 +13,7 @@ const { updateUser, getLvlName } = store;
|
||||
const ifWin = ref(false);
|
||||
const data = ref({});
|
||||
const totalPoints = ref(0);
|
||||
const rank = ref(0);
|
||||
|
||||
// onLoad(async (options) => {
|
||||
// battleId.value = options.battleId;
|
||||
@@ -40,9 +41,11 @@ function exit() {
|
||||
}
|
||||
onMounted(async () => {
|
||||
const battleInfo = uni.getStorageSync("last-battle");
|
||||
console.log("----battleInfo", battleInfo);
|
||||
// console.log("----battleInfo", battleInfo);
|
||||
data.value = battleInfo;
|
||||
const mine = battleInfo.playerStats.find((p) => p.id === user.value.id);
|
||||
rank.value =
|
||||
battleInfo.playerStats.findIndex((p) => p.id === user.value.id) + 1;
|
||||
if (mine) {
|
||||
if (battleInfo.mode === 1) {
|
||||
totalPoints.value = mine.roundStats.reduce(
|
||||
@@ -172,12 +175,15 @@ const checkBowData = () => {
|
||||
积分 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}
|
||||
</text>
|
||||
</view>
|
||||
<text v-if="data.mode === 1" class="description">{{
|
||||
ifWin ? "你已经奔跑在通向王者的路上了!" : "失败是成功之母,儿子在等你!"
|
||||
}}</text>
|
||||
<text v-if="data.mode === 2" class="description"
|
||||
>好成绩!全国排位赛等着你!</text
|
||||
>
|
||||
<text class="description">
|
||||
{{
|
||||
getBattleResultTips(data.battleMode, data.mode, {
|
||||
win: ifWin,
|
||||
score: totalPoints,
|
||||
rank,
|
||||
})
|
||||
}}
|
||||
</text>
|
||||
<view class="op-btn">
|
||||
<view @click="checkBowData">查看靶纸</view>
|
||||
<view @click="exit">退出</view>
|
||||
|
||||
Reference in New Issue
Block a user