Compare commits

..

2 Commits

Author SHA1 Message Date
VLADIMIR bb8fca352a add delete game button 2026-08-18 01:23:42 +07:00
VLADIMIR ffa80a19ad fix 2026-08-08 18:20:43 +07:00
5 changed files with 48 additions and 5 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -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-Dn-IZW42.js"></script> <script type="module" crossorigin src="/assets/index-B54R2K0c.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CZManGvh.css"> <link rel="stylesheet" crossorigin href="/assets/index-BdDl0UCc.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
+43
View File
@@ -25,7 +25,9 @@ const showSettingsModal = ref(false)
const showGiveApplicationModal = ref(false) const showGiveApplicationModal = ref(false)
const showAddTeamModal = ref(false) const showAddTeamModal = ref(false)
const showDeleteTeamModal = ref(false) const showDeleteTeamModal = ref(false)
const showDeleteGameModal = ref(false)
const newTeamName = ref('') const newTeamName = ref('')
const deletedGameName = ref('')
const showQR = ref(false) const showQR = ref(false)
const urlQR = ref('') const urlQR = ref('')
const titleQR = ref('') const titleQR = ref('')
@@ -176,6 +178,18 @@ async function confirmDeleteTeam() {
showDeleteTeamModal.value = false showDeleteTeamModal.value = false
} }
async function deleteGame() {
const res = await client.DeleteGame({
id: game.value.id,
})
if (res.error != '') {
message.error(res.error!)
return
}
message.success('Игра удалена')
router.push('/games')
}
function getTeamStoryURL(id: number, password: string): string { function getTeamStoryURL(id: number, password: string): string {
return getURL() + '/team-story/' + id + '?password=' + password return getURL() + '/team-story/' + id + '?password=' + password
} }
@@ -323,6 +337,10 @@ useSimplePolling(() => {
</Icon> </Icon>
Настройки Настройки
</n-button> </n-button>
<n-button v-if="(game.teams?.length || 0) == 0" type="error" quaternary
@click="showDeleteGameModal = true" class="settings-button">
Удалить игру
</n-button>
<n-space> <n-space>
<n-button type="info" v-if="game.status != 'draft'" dashed @click="resetGame()"> <n-button type="info" v-if="game.status != 'draft'" dashed @click="resetGame()">
@@ -485,6 +503,31 @@ useSimplePolling(() => {
</n-card> </n-card>
</n-modal> </n-modal>
<!-- Окно удаления игры -->
<n-modal v-model:show="showDeleteGameModal">
<n-card style="width: 600px" title="Удаление игры" :bordered="false" size="huge" role="dialog"
aria-modal="true">
<template #header-extra>
<n-button @click="showDeleteGameModal = false"> x </n-button>
</template>
<n-space vertical>
<p>
Введите название игры
<n-text class="name-text" strong>{{ game.name }}</n-text> чтобы удалить её
</p>
<n-input v-model:value="deletedGameName" type="text" placeholder='Дело №0 "Следствие ведут овечки"' />
</n-space>
<template #footer>
<n-flex justify="end">
<n-button @click="deleteGame()" :disabled="deletedGameName != game.name">
Удалить
</n-button>
</n-flex>
</template>
</n-card>
</n-modal>
<!-- Окно qr --> <!-- Окно qr -->
<n-modal v-model:show="showQR"> <n-modal v-model:show="showQR">
<n-card style="width: 600px" :title="titleQR" :bordered="false" size="huge" role="dialog" aria-modal="true"> <n-card style="width: 600px" :title="titleQR" :bordered="false" size="huge" role="dialog" aria-modal="true">
+1 -1
View File
@@ -225,7 +225,7 @@ function onCreateKey(): Key {
<template #action="{ index, create, remove }"> <template #action="{ index, create, remove }">
<div style="display: flex; flex-direction: column;"> <div style="display: flex; flex-direction: column;">
<n-button @click="() => create(index)" class="plus-minus-buttons">+</n-button> <n-button @click="() => create(index)" class="plus-minus-buttons">+</n-button>
<n-button disabled @click="() => remove(index)" class="plus-minus-buttons">-</n-button> <n-button @click="() => remove(index)" class="plus-minus-buttons">-</n-button>
</div> </div>
</template> </template>
<template #default="{ value: door }"> <template #default="{ value: door }">