fix: 修改导出文件名为固定的draft_content.json

- 将动态生成的文件名改为固定的draft_content.json
- 更新前端默认保存文件名
- 简化导出相关的日志和提示信息
- 移除V1/V2版本标识,统一为导出功能
This commit is contained in:
imeepos 2025-07-17 12:39:57 +08:00
parent e4e0d89d5b
commit 823a54525e
4 changed files with 11 additions and 21 deletions

View File

@ -386,7 +386,7 @@ impl TemplateMatchingResultService {
let output_file_path = if output_path.ends_with(".json") {
output_path.to_string()
} else {
format!("{}/draft_content_v2_{}.json", output_path, result_id)
format!("{}/draft_content.json", output_path)
};
// 序列化并写入文件
@ -396,7 +396,7 @@ impl TemplateMatchingResultService {
std::fs::write(&output_file_path, json_content)
.map_err(|e| anyhow!("写入文件失败 {}: {}", output_file_path, e))?;
println!("V2导出成功: {}", output_file_path);
println!("导出成功: {}", output_file_path);
Ok(output_file_path)
}

View File

@ -270,7 +270,7 @@ pub async fn export_matching_result_to_jianying_v2(
output_path: String,
database: State<'_, Arc<Database>>,
) -> Result<String, String> {
println!("🎬 开始导出匹配结果到剪映格式 (V2)");
println!("🎬 开始导出匹配结果到剪映格式");
println!("📋 导出参数:");
println!(" - 匹配结果ID: {}", result_id);
println!(" - 输出路径: {}", output_path);
@ -283,12 +283,12 @@ pub async fn export_matching_result_to_jianying_v2(
match service.export_to_jianying_v2(&result_id, &output_path, material_repository, template_service).await {
Ok(file_path) => {
println!("V2导出成功: {}", file_path);
println!("导出成功: {}", file_path);
Ok(file_path)
}
Err(e) => {
eprintln!("V2导出失败: {}", e);
Err(format!("V2导出失败: {}", e))
eprintln!("导出失败: {}", e);
Err(format!("导出失败: {}", e))
}
}
}

View File

@ -15,7 +15,6 @@ export const TemplateMatchingResultCard: React.FC<TemplateMatchingResultCardProp
onViewDetail,
onDelete,
onEdit,
onExportToJianying,
onExportToJianyingV2,
}) => {
// 格式化时长显示
@ -190,22 +189,13 @@ export const TemplateMatchingResultCard: React.FC<TemplateMatchingResultCardProp
</button>
)}
{onExportToJianying && (
<button
onClick={onExportToJianying}
className="btn btn-success btn-sm"
title="导出到剪映 (V1版本)"
>
V1
</button>
)}
{onExportToJianyingV2 && (
<button
onClick={onExportToJianyingV2}
className="btn btn-primary btn-sm"
title="导出到剪映 (V2版本 - 基于原始模板)"
>
V2
</button>
)}
<button

View File

@ -165,8 +165,8 @@ export const TemplateMatchingResultManager: React.FC<TemplateMatchingResultManag
try {
// 选择保存路径
const filePath = await save({
title: '导出到剪映 (V2)',
defaultPath: `draft_content_v2_${result.result_name}.json`,
title: '导出到剪映',
defaultPath: 'draft_content.json',
filters: [
{
name: 'JSON文件',
@ -186,9 +186,9 @@ export const TemplateMatchingResultManager: React.FC<TemplateMatchingResultManag
});
// 显示成功消息
alert(`V2导出成功!文件已保存到:${exportedFilePath}`);
alert(`导出成功!文件已保存到:${exportedFilePath}`);
} catch (err) {
setError(`V2导出失败: ${err}`);
setError(`导出失败: ${err}`);
}
};