This commit is contained in:
Владимир Фёдоров 2025-07-13 03:33:08 +07:00
parent 0742f742d9
commit b8d46d0021
6 changed files with 61 additions and 18 deletions

View File

@ -1,14 +1,5 @@
@import './base.css'; @import './base.css';
.header-block {
background-color: var(--main-color);
font-size: large;
color: white;
vertical-align: middle;
padding: 10px 0 10px 16px;
font-weight: 700;
}
.input-custom { .input-custom {
width: 100%; width: 100%;
box-sizing: border-box; /* обязательно! */ box-sizing: border-box; /* обязательно! */

View File

@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import router from '@/router'; import router from '@/router';
import type { Game, Teams } from './models'; import type { Game, Team, Teams } from './models';
import { apiGetTeams, apiAddTeam, apiGetGame, apiStartGame, apiStopGame, apiGaveApplication, apiDownloadQrCodesFile } from './client'; import { apiGetTeams, apiAddTeam, apiGetGame, apiStartGame, apiStopGame, apiGaveApplication, apiDownloadQrCodesFile } from './client';
import TeamQRCode from '../components/TeamQRCode.vue' import TeamQRCode from '../components/TeamQRCode.vue'
import HeaderBlock from './HeaderBlock.vue';
const qrurl = ref("-") const qrurl = ref("-")
const qrteam = ref("-") const qrteam = ref("-")
@ -42,12 +43,17 @@ async function getGame() {
} }
} }
function compareTeams(a: Team, b: Team): number {
return b.applications.length - a.applications.length
}
let intervalId = 0 let intervalId = 0
onMounted(async () => { onMounted(async () => {
teams.value = await apiGetTeams() teams.value = await apiGetTeams()
intervalId = setInterval(async () => { intervalId = setInterval(async () => {
teams.value = await apiGetTeams() teams.value = await apiGetTeams()
teams.value.teams.sort(compareTeams)
await getGame() await getGame()
}, 2000); }, 2000);
@ -59,15 +65,16 @@ onMounted(async () => {
</script> </script>
<template> <template>
<div class="header-block"> <HeaderBlock>
<div> <div>
Вечерний детектив - {{ gameState }} Вечерний детектив - {{ gameState }}
</div> </div>
<div class="buttons-block"> <div class="buttons-block">
<button v-on:click="startGame" class="button-menu button-custom-inline">Начать</button> <button v-on:click="startGame" class="button-menu button-custom-inline">Начать</button>
<button v-on:click="stopGame" class="button-menu button-custom-inline">Остановить</button> <button v-on:click="stopGame" class="button-menu button-custom-inline">Остановить</button>
<button v-on:click="apiDownloadQrCodesFile" class="button-menu button-custom-inline">Скачать&nbsp;qrы</button>
</div> </div>
</div> </HeaderBlock>
<TeamQRCode :data="qrurl" :title="qrteam" /> <TeamQRCode :data="qrurl" :title="qrteam" />
@ -78,7 +85,7 @@ onMounted(async () => {
<th>Название команды</th> <th>Название команды</th>
<th>Поездки</th> <th>Поездки</th>
<th>Приложения</th> <th>Приложения</th>
<th><button v-on:click="apiDownloadQrCodesFile" class="button-custom-inline">Скачать&nbsp;qrы</button></th> <th>Qr</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -1,11 +1,32 @@
<script setup lang="ts"> <script setup lang="ts">
import HeaderBlock from './HeaderBlock.vue';
</script> </script>
<template> <template>
<p>Я редактор сценариев</p> <HeaderBlock>
<div>
Редактор сценариев
</div>
</HeaderBlock>
<div class="three-columns">
<div class="column left">Левая (узкая)</div>
<div class="column center">Центральная (широкая)</div>
<div class="column right">Правая (узкая)</div>
</div>
</template> </template>
<style scoped> <style scoped>
.three-columns {
display: grid;
grid-template-columns: 1fr 2fr 1fr; /* Соотношение 1:2:1 */
gap: 20px;
height: 100%;
}
.column {
border: 1px solid #e0e0e0;
padding: 20px;
margin: 5px;
}
</style> </style>

View File

@ -1,9 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import HeaderBlock from './HeaderBlock.vue';
</script> </script>
<template> <template>
<p>Я каталог игр</p> <HeaderBlock>
<div>
Каталог игр
</div>
</HeaderBlock>
</template> </template>
<style scoped> <style scoped>

View File

@ -0,0 +1,20 @@
<script setup lang="ts">
</script>
<template>
<div class="header-block">
<slot />
</div>
</template>
<style scoped>
.header-block {
background-color: var(--main-color);
font-size: large;
color: white;
vertical-align: middle;
padding: 10px 0 10px 16px;
font-weight: 700;
}
</style>

View File

@ -20,7 +20,7 @@
<style scoped> <style scoped>
.qr { .qr {
position: absolute; position: absolute;
top: 80px; top: 130px;
right: 30px; right: 30px;
text-align: center; text-align: center;
width: 120px; width: 120px;