generated from VLADIMIR/template_frontend
add rt game teams
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Вечерний детектив</title>
|
<title>Вечерний детектив</title>
|
||||||
<script type="module" crossorigin src="/assets/index-BHzMN3F_.js"></script>
|
<script type="module" crossorigin src="/assets/index-DaRs3nRs.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-sUhe8JqG.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-x53yzfRc.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { useMessage } from 'naive-ui';
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { getURL } from '@/api/generated/crabs/evening_detective_server/client';
|
import { getURL } from '@/api/generated/crabs/evening_detective_server/client';
|
||||||
|
import { useSimplePolling } from '@/composables/useSimplePolling';
|
||||||
|
|
||||||
const client = getAuthClient()
|
const client = getAuthClient()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -44,6 +45,32 @@ async function getGame(id: number) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
game.value = res.game!
|
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))
|
getGame(Number(gameId))
|
||||||
|
|
||||||
@@ -148,6 +175,10 @@ async function openQR(url: string) {
|
|||||||
urlQR.value = url
|
urlQR.value = url
|
||||||
showQR.value = true
|
showQR.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useSimplePolling(() => {
|
||||||
|
getGame(Number(gameId))
|
||||||
|
}, 2000);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user