From 39d0958a2ba04167162f9783c1995709690ad939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E6=B1=89?= <5725748+qin_and_han_dynasties@user.noreply.gitee.com> Date: Sun, 12 Apr 2026 21:13:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E7=94=A8=E9=80=80=E5=87=BA=E5=88=B0?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E9=80=89=E6=8B=A9=E7=95=8C=E9=9D=A2=E5=B0=B1?= =?UTF-8?q?=E8=83=BD=E5=88=B7=E6=96=B0=E4=BA=BA=E7=89=A9=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build_God_Game/src/views/GameView.vue | 12 +++++++++++- Build_God_Game/src/views/ScrapView.vue | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Build_God_Game/src/views/GameView.vue b/Build_God_Game/src/views/GameView.vue index 5afb82a..e4d84d2 100644 --- a/Build_God_Game/src/views/GameView.vue +++ b/Build_God_Game/src/views/GameView.vue @@ -75,10 +75,20 @@ const navigateTo = (item: { label: string }) => { } else if (item.label === '捡垃圾') { router.push('/scrap') } else if (item.label === '角色') { - showCharacterDetail.value = true + openCharacterDetail() } } +const openCharacterDetail = async () => { + await characterStore.fetchCharacters() + const current = characterStore.characters.find(c => c.id === characterStore.currentCharacter?.id) + if (current) { + characterStore.currentCharacter = current + localStorage.setItem('current_character', JSON.stringify(current)) + } + showCharacterDetail.value = true +} + const handleBreakthrough = async () => { const result = await characterStore.breakthrough() breakthroughMessage.value = result.message diff --git a/Build_God_Game/src/views/ScrapView.vue b/Build_God_Game/src/views/ScrapView.vue index 24dd5d1..48fa9ac 100644 --- a/Build_God_Game/src/views/ScrapView.vue +++ b/Build_God_Game/src/views/ScrapView.vue @@ -44,11 +44,16 @@ const startScanning = async () => { }, 1000) } -const performScan = async () => { + const performScan = async () => { try { const result = await scrapApi.scanScrap(characterId.value) scanResult.value = result await characterStore.fetchCharacters() + const updatedChar = characterStore.characters.find(c => c.id === characterId.value) + if (updatedChar) { + characterStore.currentCharacter = updatedChar + localStorage.setItem('current_character', JSON.stringify(updatedChar)) + } } catch (error: unknown) { errorMessage.value = error instanceof Error ? error.message : String(error) } finally {