add welcome block

This commit is contained in:
Владимир Фёдоров 2026-03-22 01:33:21 +07:00
parent e8158eb746
commit 9e6ee6e7c3
2 changed files with 51 additions and 28 deletions

View File

@ -1,13 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, nextTick, watch, onMounted } from 'vue'; import { ref, nextTick, watch, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import VueQrcode from '@chenfengyuan/vue-qrcode';
import BeltBlock from './BeltBlock.vue'; import BeltBlock from './BeltBlock.vue';
import MetalPlate from './MetalPlate.vue'; import MetalPlate from './MetalPlate.vue';
import GameHeader from './GameHeader.vue'; import GameHeader from './GameHeader.vue';
import type { Action, Door, Team } from './models'; import type { Action, Door, Team } from './models';
import { apiGetGame, apiGetTeam, apiLetsgo } from './client'; import { apiGetGame, apiGetTeam, apiLetsgo } from './client';
import { UnauthorizedError } from './UnauthorizedError'; import { UnauthorizedError } from './UnauthorizedError';
import WelcomeGameBlock from './WelcomeGameBlock.vue';
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
@ -23,22 +23,6 @@ const gameState = ref("STOP")
const gameStateText = ref("") const gameStateText = ref("")
const qrurl = ref("-") const qrurl = ref("-")
interface QROptions {
width?: number;
margin?: number;
color?: {
dark: string;
light: string;
};
}
const qrOptions = ref<QROptions>({
width: 200,
margin: 1,
color: {
dark: '#303030',
light: 'f0f0f0'
}
});
async function getTeam() { async function getTeam() {
let data: Team let data: Team
@ -181,12 +165,7 @@ onMounted(() => {
<div class="center-block-custom"> <div class="center-block-custom">
<div v-if="!team || !team.actions.length"> <div v-if="!team || !team.actions.length">
<div class="center-message"> <div class="center-message">
<div class="qr"> <WelcomeGameBlock :qrurl="qrurl" :team="team.name"></WelcomeGameBlock>
<VueQrcode :value="qrurl" :options="qrOptions" tag="svg" class="qr-code" />
<div>
Пора решать загадку
</div>
</div>
</div> </div>
</div> </div>
<div v-else> <div v-else>
@ -321,11 +300,6 @@ body {
height: calc(100dvh - 140px); height: calc(100dvh - 140px);
} }
.qr {
text-align: center;
width: 200px;
}
.collapse-icon { .collapse-icon {
padding: 0 15px; padding: 0 15px;
cursor: pointer; cursor: pointer;

View File

@ -0,0 +1,49 @@
<script setup lang="ts">
import { ref } from 'vue';
import VueQrcode from '@chenfengyuan/vue-qrcode';
interface QROptions {
width?: number;
margin?: number;
color?: {
dark: string;
light: string;
};
}
const qrOptions = ref<QROptions>({
width: 200,
margin: 1,
color: {
dark: '#303030',
light: 'f0f0f0'
}
});
interface Props {
qrurl: string
team: string
}
const props = withDefaults(defineProps<Props>(), {})
</script>
<template>
<div>
<div class="qr">
<div>
{{ team }}
</div>
<VueQrcode :value="props.qrurl" :options="qrOptions" tag="svg" class="qr-code" />
<div>
Пора решать загадку
</div>
</div>
</div>
</template>
<style scoped>
.qr {
text-align: center;
width: 200px;
}
</style>