From 713cf8a022c99573e81b6b29ed60ae3a6a16d9d2 Mon Sep 17 00:00:00 2001 From: chndfang Date: Sat, 17 May 2025 22:53:30 +0800 Subject: [PATCH] feat: load standard scene --- src/apis/scene/api.ts | 15 ++++++ src/pages/scene-editor.vue | 22 ++++++++- src/services/editor.service.ts | 85 ++++++++++++++++++++++------------ 3 files changed, 92 insertions(+), 30 deletions(-) diff --git a/src/apis/scene/api.ts b/src/apis/scene/api.ts index 6013460..32e1d24 100644 --- a/src/apis/scene/api.ts +++ b/src/apis/scene/api.ts @@ -6,6 +6,7 @@ import type { GroupSceneDetail, SceneDetail, SceneInfo } from './type'; const enum API { 获取场景 = '/scene/getById', 保存场景 = '/scene/saveById', + 推送场景 = '/scene/pushById', 获取组场景 = '/scene/getByGroupId', 保存组场景 = '/scene/saveByGroupId', @@ -39,6 +40,20 @@ export async function saveSceneById(id: SceneInfo['id'], json: string): Promise< } } +export async function pushSceneById(id: SceneInfo['id']): Promise { + if (!id) return false; + type B = { id: string }; + type D = void; + try { + const body = { id }; + await http.post(API.推送场景, body); + return true; + } catch (error) { + console.debug(error); + return false; + } +} + export async function getSceneByGroupId( id: RobotGroup['id'], sid: RobotGroup['sid'], diff --git a/src/pages/scene-editor.vue b/src/pages/scene-editor.vue index 8687a0c..053ce73 100644 --- a/src/pages/scene-editor.vue +++ b/src/pages/scene-editor.vue @@ -1,10 +1,12 @@