|
@@ -373,25 +373,43 @@ const ProjectDetail = () => {
|
373
|
373
|
|
374
|
374
|
try {
|
375
|
375
|
setLoading(true);
|
376
|
|
- // 创建上传路径
|
377
|
|
- const filePath = `uploads/${uploadType}/${selectedFile.name}`;
|
378
|
376
|
|
379
|
|
- // 更新分镜信息
|
380
|
|
- const updateData = {
|
381
|
|
- id: uploadSegmentId
|
382
|
|
- };
|
|
377
|
+ // 如果是图片类型,先上传到Coze获取链接
|
|
378
|
+ if (uploadType === 'image') {
|
|
379
|
+ toast.info('正在上传图片到云端...');
|
|
380
|
+ const imageUrl = await cozeUploadService.uploadFileAndGetLink(selectedFile);
|
|
381
|
+
|
|
382
|
+ if (!imageUrl) {
|
|
383
|
+ throw new Error('获取图片链接失败');
|
|
384
|
+ }
|
383
|
385
|
|
384
|
|
- if (uploadType === 'audio') {
|
385
|
|
- updateData.audio_path = filePath;
|
386
|
|
- } else if (uploadType === 'image') {
|
387
|
|
- updateData.image_path = filePath;
|
388
|
|
- } else if (uploadType === 'video') {
|
389
|
|
- updateData.video_path = filePath;
|
390
|
|
- }
|
|
386
|
+ // 更新分镜信息 - 保存图片链接
|
|
387
|
+ await bookInfoService.updateBookInfo(uploadSegmentId, {
|
|
388
|
+ image_path: imageUrl,
|
|
389
|
+ draw_status: 2 // 设置为已完成状态
|
|
390
|
+ });
|
|
391
|
+
|
|
392
|
+ toast.success('图片上传成功');
|
|
393
|
+ } else {
|
|
394
|
+ // 其他类型文件(音频、视频)的处理逻辑
|
|
395
|
+ // 创建上传路径
|
|
396
|
+ const filePath = `uploads/${uploadType}/${selectedFile.name}`;
|
|
397
|
+
|
|
398
|
+ // 更新分镜信息
|
|
399
|
+ const updateData = {
|
|
400
|
+ id: uploadSegmentId
|
|
401
|
+ };
|
391
|
402
|
|
392
|
|
- await bookInfoService.updateBookInfo(uploadSegmentId, updateData);
|
|
403
|
+ if (uploadType === 'audio') {
|
|
404
|
+ updateData.audio_path = filePath;
|
|
405
|
+ } else if (uploadType === 'video') {
|
|
406
|
+ updateData.video_path = filePath;
|
|
407
|
+ }
|
|
408
|
+
|
|
409
|
+ await bookInfoService.updateBookInfo(uploadSegmentId, updateData);
|
|
410
|
+ toast.success('文件上传成功');
|
|
411
|
+ }
|
393
|
412
|
|
394
|
|
- toast.success('文件上传成功');
|
395
|
413
|
setShowUploadModal(false);
|
396
|
414
|
await loadProjectDetail();
|
397
|
415
|
} catch (error) {
|