细节调整及优化(26.8.3)

This commit is contained in:
zhongluofeng
2026-08-21 17:25:47 +08:00
parent 0a19b4b38a
commit 4dd60f42a1
72 changed files with 4779 additions and 1395 deletions
+12 -4
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, onUnmounted, watch, nextTick } from 'vue'
import { open } from '@tauri-apps/plugin-dialog'
import { listen, type UnlistenFn } from '@tauri-apps/api/event'
import { toast } from 'vue-sonner'
// Rust 端通过 tauri-specta 生成的命令绑定(bindings.ts
import { commands } from '@/lib/bindings'
@@ -10,7 +11,7 @@ import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { useModuleTabsStore } from '@/stores/moduleTabsStore'
import { setFileIndexReady, invalidateCustomCommandsCache } from './providers'
import { STORAGE_KEYS } from '@/lib/constants'
import { STORAGE_KEYS, EVENTS } from '@/lib/constants'
interface CustomCommand {
id: string
@@ -43,6 +44,8 @@ interface IndexStats {
}
const indexStats = ref<IndexStats | null>(null)
const building = ref(false)
// 索引构建完成事件监听器(onUnmounted 时注销)
let indexUpdatedUnlisten: UnlistenFn | null = null
async function refreshStats() {
try {
@@ -96,6 +99,10 @@ onMounted(async () => {
console.error('[quickpanel] 读取设置失败:', e)
}
await refreshStats()
// 监听索引构建完成事件(闲时自动建立/重建):刷新统计,无需手动刷新
indexUpdatedUnlisten = await listen<number>(EVENTS.quickpanelIndexUpdated, () => {
void refreshStats()
})
})
// ===== 保存 =====
@@ -233,6 +240,7 @@ async function clearShortcut() {
onUnmounted(() => {
window.removeEventListener('keydown', onRecordKey, true)
indexUpdatedUnlisten?.()
// 注销保存处理函数与标签状态,防止其他模块 activeTab=settings 时误执行本模块 saveSettings
tabsStore.unregisterTabs()
})
@@ -515,8 +523,8 @@ async function changeEngine(v: string) {
</CardHeader>
<CardContent class="space-y-2">
<div class="flex items-center gap-2 text-sm">
<Badge variant="secondary">命令</Badge>
<span class="text-muted-foreground">跳转到已启用模块</span>
<Badge variant="secondary">设置</Badge>
<span class="text-muted-foreground">本程序模块导航与退出应用搜索时显示不占用默认视图</span>
</div>
<div class="flex items-center gap-2 text-sm">
<Badge variant="secondary">自定义</Badge>
@@ -556,7 +564,7 @@ async function changeEngine(v: string) {
</div>
<div class="flex items-center gap-2 text-sm">
<Badge variant="secondary">系统</Badge>
<span class="text-muted-foreground">系统命令注册表CMD/PowerShell任务管理器控制面板关机/重启/休眠及锁屏退出应用</span>
<span class="text-muted-foreground">系统命令注册表CMD/PowerShell任务管理器控制面板关机/重启/休眠及锁屏打开面板默认显示</span>
</div>
<div class="flex items-center gap-2 text-sm">
<Badge variant="secondary">网页</Badge>