Skip to content

Commit

Permalink
fix 修复重连游戏的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien8261 committed May 31, 2024
1 parent 6135172 commit 6c80f5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
24 changes: 19 additions & 5 deletions src/desktop/views/game/SchulteGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
:key="index"
@click="selectedSkill = item"
>
<div class="badge" v-if="item.PlayerId">
<icon :icon="Check" />
{{ playersMap[item.PlayerId].name }}
<div class="badge" :class="{ leaved: !playersMap[item.PlayerId] }" v-if="item.PlayerId">
<template v-if="playersMap[item.PlayerId]">
<icon :icon="Check" />
{{ playersMap[item.PlayerId].name }}
</template>
<template v-else>
<icon :icon="Close" />
已离开
</template>
</div>
<span>{{ item.CharacterName }} - {{ item.SkillName }}</span>
</n-button>
Expand Down Expand Up @@ -91,7 +97,7 @@
import type { CSSProperties } from 'vue'
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { Check } from '@icon-park/vue-next'
import { Check, Close } from '@icon-park/vue-next'
import { useGameHubStore } from '@/stores/gamehub'
import { listToDict } from '@/utils'
import type { SignalrResponse } from '@/api/signalr'
Expand Down Expand Up @@ -214,7 +220,11 @@ const playersRanking = computed(() => {
watch(
computed(() => answersDisplay.value.length),
() => {
nextTick(() => (asd.value.scrollTop = asd.value.scrollHeight))
nextTick(() => {
if (asd.value) {
asd.value.scrollTop = asd.value.scrollHeight
}
})
},
{ deep: true }
)
Expand Down Expand Up @@ -482,6 +492,10 @@ $guideHeight: 160px;
position: absolute;
top: -8px;
left: -8px;
&.leaved {
background-color: #e91e63;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/views/room/WaitingRoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async function gameInfoListener(response: SignalrResponse) {
})
if (response.GameStarted) {
await startGame()
await gameStartedListener()
}
}
Expand Down

0 comments on commit 6c80f5a

Please sign in to comment.