From 9a215a89e98f014d87dc9d43fe7302523d4cfd0a Mon Sep 17 00:00:00 2001 From: Peanut Date: Tue, 21 Jul 2026 08:39:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E7=94=9F=E6=88=90=E7=9F=AD?= =?UTF-8?q?=E7=AF=87=E5=89=A7=E6=9C=AC=E5=88=B7=E6=96=B0=E5=88=B0=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=88=97=E8=A1=A8=20+=20=E5=88=86=E7=B1=BB=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E4=BB=8E=E5=AE=9E=E9=99=85=E6=95=B0=E6=8D=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - novel_done 事件处理中调用 store.fetchScripts() 刷新剧本列表 - typeTabs 从硬编码改为 computed,根据实际 length 值动态生成 - activeType 默认值从 'long' 改为 'all'(显示全部) - 过滤逻辑改为精确匹配 length 字段 - 移除无效的 '风格' 硬编码分类标签 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/pages/main/ScriptLibraryView.vue | 23 ++++++++++++------- mini-program/src/pages/main/ScriptView.vue | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/mini-program/src/pages/main/ScriptLibraryView.vue b/mini-program/src/pages/main/ScriptLibraryView.vue index bff4316..c87010f 100644 --- a/mini-program/src/pages/main/ScriptLibraryView.vue +++ b/mini-program/src/pages/main/ScriptLibraryView.vue @@ -152,7 +152,7 @@ import { useAppStore } from '../../stores/app.js' import { toggleFavoriteScript, checkFavoriteScript } from '../../services/epicScript.js' const store = useAppStore() -const activeType = ref('long') +const activeType = ref('all') const activeStatus = ref('all') const keyword = ref('') const sortMode = ref('updated') @@ -162,11 +162,18 @@ const activeMenuId = ref('') const deleteTarget = ref(null) const deletingScript = ref(false) -const typeTabs = [ - { label: '长篇', value: 'long' }, - { label: '短篇', value: 'short' }, - { label: '风格', value: 'style' } -] +// length 字段值 → 显示标签映射 +const LENGTH_LABELS = { short: '短篇', medium: '中篇', long: '长篇' } + +// 从实际剧本数据中提取分类标签,禁止硬编码 +const typeTabs = computed(() => { + const lengths = new Set(scripts.value.map(s => s.length || 'medium')) + const tabs = [{ label: '全部', value: 'all' }] + lengths.forEach(l => { + tabs.push({ label: LENGTH_LABELS[l] || l, value: l }) + }) + return tabs +}) const statusFilters = [ { label: '全部', value: 'all' }, @@ -187,8 +194,8 @@ const visibleScripts = computed(() => { } if (activeStatus.value === 'favorite') return isFavorite(script) if (activeStatus.value !== 'all' && status !== activeStatus.value) return false - if (activeType.value === 'short') return script.length === 'short' - if (activeType.value === 'long') return script.length !== 'short' + // 精确匹配 length 字段,禁止硬编码分类 + if (activeType.value !== 'all') return script.length === activeType.value return true }) return [...filtered].sort((a, b) => { diff --git a/mini-program/src/pages/main/ScriptView.vue b/mini-program/src/pages/main/ScriptView.vue index ce604b7..f06e383 100644 --- a/mini-program/src/pages/main/ScriptView.vue +++ b/mini-program/src/pages/main/ScriptView.vue @@ -1733,6 +1733,8 @@ const handleShortNovelEvent = (event) => { generationStatus.value = 'idle' pendingNextResponse.value = false persistResultMessages() + // 从后端刷新剧本列表,确保新生成的短篇出现在历史中(非阻塞) + store.fetchScripts() break } case 'error':