generated from VLADIMIR/template_frontend
add team story page
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">
|
<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-yi8XWh5X.js"></script>
|
<script type="module" crossorigin src="/assets/index-DX9rDVMw.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-CIDamrrf.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-Dg6DxD7l.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
@@ -1,11 +1,85 @@
|
|||||||
<script setup lang="ts">
|
<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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<HeaderMenu active="games" />
|
||||||
</template>
|
</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user