细节修改
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>
|
||||
|
||||
@@ -59,6 +59,7 @@ onLoad(async (options) => {
|
||||
if (battleInfo) {
|
||||
battleId.value = battleInfo.id;
|
||||
start.value = true;
|
||||
startCount.value = true;
|
||||
tips.value = "请连续射出6支箭";
|
||||
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
||||
players.value.forEach((p) => {
|
||||
@@ -72,11 +73,8 @@ onLoad(async (options) => {
|
||||
}, 300);
|
||||
} else if (remain > 90 && remain <= 110) {
|
||||
halfTimeTip.value = true;
|
||||
total.value = 20;
|
||||
startCount.value = false;
|
||||
tips.value = "准备下半场";
|
||||
setTimeout(() => {
|
||||
uni.$emit("update-ramain", 110 - remain);
|
||||
}, 300);
|
||||
} else if (remain > 110) {
|
||||
setTimeout(() => {
|
||||
uni.$emit("update-ramain", remain - 110);
|
||||
@@ -135,7 +133,6 @@ async function onReceiveMessage(messages = []) {
|
||||
timerSeq.value = 0;
|
||||
tips.value = "请连续射出6支箭";
|
||||
scores.value = [];
|
||||
total.value = 90;
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||
if (msg.userId === user.value.id) {
|
||||
@@ -147,7 +144,6 @@ async function onReceiveMessage(messages = []) {
|
||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
startCount.value = false;
|
||||
halfTimeTip.value = true;
|
||||
total.value = 20;
|
||||
tips.value = "准备下半场";
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
@@ -210,7 +206,7 @@ onUnmounted(() => {
|
||||
:currentRound="scores.length"
|
||||
:totalRound="start ? 12 : 0"
|
||||
:scores="scores"
|
||||
:stop="halfTimeTip && !startCount"
|
||||
:stop="!startCount"
|
||||
/>
|
||||
<view :style="{ paddingBottom: '20px' }">
|
||||
<PlayerScore
|
||||
|
||||
@@ -143,7 +143,7 @@ onHide(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Container title="排行赛">
|
||||
<Container title="排位赛">
|
||||
<view class="container" @click="() => (showSeasonList = false)">
|
||||
<view class="ranking-my-data" v-if="user.id">
|
||||
<view>
|
||||
|
||||
Reference in New Issue
Block a user