add team story page

This commit is contained in:
2026-07-29 01:57:20 +07:00
parent 12edf754bc
commit 90d1837565
4 changed files with 81 additions and 7 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">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Вечерний детектив</title>
<script type="module" crossorigin src="/assets/index-yi8XWh5X.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CIDamrrf.css">
<script type="module" crossorigin src="/assets/index-DX9rDVMw.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Dg6DxD7l.css">
</head>
<body>
<div id="app"></div>
+77 -3
View File
@@ -1,11 +1,85 @@
<script setup lang="ts">
import { getAuthClient } from '@/api/auth_client';
import type { Story } from '@/api/generated/crabs/evening_detective_server';
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 { ref } from 'vue';
import { useRoute } from 'vue-router';
import PlaceBlock from '@/components/PlaceBlock.vue'
const client = getAuthClient()
const message = useMessage()
const route = useRoute()
const teamId = route.params.id
const password = route.query.password
const story = ref<Story>({
places: undefined
})
const code = ref('')
async function getStory(id: number, password: string) {
const res = await client.GetTeamStory({
id: id,
password: password
})
if (res.error != '') {
message.error(res.error!)
return
}
story.value = res.story!
}
getStory(Number(teamId), password as string)
async function addAction(id: number, password: string) {
const res = await client.AddTeamAction({
id: id,
password: password,
code: code.value
})
if (res.error != '') {
message.error(res.error!)
return
}
await getStory(id, password)
code.value = ''
}
</script>
<template>
<div class="center-block-custom content-block">
История тут!
<div class="center-block-custom-big">
<div class="places-container">
<PlaceBlock :place="place" mode="show-editor" v-for="place in story.places" v-bind:key="place.code">
</PlaceBlock>
<n-space vertical>
<n-input v-model:value="code" type="text" placeholder="Ы-1" />
<n-button @click="addAction(Number(teamId), password as string)" ghost>Поехали</n-button>
</n-space>
</div>
</div>
<HeaderMenu active="games" />
</template>
<style scoped></style>
<style scoped>
.places-container {
display: flex;
flex-flow: column nowrap;
overflow-y: auto;
margin-top: 70px;
padding: 20px;
height: calc(100vh - 150px);
/* border: 1px solid red; */
}
@media (width >=1024px) {
.places-container {
padding: 20px 250px;
height: calc(100vh - 70px);
}
}
</style>