add delete last place

This commit is contained in:
2026-08-02 15:09:43 +07:00
parent 33501fe4c7
commit d9c5791c68
4 changed files with 32 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-CmN4JLbq.js"></script> <script type="module" crossorigin src="/assets/index-BTOvroZP.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B11iM68d.css"> <link rel="stylesheet" crossorigin href="/assets/index-D7er9zH2.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
+28 -1
View File
@@ -4,12 +4,14 @@ import type { Place, Story } from '@/api/generated/crabs/evening_detective_serve
import HeaderMenu from '@/components/HeaderMenu.vue' import HeaderMenu from '@/components/HeaderMenu.vue'
import { NCard, NFlex, NInput, NModal, NSpace, NText, NUpload, NUploadDragger, NAlert, NTag, NButton } from 'naive-ui' import { NCard, NFlex, NInput, NModal, NSpace, NText, NUpload, NUploadDragger, NAlert, NTag, NButton } from 'naive-ui'
import { useMessage } from 'naive-ui'; import { useMessage } from 'naive-ui';
import { nextTick, ref } from 'vue'; import { nextTick, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import PlaceBlock from '@/components/PlaceBlock.vue' import PlaceBlock from '@/components/PlaceBlock.vue'
import GameInputForm from '@/components/GameInputForm.vue' import GameInputForm from '@/components/GameInputForm.vue'
import { useSimplePolling } from '@/composables/useSimplePolling'; import { useSimplePolling } from '@/composables/useSimplePolling';
import { useAuthStore } from '@/stores/auth';
const authStore = useAuthStore()
const client = getAuthClient() const client = getAuthClient()
const message = useMessage() const message = useMessage()
const route = useRoute() const route = useRoute()
@@ -104,6 +106,18 @@ type AdvancedPlace = {
mode: string; mode: string;
} }
async function deleteLast() {
const res = await client.DeleteLastTeamAction({
id: Number(teamId),
})
if (res.error != '') {
message.error(res.error!)
return
}
await getStory()
code.value = ''
}
useSimplePolling(() => { useSimplePolling(() => {
getStory() getStory()
}, 2000); }, 2000);
@@ -119,6 +133,12 @@ useSimplePolling(() => {
<PlaceBlock :place="advancedPlace.place" v-model:mode="advancedPlace.mode" <PlaceBlock :place="advancedPlace.place" v-model:mode="advancedPlace.mode"
v-for="advancedPlace in story.places" v-bind:key="advancedPlace.place.code" :addAction="addAction"> v-for="advancedPlace in story.places" v-bind:key="advancedPlace.place.code" :addAction="addAction">
</PlaceBlock> </PlaceBlock>
<div v-if="authStore.hasRole('author')" class="edit-panel">
<n-flex justify="end">
<n-button @click="deleteLast">Удалить последний ход</n-button>
</n-flex>
</div>
</div> </div>
</div> </div>
@@ -134,6 +154,13 @@ useSimplePolling(() => {
scroll-behavior: smooth; scroll-behavior: smooth;
} }
.edit-panel {
margin: 30px 0;
padding: 20px;
background-color: #222;
border-radius: 10px;
}
@media (width >=1024px) { @media (width >=1024px) {
.bottom-margin { .bottom-margin {
height: calc(100dvh - 70px - 76px); height: calc(100dvh - 70px - 76px);