fix(web): 优化 HID 引导布局并取消完成后自动弹窗

This commit is contained in:
mofeng-git
2026-09-26 00:31:36 +08:00
parent 4cf3f4e252
commit 6010c39cd8
7 changed files with 51 additions and 64 deletions

View File

@@ -1,9 +1,7 @@
<script setup lang="ts">
import 'vue-sonner/style.css'
import HidDriverDialog from '@/components/HidDriverDialog.vue'
import { readPendingHid, type PendingHid } from '@/lib/hidGuide'
import '@/sonner-overrides.css'
import { computed, KeepAlive, onMounted, ref, watch } from 'vue'
import { computed, KeepAlive, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { RouterView, useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
@@ -26,11 +24,6 @@ const router = useRouter()
const authStore = useAuthStore()
const systemStore = useSystemStore()
const { isDark } = useTheme()
const pendingGuide = ref<PendingHid | null>(null)
watch(() => authStore.isAuthenticated, authenticated => {
pendingGuide.value = authenticated ? readPendingHid() : null
}, { immediate: true })
onMounted(async () => {
try {
await authStore.checkSetupStatus()
@@ -52,8 +45,7 @@ onMounted(async () => {
</script>
<template>
<HidDriverDialog v-if="pendingGuide && authStore.isAuthenticated" :pending="pendingGuide" @close="pendingGuide = null" />
<RouterView v-if="!pendingGuide" v-slot="{ Component, route }">
<RouterView v-slot="{ Component, route }">
<KeepAlive v-if="authStore.isAuthenticated">
<component :is="Component" v-if="route.name === 'Console'" />
</KeepAlive>