generated from VLADIMIR/template_frontend
up
This commit is contained in:
@@ -215,6 +215,7 @@ getGameScreens()
|
||||
async function getScreenPlan() {
|
||||
if (screenPlanDirty.value) return
|
||||
const res = await client.GetScreenPlan({ gameID: Number(gameId) })
|
||||
if (screenPlanDirty.value) return
|
||||
screenPlan.value = res.plan
|
||||
screenPlanDraft.value = res.plan?.steps?.map((step) => ({ ...step })) || []
|
||||
}
|
||||
@@ -283,6 +284,26 @@ async function setScreenPlanStep(index: number) {
|
||||
}
|
||||
}
|
||||
|
||||
async function sendScreenPlanCommand(mode: ScreenMode | undefined, command: ScreenCommand) {
|
||||
if (
|
||||
screenPlanDirty.value ||
|
||||
(mode !== 'SCREEN_MODE_TIMER' && mode !== 'SCREEN_MODE_INTRO' && mode !== 'SCREEN_MODE_CONCLUSION')
|
||||
) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await client.SendScreenCommand({
|
||||
gameID: Number(gameId),
|
||||
command,
|
||||
positionMs: Math.max(0, Math.round(screenPosition.value * 1000)),
|
||||
volume: Math.max(0, Math.min(100, Math.round(screenVolume.value))),
|
||||
})
|
||||
await getGameScreens()
|
||||
} catch (err) {
|
||||
message.error(err instanceof Error ? err.message : 'Не удалось управлять экраном')
|
||||
}
|
||||
}
|
||||
|
||||
function stopScreenScanner() {
|
||||
cancelAnimationFrame(screenScannerFrame)
|
||||
screenScannerStream?.getTracks().forEach((track) => track.stop())
|
||||
@@ -952,6 +973,7 @@ useSimplePolling(() => {
|
||||
</n-button>
|
||||
</n-flex>
|
||||
</div>
|
||||
<template v-if="!screenPlan && !screenPlanDirty">
|
||||
<n-space class="screen-mode-controls">
|
||||
<n-button
|
||||
size="small"
|
||||
@@ -1040,6 +1062,7 @@ useSimplePolling(() => {
|
||||
>Перемотать</n-button
|
||||
>
|
||||
</n-space>
|
||||
</template>
|
||||
<div class="screen-plan">
|
||||
<n-flex align="center" justify="space-between">
|
||||
<p class="screens-title">План экранов</p>
|
||||
@@ -1111,6 +1134,47 @@ useSimplePolling(() => {
|
||||
>
|
||||
Показать
|
||||
</n-button>
|
||||
<template v-if="screenPlan?.currentStep === index && !screenPlanDirty">
|
||||
<template v-if="step.mode === 'SCREEN_MODE_TIMER'">
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_START')">
|
||||
Старт
|
||||
</n-button>
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_PAUSE')">
|
||||
Пауза
|
||||
</n-button>
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_RESUME')">
|
||||
Продолжить
|
||||
</n-button>
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_RESET')">
|
||||
Сбросить
|
||||
</n-button>
|
||||
</template>
|
||||
<template v-else-if="step.mode === 'SCREEN_MODE_INTRO' || step.mode === 'SCREEN_MODE_CONCLUSION'">
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_PLAY')">
|
||||
Запуск
|
||||
</n-button>
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_PAUSE')">
|
||||
Пауза
|
||||
</n-button>
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_RESUME')">
|
||||
Продолжить
|
||||
</n-button>
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_STOP')">
|
||||
Стоп
|
||||
</n-button>
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_REPLAY')">
|
||||
Повтор
|
||||
</n-button>
|
||||
<n-input-number v-model:value="screenVolume" :min="0" :max="100" :step="5" size="small" />
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_VOLUME')">
|
||||
Громкость
|
||||
</n-button>
|
||||
<n-input-number v-model:value="screenPosition" :min="0" :step="5" size="small" />
|
||||
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_SEEK')">
|
||||
Перемотать
|
||||
</n-button>
|
||||
</template>
|
||||
</template>
|
||||
</n-space>
|
||||
<n-space>
|
||||
<n-button size="small" @click="addScreenPlanStep">Добавить шаг</n-button>
|
||||
|
||||
Reference in New Issue
Block a user