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':