diff --git a/bun.lockb b/bun.lockb index 60ea595..0ed1661 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 8b769d3..ac9456e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "bunx --bun vite", "build": "vite build", - "lint": "vite lint" + "lint": "vite lint", + "knip": "knip" }, "dependencies": { "@antfu/ni": "^24.3.0", @@ -53,6 +54,7 @@ "mitt": "^3.0.1", "monaco-editor": "^0.52.2", "music-metadata-browser": "^2.5.11", + "nanoid": "^5.1.5", "oxlint": "^0.16.2", "peerjs": "^1.5.4", "pinia": "^3.0.1", @@ -83,6 +85,7 @@ "@types/bun": "^1.2.5", "@types/eslint": "^9.6.1", "@types/file-saver": "^2.0.7", + "@types/node": "^22.14.1", "@types/obs-studio": "^2.17.2", "@types/uuid": "^10.0.0", "@typescript-eslint/parser": "^8.27.0", @@ -93,9 +96,10 @@ "eslint": "^9.23.0", "eslint-config-prettier": "^10.1.1", "eslint-plugin-vue": "^10.0.0", + "knip": "^5.50.4", "naive-ui": "^2.41.0", "stylus": "^0.64.0", - "typescript": "^5.8.2", + "typescript": "^5.8.3", "vue-vine": "^0.3.19" } } diff --git a/src/client/ClientDanmakuItem.vue b/src/client/ClientDanmakuItem.vue new file mode 100644 index 0000000..5766abf --- /dev/null +++ b/src/client/ClientDanmakuItem.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/client/ClientDanmakuWindow.vue b/src/client/ClientDanmakuWindow.vue index 829aa81..8928517 100644 --- a/src/client/ClientDanmakuWindow.vue +++ b/src/client/ClientDanmakuWindow.vue @@ -1,349 +1,310 @@ \ No newline at end of file diff --git a/src/client/ClientLayout.vue b/src/client/ClientLayout.vue index a22508e..852d01d 100644 --- a/src/client/ClientLayout.vue +++ b/src/client/ClientLayout.vue @@ -3,7 +3,7 @@ import { RouterLink, RouterView } from 'vue-router'; // 引入 Vue Router 组件 // 引入 Naive UI 组件 和 图标 - import { NA, NButton, NCard, NInput, NLayout, NLayoutSider, NLayoutContent, NMenu, NSpace, NSpin, NText, NTooltip } from 'naive-ui'; + import { NA, NButton, NCard, NInput, NLayout, NLayoutSider, NLayoutContent, NMenu, NSpace, NSpin, NText, NTooltip, MenuOption } from 'naive-ui'; import { CheckmarkCircle, CloseCircle, Home } from '@vicons/ionicons5'; // 引入 Tauri 插件 @@ -16,8 +16,9 @@ // 引入子组件 import WindowBar from './WindowBar.vue'; import { initAll, OnClientUnmounted } from './data/initialize'; -import { CloudArchive24Filled, Settings24Filled } from '@vicons/fluent'; -import { isTauri } from '@/data/constants'; + import { CloudArchive24Filled, Settings24Filled } from '@vicons/fluent'; + import { isTauri } from '@/data/constants'; +import { useDanmakuWindow } from './store/useDanmakuWindow'; // --- 响应式状态 --- @@ -25,6 +26,7 @@ import { isTauri } from '@/data/constants'; const webfetcher = useWebFetcher(); // 获取账户信息状态管理的实例 (如果 accountInfo 未使用,可以考虑移除) const accountInfo = useAccount(); + const danmakuWindow = useDanmakuWindow(); // 用于存储用户输入的 Token const token = ref(''); @@ -88,32 +90,35 @@ import { isTauri } from '@/data/constants'; // --- 导航菜单配置 --- // 将菜单项定义为常量,使模板更清晰 - const menuOptions = [ - { - label: () => - h(RouterLink, { to: { name: 'client-index' } }, () => '主页'), // 使用 h 函数渲染 RouterLink - key: 'go-back-home', - icon: () => h(Home) - }, - { - label: () => - h(RouterLink, { to: { name: 'client-fetcher' } }, () => 'EventFetcher'), - key: 'fetcher', - icon: () => h(CloudArchive24Filled) - }, - /*{ - label: () => - h(RouterLink, { to: { name: 'client-danmaku-window-manage' } }, () => '弹幕机管理'), - key: 'danmaku-window-manage', - icon: () => h(Settings24Filled) - },*/ - { - label: () => - h(RouterLink, { to: { name: 'client-settings' } }, () => '设置'), - key: 'settings', - icon: () => h(Settings24Filled) - }, - ]; + const menuOptions = computed(() => { + return [ + { + label: () => + h(RouterLink, { to: { name: 'client-index' } }, () => '主页'), // 使用 h 函数渲染 RouterLink + key: 'go-back-home', + icon: () => h(Home) + }, + { + label: () => + h(RouterLink, { to: { name: 'client-fetcher' } }, () => 'EventFetcher'), + key: 'fetcher', + icon: () => h(CloudArchive24Filled) + }, + { + label: () => + h(RouterLink, { to: { name: 'client-danmaku-window-manage' } }, () => '弹幕机管理'), + key: 'danmaku-window-manage', + icon: () => h(Settings24Filled), + show: danmakuWindow.danmakuWindow != undefined + }, + { + label: () => + h(RouterLink, { to: { name: 'client-settings' } }, () => '设置'), + key: 'settings', + icon: () => h(Settings24Filled) + }, + ] as MenuOption[]; + }); onMounted(() => { window.addEventListener('beforeunload', (event) => { diff --git a/src/client/DanmakuWindowManager.vue b/src/client/DanmakuWindowManager.vue index 788f2e0..b9d9dfb 100644 --- a/src/client/DanmakuWindowManager.vue +++ b/src/client/DanmakuWindowManager.vue @@ -1,23 +1,11 @@