From 16114bb1344dd5627e2fc35687d1885c19a9acf3 Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Tue, 21 Jul 2026 00:32:31 +0700 Subject: [PATCH] update editor --- src/components/PlaceBlock.vue | 212 +++++++++++++++++-------- src/components/ScenariosEditorPage.vue | 82 +++++----- 2 files changed, 189 insertions(+), 105 deletions(-) diff --git a/src/components/PlaceBlock.vue b/src/components/PlaceBlock.vue index 0d0d5e2..ce78ce9 100644 --- a/src/components/PlaceBlock.vue +++ b/src/components/PlaceBlock.vue @@ -1,7 +1,9 @@ diff --git a/src/components/ScenariosEditorPage.vue b/src/components/ScenariosEditorPage.vue index d1dae29..a7dda93 100644 --- a/src/components/ScenariosEditorPage.vue +++ b/src/components/ScenariosEditorPage.vue @@ -126,9 +126,37 @@ async function addPlace() { applications: undefined, doors: undefined, keys: undefined, + mode: 'add' } } +async function addNotFoundDoors(scenario: Scenario, place: Place) { + place.doors?.forEach(async (door) => { + let place = scenario.story?.places?.find((place) => { + return place.code == door.code + }) + if (place == undefined) { + const res = await client.AddScenarioPlace({ + id: scenario.id, + place: { + code: door.code, + name: door.name, + text: undefined, + image: undefined, + hidden: undefined, + applications: undefined, + doors: undefined, + keys: undefined + }, + }) + if (res.error != '') { + message.error(res.error!) + return + } + } + }) +} + async function collapseAddPlace(place: Place) { place.mode = 'mini-add' } @@ -140,6 +168,7 @@ async function cancelUpdatePlace(place: Place) { } async function updatePlace(place: Place) { + await addNotFoundDoors(scenario.value, place) const res = await client.UpdateScenarioPlace({ id: scenario.value.id, code: place.oldCode, @@ -188,12 +217,8 @@ async function deletePlace(place: Place) { - + Удалить Отмена @@ -205,39 +230,20 @@ async function deletePlace(place: Place) { - +

Название

- +

Описание

- +

Картинка

- + @@ -254,17 +260,9 @@ async function deletePlace(place: Place) { Введите название сценария {{ scenario.name }} чтобы удалить его

- - + + Удалить сценарий
@@ -312,7 +310,7 @@ async function deletePlace(place: Place) { /* border: 1px solid red; */ } -@media (width >= 1024px) { +@media (width >=1024px) { .places-container { padding: 20px 250px; height: calc(100vh - 70px);