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

feat: 中间区域展示剧本内容 + 右侧添加视频生成结果区

Connor568056874583
diff --git a/web/src/locales/en-US.ts b/web/src/locales/en-US.ts
index 675d208..0d7bdde 100644
--- a/web/src/locales/en-US.ts
+++ b/web/src/locales/en-US.ts
@@ -719,6 +719,8 @@ export default {
statusGenerating: 'Generating',
statusDone: 'Generated',
imageGeneration: 'Image Generation',
+ videoGeneration: 'Video Generation Results',
+ noVideoGenerated: 'No videos generated yet',
videoGeneration: 'Video Generation',
videoPrompt: 'Video Prompt',
noPrompt: 'No prompt yet',
diff --git a/web/src/locales/zh-CN.ts b/web/src/locales/zh-CN.ts
index b2cede8..67b1ddd 100644
--- a/web/src/locales/zh-CN.ts
+++ b/web/src/locales/zh-CN.ts
@@ -623,6 +623,7 @@ export default {
composition: '合成',
// 预览区
noPreview: '暂无预览图,请先生成图片',
+ noScriptContent: '暂无剧本内容',
selectStoryboard: '请从左侧选择分镜',
currentPreviewAlt: '当前分镜预览',
// SceneEditorPanel section titles
@@ -637,6 +638,8 @@ export default {
statusDone: '已生成',
// GenerationTab
imageGeneration: '图片生成',
+ videoGeneration: '视频生成结果',
+ noVideoGenerated: '暂无生成视频',
videoGeneration: '视频生成',
videoPrompt: '视频提示词',
noPrompt: '暂无提示词',
diff --git a/web/src/views/drama/professional/PreviewPane.vue b/web/src/views/drama/professional/PreviewPane.vue
index a9ead6f..81b69ba 100644
--- a/web/src/views/drama/professional/PreviewPane.vue
+++ b/web/src/views/drama/professional/PreviewPane.vue
@@ -1,30 +1,59 @@
<template>
<div class="preview-area-v2">
<template v-if="currentStoryboard">
- <video
- v-if="currentPreviewVideo"
- :src="currentPreviewVideo"
- class="preview-media"
- controls
- preload="metadata"
- />
- <img
- v-else-if="currentPreviewUrl"
- :src="currentPreviewUrl"
- class="preview-media"
- :alt="$t('professionalEditor.currentPreviewAlt')"
- />
- <div v-else class="preview-placeholder">
- <el-icon :size="48" color="#444"><Picture /></el-icon>
- <p>{{ $t('professionalEditor.noPreview') }}</p>
+ <!-- 媒体预览区(上方,限制高度) -->
+ <div class="media-section">
+ <video
+ v-if="currentPreviewVideo"
+ :src="currentPreviewVideo"
+ class="preview-media"
+ controls
+ preload="metadata"
+ />
+ <img
+ v-else-if="currentPreviewUrl"
+ :src="currentPreviewUrl"
+ class="preview-media"
+ :alt="$t('professionalEditor.currentPreviewAlt')"
+ />
+ <div v-else class="preview-placeholder">
+ <el-icon :size="36" color="#444"><Picture /></el-icon>
+ <p>{{ $t('professionalEditor.noPreview') }}</p>
+ </div>
+ <!-- 镜头信息浮层 -->
+ <div class="preview-info-overlay">
+ <span class="tag-shot-num">#{{ currentStoryboard.storyboard_number }}</span>
+ <span class="tag-title">{{ currentStoryboard.title || $t('storyboard.untitled') }}</span>
+ <span class="tag-duration" v-if="currentStoryboard.duration">{{ currentStoryboard.duration }}s</span>
+ </div>
</div>
- <div class="preview-info-overlay">
- <span class="preview-shot-num">#{{ currentStoryboard.storyboard_number }}</span>
- <span class="preview-shot-title">{{ currentStoryboard.title || $t('storyboard.untitled') }}</span>
- <span class="preview-shot-duration">{{ currentStoryboard.duration }}s</span>
+
+ <!-- 剧本内容区(下方,可滚动) -->
+ <div class="script-section">
+ <div class="script-block" v-if="currentStoryboard.action">
+ <div class="script-label">{{ $t('editor.action') }}</div>
+ <p class="script-text">{{ currentStoryboard.action }}</p>
+ </div>
+ <div class="script-block" v-if="currentStoryboard.dialogue">
+ <div class="script-label">{{ $t('editor.dialogue') }}</div>
+ <p class="script-text dialogue">{{ currentStoryboard.dialogue }}</p>
+ </div>
+ <div class="script-block" v-if="currentStoryboard.result">
+ <div class="script-label">{{ $t('editor.result') }}</div>
+ <p class="script-text muted">{{ currentStoryboard.result }}</p>
+ </div>
+ <div class="script-block" v-if="currentStoryboard.description">
+ <div class="script-label">{{ $t('editor.description') }}</div>
+ <p class="script-text muted">{{ currentStoryboard.description }}</p>
+ </div>
+ <div class="script-empty" v-if="!currentStoryboard.action && !currentStoryboard.dialogue && !currentStoryboard.result && !currentStoryboard.description">
+ <el-icon :size="20" color="#555"><Document /></el-icon>
+ <p>{{ $t('professionalEditor.noScriptContent') }}</p>
+ </div>
</div>
</template>
- <div v-else class="preview-placeholder">
+
+ <div v-else class="preview-placeholder full">
<el-icon :size="48" color="#444"><Picture /></el-icon>
<p>{{ $t('professionalEditor.selectStoryboard') }}</p>
</div>
@@ -32,7 +61,7 @@
</template>
<script setup lang="ts">
-import { Picture } from '@element-plus/icons-vue'
+import { Picture, Document } from '@element-plus/icons-vue'
import type { Storyboard } from '@/types/drama'
defineProps<{
@@ -46,34 +75,137 @@ defineProps<{
.preview-area-v2 {
flex: 1;
min-height: 80px;
+ background: var(--bg-primary, #f5f7fa);
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+}
+
+/* 媒体区 */
+.media-section {
+ position: relative;
background: #000;
+ flex-shrink: 0;
+ height: 45%;
+ min-height: 120px;
display: flex;
align-items: center;
justify-content: center;
- position: relative;
overflow: hidden;
+}
- .preview-media {
- max-width: 100%; max-height: 100%;
- object-fit: contain; display: block;
+.preview-media {
+ max-width: 100%;
+ max-height: 100%;
+ object-fit: contain;
+ display: block;
+}
+
+.preview-placeholder {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 8px;
+ color: #555;
+ p { font-size: 12px; margin: 0; }
+
+ &.full {
+ flex: 1;
+ justify-content: center;
+ background: #000;
}
- .preview-placeholder {
- display: flex; flex-direction: column;
- align-items: center; gap: 10px; color: #555;
- p { font-size: 13px; margin: 0; }
+}
+
+/* 镜头信息浮层 */
+.preview-info-overlay {
+ position: absolute;
+ bottom: 6px;
+ left: 6px;
+ display: flex;
+ gap: 5px;
+ align-items: center;
+}
+
+.tag-shot-num {
+ background: rgba(0,0,0,.75);
+ color: #fff;
+ font-size: 11px;
+ padding: 2px 6px;
+ border-radius: 4px;
+ font-weight: 600;
+}
+
+.tag-title {
+ color: rgba(255,255,255,.85);
+ font-size: 11px;
+ text-shadow: 0 1px 3px rgba(0,0,0,.8);
+}
+
+.tag-duration {
+ background: rgba(64,158,255,.8);
+ color: #fff;
+ font-size: 11px;
+ padding: 2px 6px;
+ border-radius: 4px;
+}
+
+/* 剧本内容区 */
+.script-section {
+ flex: 1;
+ overflow-y: auto;
+ padding: 12px 14px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+
+ &::-webkit-scrollbar { width: 4px; }
+ &::-webkit-scrollbar-thumb {
+ background: var(--border-primary, #e4e7ed);
+ border-radius: 2px;
+ }
+}
+
+.script-block {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+
+.script-label {
+ font-size: 10px;
+ font-weight: 600;
+ color: var(--text-muted, #9ca3af);
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+}
+
+.script-text {
+ font-size: 13px;
+ line-height: 1.6;
+ color: var(--text-primary, #111827);
+ margin: 0;
+ white-space: pre-wrap;
+ word-break: break-word;
+
+ &.dialogue {
+ color: var(--accent, #e8a243);
+ font-style: italic;
}
- .preview-info-overlay {
- position: absolute; bottom: 8px; left: 8px;
- display: flex; gap: 6px; align-items: center;
- .preview-shot-num {
- background: rgba(0,0,0,.7); color: #fff;
- font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 600;
- }
- .preview-shot-title { color: rgba(255,255,255,.8); font-size: 12px; }
- .preview-shot-duration {
- background: rgba(64,158,255,.8); color: #fff;
- font-size: 11px; padding: 2px 6px; border-radius: 4px;
- }
+
+ &.muted {
+ color: var(--text-secondary, #6b7280);
+ font-size: 12px;
}
}
+
+.script-empty {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ color: var(--text-muted, #9ca3af);
+ p { font-size: 12px; margin: 0; }
+}
</style>
diff --git a/web/src/views/drama/professional/SceneEditorPanel.vue b/web/src/views/drama/professional/SceneEditorPanel.vue
index 7bf5e5d..264d42c 100644
--- a/web/src/views/drama/professional/SceneEditorPanel.vue
+++ b/web/src/views/drama/professional/SceneEditorPanel.vue
@@ -224,6 +224,40 @@
</div>
</PanelSection>
+ <!-- 视频生成结果区 -->
+ <PanelSection :title="$t('professionalEditor.videoGeneration')" icon="🎬" :default-open="true">
+ <div v-if="videoGen.generatedVideos.value?.length > 0" class="video-result-list">
+ <div
+ v-for="video in videoGen.generatedVideos.value"
+ :key="video.id"
+ class="video-result-item"
+ :class="'video-' + video.status"
+ >
+ <div class="video-thumb-wrap" @click="video.video_url && videoGen.playVideo(video)">
+ <video v-if="video.video_url" :src="getVideoUrl(video)" preload="metadata" class="video-thumb-media" />
+ <div v-else class="video-thumb-placeholder">
+ <el-icon :size="16"><VideoCamera /></el-icon>
+ </div>
+ <div class="video-thumb-overlay" v-if="video.video_url">
+ <el-icon color="white" :size="16"><VideoPlay /></el-icon>
+ </div>
+ </div>
+ <div class="video-result-info">
+ <el-tag
+ :type="video.status === 'completed' ? 'success' : video.status === 'failed' ? 'danger' : 'warning'"
+ size="small"
+ >{{ imageGen.getStatusText(video.status) }}</el-tag>
+ <span class="video-duration" v-if="video.duration">{{ video.duration }}s</span>
+ <span class="video-error" v-if="video.status === 'failed' && video.error_msg">{{ video.error_msg }}</span>
+ </div>
+ </div>
+ </div>
+ <div v-else class="video-empty-hint">
+ <el-icon :size="20" color="#c0c4cc"><VideoCamera /></el-icon>
+ <p>{{ $t('professionalEditor.noVideoGenerated') }}</p>
+ </div>
+ </PanelSection>
+
</div><!-- end panel-scroll -->
<!-- ===== 固定底部:视频生成控制 ===== -->
@@ -488,6 +522,88 @@ const copyPrompt = () => {
}
}
+/* 视频生成结果列表 */
+.video-result-list {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+}
+
+.video-result-item {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 5px;
+ border-radius: 6px;
+ background: var(--bg-primary, #f9fafb);
+ border: 1px solid var(--border-primary, #e5e7eb);
+
+ &.video-completed { border-color: #b3e19d; background: rgba(21,128,61,0.06); }
+ &.video-failed { border-color: #fbc4c4; background: rgba(239,68,68,0.06); }
+ &.video-processing, &.video-pending { border-color: #fcd891; background: rgba(245,158,11,0.06); }
+}
+
+.video-thumb-wrap {
+ width: 60px;
+ height: 34px;
+ border-radius: 4px;
+ overflow: hidden;
+ background: #000;
+ position: relative;
+ cursor: pointer;
+ flex-shrink: 0;
+
+ &:hover .video-thumb-overlay { opacity: 1; }
+}
+
+.video-thumb-media {
+ width: 100%; height: 100%;
+ object-fit: cover; display: block;
+}
+
+.video-thumb-placeholder {
+ width: 100%; height: 100%;
+ display: flex; align-items: center; justify-content: center;
+ color: #555;
+}
+
+.video-thumb-overlay {
+ position: absolute; inset: 0;
+ background: rgba(0,0,0,0.4);
+ display: flex; align-items: center; justify-content: center;
+ opacity: 0; transition: opacity 150ms;
+}
+
+.video-result-info {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+}
+
+.video-duration {
+ font-size: 11px;
+ color: var(--text-muted, #9ca3af);
+}
+
+.video-error {
+ font-size: 10px;
+ color: #f56c6c;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.video-empty-hint {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 6px;
+ padding: 16px 0;
+ color: var(--text-muted, #9ca3af);
+ p { font-size: 12px; margin: 0; }
+}
+
/* 图片生成 */
.gen-controls-row {
display: flex; gap: 6px; flex-wrap: wrap;