From d0e47266dac1aeeb93f0e737fa08ebb2ea5d3a78 Mon Sep 17 00:00:00 2001 From: ozh Date: Tue, 18 Aug 2026 17:38:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(scene):=20=E9=94=99=E8=AF=AF=E6=80=81?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=90=88=E6=B3=95=E6=80=A7=E3=80=81=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E6=95=B0=E7=BB=84=E6=A0=A1=E9=AA=8C=E4=B8=8E=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=E5=AD=97=E6=AE=B5=E5=BD=92=E4=B8=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/scene/select.vue | 5 +++-- store/scene.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pages/scene/select.vue b/pages/scene/select.vue index 1066980..aa06ea7 100644 --- a/pages/scene/select.vue +++ b/pages/scene/select.vue @@ -8,7 +8,7 @@ - + @@ -58,7 +58,8 @@ export default { this.loading = true this.loadError = false try { - this.sceneList = (await getSceneList()) || [] + const data = await getSceneList() + this.sceneList = Array.isArray(data) ? data : [] } catch (error) { this.loadError = true } finally { diff --git a/store/scene.js b/store/scene.js index 82ada65..24c608e 100644 --- a/store/scene.js +++ b/store/scene.js @@ -25,12 +25,12 @@ export function getCurrentScene() { } /** - * 设置当前场景并持久化。 + * 设置当前场景并持久化(仅保留 id/name,避免后端多余字段进缓存)。 * @param {{ id: *, name: string }} scene */ export function setCurrentScene(scene) { - currentScene = scene - uni.setStorageSync(STORAGE_KEY, scene) + currentScene = { id: scene.id, name: scene.name } + uni.setStorageSync(STORAGE_KEY, currentScene) } /**