'commit'
This commit is contained in:
@@ -128,19 +128,71 @@
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
/* 新增样式 */
|
||||
.section {
|
||||
border-radius: 8px;
|
||||
padding: 25px;
|
||||
margin-bottom: 30px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
}
|
||||
.image-section {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.prompt-section {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 20px;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
color: #2c3e50;
|
||||
}
|
||||
.btn-group-image {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 20px;
|
||||
gap: 15px;
|
||||
}
|
||||
.btn-group-fen {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 15px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>首帧预览</h1>
|
||||
<div class="image-container">
|
||||
<div class="loading" id="loading">加载中...</div>
|
||||
<img id="previewImage" style="display: none;">
|
||||
<h1>首帧预览与分镜头生成</h1>
|
||||
|
||||
<!-- 图片预览区域 -->
|
||||
<div class="section image-section">
|
||||
<h2 class="section-title">图片预览</h2>
|
||||
<div class="image-container">
|
||||
<div class="loading" id="loading">加载中...</div>
|
||||
<img id="previewImage" style="display: none;">
|
||||
</div>
|
||||
<div class="btn-group-image">
|
||||
<button class="btn btn-danger" id="backBtn">返回修改</button>
|
||||
<button class="btn btn-secondary" id="regenerateBtn">重新生成</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-danger" id="backBtn">返回修改</button>
|
||||
<button class="btn btn-secondary" id="regenerateBtn">重新生成</button>
|
||||
<button class="btn btn-primary" id="confirmBtn">确认满意</button>
|
||||
|
||||
<!-- 分镜头生成区域 -->
|
||||
<div class="section prompt-section">
|
||||
<h2 class="section-title">分镜头脚本生成</h2>
|
||||
<p style="margin-bottom: 15px; color: #666;">请调整提示词,然后点击"生成分镜头"按钮:</p>
|
||||
<textarea id="fenjingtouPrompt" rows="4" style="width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; resize: vertical;">以这张图片为首帧,帮我生成一个5秒的视频提示词。提示词包括:镜号、运镜、画面内容</textarea>
|
||||
<div class="btn-group-fen">
|
||||
<button class="btn btn-success" id="generateFenBtn">生成分镜头</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分镜头结果区域 -->
|
||||
<div id="fenjingtouResult" class="section" style="margin-top: 30px; display: none; background-color: #f8f9fa;">
|
||||
<h2 class="section-title">分镜头脚本</h2>
|
||||
<pre style="background-color: #ffffff; padding: 15px; border-radius: 6px; border: 1px solid #ddd; white-space: pre-wrap; word-wrap: break-word;"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -160,7 +212,9 @@
|
||||
const loading = document.getElementById('loading');
|
||||
const backBtn = document.getElementById('backBtn');
|
||||
const regenerateBtn = document.getElementById('regenerateBtn');
|
||||
const confirmBtn = document.getElementById('confirmBtn');
|
||||
const generateFenBtn = document.getElementById('generateFenBtn'); // 获取新按钮
|
||||
const fenjingtouResult = document.getElementById('fenjingtouResult');
|
||||
const fenjingtouPrompt = document.getElementById('fenjingtouPrompt');
|
||||
const mask = document.getElementById('mask');
|
||||
const maskText = document.getElementById('maskText');
|
||||
|
||||
@@ -231,11 +285,54 @@
|
||||
});
|
||||
});
|
||||
|
||||
// 确认满意按钮
|
||||
confirmBtn.addEventListener('click', function() {
|
||||
alert('首帧确认成功!即将进入下一环节');
|
||||
// 这里可以添加跳转到下一步的逻辑
|
||||
// window.location.href = 'next_step.html';
|
||||
// 生成分镜头按钮
|
||||
generateFenBtn.addEventListener('click', function() {
|
||||
const promptText = fenjingtouPrompt.value.trim();
|
||||
if (!promptText) {
|
||||
alert('请输入分镜头提示词');
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示遮罩动画
|
||||
mask.classList.add('active');
|
||||
maskText.textContent = '正在生成分镜头脚本,请稍候...';
|
||||
|
||||
// 调用分镜头API
|
||||
fetch('/api/jimeng/generate_fenjingtou', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
image_url: imageUrl,
|
||||
prompt_text: promptText
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('网络响应异常');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
// 隐藏遮罩动画
|
||||
mask.classList.remove('active');
|
||||
|
||||
if (data.code === 200) {
|
||||
// 显示分镜头结果
|
||||
fenjingtouResult.style.display = 'block';
|
||||
fenjingtouResult.querySelector('pre').textContent = data.data.fenjingtou_content;
|
||||
} else {
|
||||
alert('分镜头生成失败: ' + data.message);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// 隐藏遮罩动画
|
||||
mask.classList.remove('active');
|
||||
|
||||
console.error('生成分镜头时出错:', error);
|
||||
alert('生成分镜头时出错: ' + error.message);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user