Browse Source

不用退出到角色选择界面就能刷新人物属性

master
秦汉 1 month ago
parent
commit
39d0958a2b
  1. 12
      Build_God_Game/src/views/GameView.vue
  2. 5
      Build_God_Game/src/views/ScrapView.vue

12
Build_God_Game/src/views/GameView.vue

@ -75,8 +75,18 @@ const navigateTo = (item: { label: string }) => {
} else if (item.label === '捡垃圾') { } else if (item.label === '捡垃圾') {
router.push('/scrap') router.push('/scrap')
} else if (item.label === '角色') { } 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 handleBreakthrough = async () => {

5
Build_God_Game/src/views/ScrapView.vue

@ -49,6 +49,11 @@ const performScan = async () => {
const result = await scrapApi.scanScrap(characterId.value) const result = await scrapApi.scanScrap(characterId.value)
scanResult.value = result scanResult.value = result
await characterStore.fetchCharacters() 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) { } catch (error: unknown) {
errorMessage.value = error instanceof Error ? error.message : String(error) errorMessage.value = error instanceof Error ? error.message : String(error)
} finally { } finally {

Loading…
Cancel
Save