add rt game teams

This commit is contained in:
2026-08-03 02:23:36 +07:00
parent 489e9c0bec
commit 2241c33902
4 changed files with 35 additions and 4 deletions
+31
View File
@@ -11,6 +11,7 @@ import { useMessage } from 'naive-ui';
import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { getURL } from '@/api/generated/crabs/evening_detective_server/client';
import { useSimplePolling } from '@/composables/useSimplePolling';
const client = getAuthClient()
const router = useRouter()
@@ -44,6 +45,32 @@ async function getGame(id: number) {
return
}
game.value = res.game!
game.value.teams = game.value.teams?.sort((a, b) => {
let aLen = 0
if ((a.applications?.length || 0) > 0) {
aLen = 1
}
let bLen = 0
if ((b.applications?.length || 0) > 0) {
bLen = 1
}
if (aLen > bLen) {
return -1
}
if (aLen < bLen) {
return 1
}
const aName = a.name || ''
const bName = b.name || ''
if (aName > bName) {
return 1
}
if (aName < bName) {
return -1
}
return 0
})
}
getGame(Number(gameId))
@@ -148,6 +175,10 @@ async function openQR(url: string) {
urlQR.value = url
showQR.value = true
}
useSimplePolling(() => {
getGame(Number(gameId))
}, 2000);
</script>
<template>