比赛结果数据源修改
This commit is contained in:
@@ -22,7 +22,7 @@ const { user } = storeToRefs(store);
|
||||
const gameType = ref(0);
|
||||
const teamSize = ref(0);
|
||||
const start = ref(false);
|
||||
const countDown = ref(90);
|
||||
const startCount = ref(false);
|
||||
const battleId = ref("");
|
||||
const currentRound = ref(1);
|
||||
const power = ref(0);
|
||||
@@ -35,6 +35,7 @@ const playersSorted = ref([]);
|
||||
const playersScores = ref({});
|
||||
const halfTimeTip = ref(false);
|
||||
const onComplete = ref(null);
|
||||
const total = ref(90);
|
||||
|
||||
watch(
|
||||
() => [players.value, playersScores.value],
|
||||
@@ -53,7 +54,7 @@ watch(
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.battleId) {
|
||||
const battleInfo = uni.getStorageSync(`battle-${options.battleId}`);
|
||||
const battleInfo = uni.getStorageSync("current-battle");
|
||||
console.log("----battleInfo", battleInfo);
|
||||
if (battleInfo) {
|
||||
battleId.value = battleInfo.id;
|
||||
@@ -71,7 +72,7 @@ onLoad(async (options) => {
|
||||
}, 300);
|
||||
} else if (remain > 90 && remain <= 110) {
|
||||
halfTimeTip.value = true;
|
||||
countDown.value = 20;
|
||||
total.value = 20;
|
||||
tips.value = "准备下半场";
|
||||
setTimeout(() => {
|
||||
uni.$emit("update-ramain", 110 - remain);
|
||||
@@ -129,11 +130,12 @@ async function onReceiveMessage(messages = []) {
|
||||
if (msg.id !== battleId.value) return;
|
||||
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
||||
start.value = true;
|
||||
startCount.value = true;
|
||||
seq.value += 1;
|
||||
timerSeq.value = 0;
|
||||
tips.value = "请连续射出6支箭";
|
||||
scores.value = [];
|
||||
countDown.value = 90;
|
||||
total.value = 90;
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||
if (msg.userId === user.value.id) {
|
||||
@@ -143,11 +145,13 @@ async function onReceiveMessage(messages = []) {
|
||||
playersScores.value[msg.userId].push(msg.target);
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
startCount.value = false;
|
||||
halfTimeTip.value = true;
|
||||
countDown.value = 20;
|
||||
total.value = 20;
|
||||
tips.value = "准备下半场";
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
uni.setStorageSync("last-battle", msg.endStatus);
|
||||
uni.redirectTo({
|
||||
url: `/pages/battle-result?battleId=${msg.id}`,
|
||||
});
|
||||
@@ -192,9 +196,9 @@ onUnmounted(() => {
|
||||
<ShootProgress
|
||||
v-if="start"
|
||||
:seq="seq"
|
||||
:start="start"
|
||||
:start="start && startCount"
|
||||
:tips="tips"
|
||||
:total="countDown"
|
||||
:total="total"
|
||||
:melee="true"
|
||||
/>
|
||||
<view v-if="start" class="user-row">
|
||||
@@ -207,6 +211,7 @@ onUnmounted(() => {
|
||||
:currentRound="scores.length"
|
||||
:totalRound="start ? 12 : 0"
|
||||
:scores="scores"
|
||||
:stop="halfTimeTip && !startCount"
|
||||
/>
|
||||
<view :style="{ paddingBottom: '20px' }">
|
||||
<PlayerScore
|
||||
|
||||
Reference in New Issue
Block a user