generated from VLADIMIR/template_frontend
fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NConfigProvider, NFlex, NInput, NQrCode, NRate } from 'naive-ui'
|
||||
import { NAlert, NButton, NConfigProvider, NFlex, NInput, NQrCode, NRate } from 'naive-ui'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import { computed, nextTick, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
@@ -29,6 +29,7 @@ const password = route.query.password
|
||||
|
||||
const newPlacesCount = ref(0)
|
||||
const actions = ref<TeamAction[]>([])
|
||||
const storyError = ref('')
|
||||
|
||||
const scrollContainer = ref<HTMLDivElement | null>()
|
||||
|
||||
@@ -70,10 +71,18 @@ const isAtBottom = () => {
|
||||
async function getStory() {
|
||||
const oldStory = story.value
|
||||
|
||||
const res = await client.GetTeamStory({
|
||||
let res
|
||||
try {
|
||||
res = await client.GetTeamStory({
|
||||
ID: Number(teamId),
|
||||
password: password as string,
|
||||
})
|
||||
} catch (err) {
|
||||
storyError.value = 'Не удалось загрузить дело. Попробуйте обновить страницу.'
|
||||
console.error('Failed to load team story:', err)
|
||||
return
|
||||
}
|
||||
storyError.value = ''
|
||||
game.value = res.game
|
||||
|
||||
const wasAtBottom = isAtBottom()
|
||||
@@ -144,10 +153,18 @@ type AdvancedPlace = {
|
||||
const answers = ref<Record<string, string>>({})
|
||||
|
||||
async function getAnswers() {
|
||||
const res = await client.GetTeamAnswers({
|
||||
let res
|
||||
try {
|
||||
res = await client.GetTeamAnswers({
|
||||
ID: Number(teamId),
|
||||
password: password as string,
|
||||
})
|
||||
} catch (err) {
|
||||
storyError.value = 'Не удалось загрузить ответы команды. Попробуйте обновить страницу.'
|
||||
console.error('Failed to load team answers:', err)
|
||||
return
|
||||
}
|
||||
storyError.value = ''
|
||||
const next: Record<string, string> = {}
|
||||
for (const answer of res.answers || []) {
|
||||
next[answer.questionCode || ''] = answer.answer || ''
|
||||
@@ -277,6 +294,7 @@ useSimplePolling(() => {
|
||||
</MessagePaper>
|
||||
</div>
|
||||
<div v-else class="width700">
|
||||
<n-alert v-if="storyError" type="error" role="alert">{{ storyError }}</n-alert>
|
||||
<GameInputForm
|
||||
:addAction="addAction"
|
||||
:allPlacesCount="story.places.length"
|
||||
|
||||
Reference in New Issue
Block a user