Skip to content

🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"

TypeScript

refactor: simplify Drama navigation — single page replaces sidebar layout

Connor245a6c220829
diff --git a/web/src/router/index.ts b/web/src/router/index.ts
index ffcdc42..ff4ee06 100644
--- a/web/src/router/index.ts
+++ b/web/src/router/index.ts
@@ -47,42 +47,11 @@ const routes: RouteRecordRaw[] = [
component: () => import('../views/drama/DramaCreate.vue')
},
- // Drama management (nested under DramaLayout)
+ // Drama detail (single page)
{
path: '/drama/:id',
- component: () => import('../views/drama/DramaLayout.vue'),
- children: [
- {
- path: '',
- name: 'DramaOverview',
- component: () => import('../views/drama/management/OverviewTab.vue')
- },
- {
- path: 'episodes',
- name: 'DramaEpisodes',
- component: () => import('../views/drama/management/EpisodesTab.vue')
- },
- {
- path: 'characters',
- name: 'DramaCharacters',
- component: () => import('../views/drama/management/CharactersTab.vue')
- },
- {
- path: 'scenes',
- name: 'DramaScenes',
- component: () => import('../views/drama/management/ScenesTab.vue')
- },
- {
- path: 'props',
- name: 'DramaProps',
- component: () => import('../views/drama/management/PropsTab.vue')
- },
- {
- path: 'settings',
- name: 'DramaSettingsPage',
- component: () => import('../views/drama/management/SettingsTab.vue')
- }
- ]
+ name: 'DramaDetail',
+ component: () => import('../views/drama/DramaDetail.vue')
},
// Episode workbench (fullscreen, outside DramaLayout)
diff --git a/web/src/views/drama/DramaDetail.vue b/web/src/views/drama/DramaDetail.vue
new file mode 100644
index 0000000..a773153
--- /dev/null
+++ b/web/src/views/drama/DramaDetail.vue
@@ -0,0 +1,251 @@
+<template>
+ <div class="drama-detail">
+ <!-- Project Header -->
+ <header class="dd-header">
+ <div class="dd-header-left">
+ <Button variant="ghost" size="sm" @click="router.push('/')">
+ <ArrowLeft :size="16" />
+ 返回
+ </Button>
+ <h1 class="dd-title" v-if="dramaStore.currentDrama">{{ dramaStore.currentDrama.title }}</h1>
+ <div class="dd-title-skeleton" v-else-if="dramaStore.loading" />
+ <Badge v-if="dramaStore.currentDrama?.genre" variant="secondary">{{ dramaStore.currentDrama.genre }}</Badge>
+ </div>
+ <div class="dd-header-right">
+ <Button variant="ghost" size="icon" @click="showSettings = !showSettings">
+ <Settings :size="16" />
+ </Button>
+ </div>
+ </header>
+
+ <!-- Settings Panel (toggled) -->
+ <div v-if="showSettings" class="dd-settings-panel">
+ <SettingsTab />
+ </div>
+
+ <!-- Resource Summary Bar -->
+ <div class="dd-resources">
+ <button
+ class="dd-resource-item"
+ :class="{ active: expandedResource === 'characters' }"
+ @click="toggleResource('characters')"
+ >
+ <User :size="14" />
+ <span>角色</span>
+ <Badge variant="secondary" class="dd-resource-badge">{{ dramaStore.characters.length }}</Badge>
+ <ChevronDown :size="12" class="dd-chevron" :class="{ rotated: expandedResource === 'characters' }" />
+ </button>
+ <button
+ class="dd-resource-item"
+ :class="{ active: expandedResource === 'scenes' }"
+ @click="toggleResource('scenes')"
+ >
+ <ImageIcon :size="14" />
+ <span>场景</span>
+ <Badge variant="secondary" class="dd-resource-badge">{{ dramaStore.scenes.length }}</Badge>
+ <ChevronDown :size="12" class="dd-chevron" :class="{ rotated: expandedResource === 'scenes' }" />
+ </button>
+ <button
+ class="dd-resource-item"
+ :class="{ active: expandedResource === 'props' }"
+ @click="toggleResource('props')"
+ >
+ <Package :size="14" />
+ <span>道具</span>
+ <Badge variant="secondary" class="dd-resource-badge">{{ dramaStore.props.length }}</Badge>
+ <ChevronDown :size="12" class="dd-chevron" :class="{ rotated: expandedResource === 'props' }" />
+ </button>
+ </div>
+
+ <!-- Expanded Resource Panel -->
+ <div v-if="expandedResource" class="dd-resource-panel">
+ <CharactersTab v-if="expandedResource === 'characters'" />
+ <ScenesTab v-if="expandedResource === 'scenes'" />
+ <PropsTab v-if="expandedResource === 'props'" />
+ </div>
+
+ <!-- Episodes Grid (main content) -->
+ <div class="dd-episodes">
+ <EpisodesTab />
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { ref, computed, watch, onMounted } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import { useDramaStore } from '@/stores/drama'
+import {
+ ArrowLeft,
+ Settings,
+ User,
+ Image as ImageIcon,
+ Package,
+ ChevronDown,
+} from 'lucide-vue-next'
+import { Button } from '@/components/ui/button'
+import { Badge } from '@/components/ui/badge'
+import CharactersTab from './management/CharactersTab.vue'
+import ScenesTab from './management/ScenesTab.vue'
+import PropsTab from './management/PropsTab.vue'
+import EpisodesTab from './management/EpisodesTab.vue'
+import SettingsTab from './management/SettingsTab.vue'
+
+const route = useRoute()
+const router = useRouter()
+const dramaStore = useDramaStore()
+
+const dramaId = computed(() => route.params.id as string)
+const expandedResource = ref<'characters' | 'scenes' | 'props' | null>(null)
+const showSettings = ref(false)
+
+function toggleResource(resource: 'characters' | 'scenes' | 'props') {
+ expandedResource.value = expandedResource.value === resource ? null : resource
+}
+
+async function ensureLoaded(id: string) {
+ if (!id) return
+ if (dramaStore.isLoaded && dramaStore.dramaId === id) return
+ await dramaStore.loadDrama(id)
+}
+
+onMounted(() => {
+ ensureLoaded(dramaId.value)
+})
+
+watch(dramaId, (newId) => {
+ if (newId) {
+ ensureLoaded(newId)
+ }
+})
+</script>
+
+<style scoped>
+.drama-detail {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ overflow: hidden;
+}
+
+/* Header */
+.dd-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 12px 20px;
+ border-bottom: 1px solid var(--border-primary);
+ background: var(--bg-card);
+ flex-shrink: 0;
+}
+
+.dd-header-left {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ min-width: 0;
+}
+
+.dd-header-right {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-shrink: 0;
+}
+
+.dd-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: var(--text-primary);
+ margin: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.dd-title-skeleton {
+ height: 20px;
+ width: 120px;
+ border-radius: 4px;
+ background: var(--border-primary);
+ animation: pulse 1.5s ease-in-out infinite;
+}
+
+@keyframes pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.4; }
+}
+
+/* Resource Summary Bar */
+.dd-resources {
+ display: flex;
+ gap: 2px;
+ padding: 8px 20px;
+ border-bottom: 1px solid var(--border-primary);
+ background: var(--bg-card);
+ flex-shrink: 0;
+}
+
+.dd-resource-item {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 6px 12px;
+ border-radius: 6px;
+ border: none;
+ background: transparent;
+ color: var(--text-secondary);
+ font-size: 13px;
+ cursor: pointer;
+ transition: all 0.15s;
+}
+
+.dd-resource-item:hover {
+ background: var(--bg-card-hover);
+ color: var(--text-primary);
+}
+
+.dd-resource-item.active {
+ background: var(--accent-light);
+ color: var(--accent);
+}
+
+.dd-resource-badge {
+ font-size: 11px;
+}
+
+.dd-chevron {
+ transition: transform 0.2s;
+}
+
+.dd-chevron.rotated {
+ transform: rotate(180deg);
+}
+
+/* Resource Panel */
+.dd-resource-panel {
+ border-bottom: 1px solid var(--border-primary);
+ background: var(--bg-primary);
+ max-height: 400px;
+ overflow-y: auto;
+ padding: 16px 20px;
+ flex-shrink: 0;
+}
+
+/* Settings Panel */
+.dd-settings-panel {
+ border-bottom: 1px solid var(--border-primary);
+ background: var(--bg-primary);
+ max-height: 500px;
+ overflow-y: auto;
+ padding: 16px 20px;
+ flex-shrink: 0;
+}
+
+/* Episodes */
+.dd-episodes {
+ flex: 1;
+ overflow-y: auto;
+ padding: 20px;
+}
+</style>
diff --git a/web/src/views/drama/DramaLayout.vue b/web/src/views/drama/DramaLayout.vue
deleted file mode 100644
index 2101206..0000000
--- a/web/src/views/drama/DramaLayout.vue
+++ /dev/null
@@ -1,244 +0,0 @@
-<template>
- <div class="drama-layout">
- <!-- Left Sidebar -->
- <aside class="drama-sidebar">
- <!-- Back + Title -->
- <div class="sidebar-header">
- <router-link to="/dramas" class="back-link">
- <ArrowLeft :size="18" />
- <span>{{ t('nav.dramas', 'Projects') }}</span>
- </router-link>
- <h2 class="drama-title" v-if="dramaStore.currentDrama">
- {{ dramaStore.currentDrama.title }}
- </h2>
- <div class="drama-title-skeleton" v-else-if="dramaStore.loading" />
- </div>
-
- <!-- Navigation -->
- <nav class="sidebar-nav">
- <router-link
- :to="`/drama/${dramaId}/overview`"
- class="nav-item"
- active-class="nav-item--active"
- >
- <LayoutGrid :size="18" />
- <span>{{ t('drama.management.overview', 'Overview') }}</span>
- </router-link>
-
- <router-link
- :to="`/drama/${dramaId}/episodes`"
- class="nav-item"
- active-class="nav-item--active"
- >
- <FileText :size="18" />
- <span>{{ t('drama.management.episodes', 'Episodes') }}</span>
- <span class="nav-badge" v-if="episodeCount > 0">{{ episodeCount }}</span>
- </router-link>
-
- <router-link
- :to="`/drama/${dramaId}/characters`"
- class="nav-item"
- active-class="nav-item--active"
- >
- <User :size="18" />
- <span>{{ t('drama.management.characters', 'Characters') }}</span>
- <span class="nav-badge" v-if="characterCount > 0">{{ characterCount }}</span>
- </router-link>
-
- <router-link
- :to="`/drama/${dramaId}/scenes`"
- class="nav-item"
- active-class="nav-item--active"
- >
- <Image :size="18" />
- <span>{{ t('drama.management.scenes', 'Scenes') }}</span>
- <span class="nav-badge" v-if="sceneCount > 0">{{ sceneCount }}</span>
- </router-link>
-
- <router-link
- :to="`/drama/${dramaId}/props`"
- class="nav-item"
- active-class="nav-item--active"
- >
- <Package :size="18" />
- <span>{{ t('drama.management.propList', 'Props') }}</span>
- <span class="nav-badge" v-if="propCount > 0">{{ propCount }}</span>
- </router-link>
-
- <router-link
- :to="`/drama/${dramaId}/settings`"
- class="nav-item"
- active-class="nav-item--active"
- >
- <Settings :size="18" />
- <span>{{ t('settings.title', 'Settings') }}</span>
- </router-link>
- </nav>
- </aside>
-
- <!-- Main Content -->
- <main class="drama-content">
- <router-view />
- </main>
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed, watch, onMounted } from 'vue'
-import { useRoute } from 'vue-router'
-import { useI18n } from 'vue-i18n'
-import { useDramaStore } from '@/stores/drama'
-import {
- ArrowLeft,
- LayoutGrid,
- FileText,
- User,
- Image,
- Package,
- Settings
-} from 'lucide-vue-next'
-
-const route = useRoute()
-const { t } = useI18n()
-const dramaStore = useDramaStore()
-
-const dramaId = computed(() => route.params.id as string)
-
-const episodeCount = computed(() => dramaStore.episodes.length)
-const characterCount = computed(() => dramaStore.characters.length)
-const sceneCount = computed(() => dramaStore.scenes.length)
-const propCount = computed(() => dramaStore.props.length)
-
-async function ensureLoaded(id: string) {
- if (!id) return
- if (dramaStore.isLoaded && dramaStore.dramaId === id) return
- await dramaStore.loadDrama(id)
-}
-
-onMounted(() => {
- ensureLoaded(dramaId.value)
-})
-
-watch(dramaId, (newId) => {
- if (newId) {
- ensureLoaded(newId)
- }
-})
-</script>
-
-<style scoped>
-.drama-layout {
- display: flex;
- height: 100vh;
- background: var(--bg-primary);
-}
-
-.drama-sidebar {
- width: 220px;
- min-width: 220px;
- background: var(--bg-card);
- border-right: 1px solid var(--border-primary);
- display: flex;
- flex-direction: column;
- overflow-y: auto;
-}
-
-.sidebar-header {
- padding: 16px;
- border-bottom: 1px solid var(--border-primary);
-}
-
-.back-link {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- color: var(--text-secondary);
- text-decoration: none;
- font-size: 13px;
- transition: color 0.2s;
-}
-
-.back-link:hover {
- color: var(--text-primary);
-}
-
-.drama-title {
- margin: 10px 0 0;
- font-size: 15px;
- font-weight: 600;
- color: var(--text-primary);
- line-height: 1.4;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.drama-title-skeleton {
- margin-top: 10px;
- height: 20px;
- width: 70%;
- border-radius: 4px;
- background: var(--border-primary);
- animation: pulse 1.5s ease-in-out infinite;
-}
-
-@keyframes pulse {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.4; }
-}
-
-.sidebar-nav {
- display: flex;
- flex-direction: column;
- padding: 8px;
- gap: 2px;
-}
-
-.nav-item {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 9px 12px;
- border-radius: 6px;
- color: var(--text-secondary);
- text-decoration: none;
- font-size: 14px;
- transition: all 0.15s;
- cursor: pointer;
-}
-
-.nav-item:hover {
- background: var(--bg-card-hover);
- color: var(--text-primary);
-}
-
-.nav-item--active {
- background: var(--accent-light);
- color: var(--accent);
- font-weight: 500;
-}
-
-.nav-badge {
- margin-left: auto;
- font-size: 12px;
- min-width: 20px;
- height: 20px;
- line-height: 20px;
- text-align: center;
- border-radius: 10px;
- background: var(--border-primary);
- color: var(--text-secondary);
- font-weight: 500;
-}
-
-.nav-item--active .nav-badge {
- background: var(--accent);
- color: var(--text-inverse);
-}
-
-.drama-content {
- flex: 1;
- overflow-y: auto;
- padding: 24px;
-}
-</style>