generated from VLADIMIR/template_frontend
add delete last place
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">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Вечерний детектив</title>
|
||||
<script type="module" crossorigin src="/assets/index-CmN4JLbq.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-B11iM68d.css">
|
||||
<script type="module" crossorigin src="/assets/index-BTOvroZP.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-D7er9zH2.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -4,12 +4,14 @@ import type { Place, Story } from '@/api/generated/crabs/evening_detective_serve
|
||||
import HeaderMenu from '@/components/HeaderMenu.vue'
|
||||
import { NCard, NFlex, NInput, NModal, NSpace, NText, NUpload, NUploadDragger, NAlert, NTag, NButton } 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 PlaceBlock from '@/components/PlaceBlock.vue'
|
||||
import GameInputForm from '@/components/GameInputForm.vue'
|
||||
import { useSimplePolling } from '@/composables/useSimplePolling';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const client = getAuthClient()
|
||||
const message = useMessage()
|
||||
const route = useRoute()
|
||||
@@ -104,6 +106,18 @@ type AdvancedPlace = {
|
||||
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(() => {
|
||||
getStory()
|
||||
}, 2000);
|
||||
@@ -119,6 +133,12 @@ useSimplePolling(() => {
|
||||
<PlaceBlock :place="advancedPlace.place" v-model:mode="advancedPlace.mode"
|
||||
v-for="advancedPlace in story.places" v-bind:key="advancedPlace.place.code" :addAction="addAction">
|
||||
</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>
|
||||
|
||||
@@ -134,6 +154,13 @@ useSimplePolling(() => {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
.edit-panel {
|
||||
margin: 30px 0;
|
||||
padding: 20px;
|
||||
background-color: #222;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@media (width >=1024px) {
|
||||
.bottom-margin {
|
||||
height: calc(100dvh - 70px - 76px);
|
||||
|
||||
Reference in New Issue
Block a user