From c1f86270ec4a8482f522b6d71a6e36926fe952e8 Mon Sep 17 00:00:00 2001 From: djteang <935037887@qq.com> Date: Tue, 16 Sep 2025 10:17:10 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=E4=BF=AE=E5=A4=8D=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/page.tsx | 18 +++++++++--------- src/components/DataMigration.tsx | 5 +++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 27c8f01..b43ac83 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -2509,7 +2509,7 @@ const VideoSourceConfig = ({ // 有效性检测函数 const handleValidateSources = async () => { if (!searchKeyword.trim()) { - showAlert({ type: 'warning', title: '请输入搜索关键词', message: '搜索关键词不能为空' }); + showAlert({ type: 'warning', title: '请输入搜索关键词', message: '搜索关键词不能为空', showConfirm: true }); return; } @@ -2583,7 +2583,7 @@ const VideoSourceConfig = ({ console.error('EventSource错误:', error); eventSource.close(); setIsValidating(false); - showAlert({ type: 'error', title: '验证失败', message: '连接错误,请重试' }); + showAlert({ type: 'error', title: '验证失败', message: '连接错误,请重试', showConfirm: true }); }; // 设置超时,防止长时间等待 @@ -2591,13 +2591,13 @@ const VideoSourceConfig = ({ if (eventSource.readyState === EventSource.OPEN) { eventSource.close(); setIsValidating(false); - showAlert({ type: 'warning', title: '验证超时', message: '检测超时,请重试' }); + showAlert({ type: 'warning', title: '验证超时', message: '检测超时,请重试', showConfirm: true }); } }, 60000); // 60秒超时 } catch (error) { setIsValidating(false); - showAlert({ type: 'error', title: '验证失败', message: error instanceof Error ? error.message : '未知错误' }); + showAlert({ type: 'error', title: '验证失败', message: error instanceof Error ? error.message : '未知错误', showConfirm: true }); throw error; } }); @@ -2610,7 +2610,7 @@ const VideoSourceConfig = ({ isNewSource: boolean = false ) => { if (!api.trim()) { - showAlert({ type: 'warning', title: 'API地址不能为空', message: '请输入有效的API地址' }); + showAlert({ type: 'warning', title: 'API地址不能为空', message: '请输入有效的API地址', showConfirm: true }); return; } @@ -2731,7 +2731,7 @@ const VideoSourceConfig = ({ // 单个视频源有效性检测函数 const handleValidateSingleSource = async () => { if (!editingSource) { - showAlert({ type: 'warning', title: '没有可检测的视频源', message: '请确保正在编辑视频源' }); + showAlert({ type: 'warning', title: '没有可检测的视频源', message: '请确保正在编辑视频源', showConfirm: true }); return; } await handleValidateSource(editingSource.api, editingSource.name, false); @@ -2740,7 +2740,7 @@ const VideoSourceConfig = ({ // 新增视频源有效性检测函数 const handleValidateNewSource = async () => { if (!newSource.name.trim()) { - showAlert({ type: 'warning', title: '视频源名称不能为空', message: '请输入视频源名称' }); + showAlert({ type: 'warning', title: '视频源名称不能为空', message: '请输入视频源名称', showConfirm: true }); return; } await handleValidateSource(newSource.api, newSource.name, true); @@ -2925,7 +2925,7 @@ const VideoSourceConfig = ({ // 批量操作 const handleBatchOperation = async (action: 'batch_enable' | 'batch_disable' | 'batch_delete') => { if (selectedSources.size === 0) { - showAlert({ type: 'warning', title: '请先选择要操作的视频源', message: '请选择至少一个视频源' }); + showAlert({ type: 'warning', title: '请先选择要操作的视频源', message: '请选择至少一个视频源', showConfirm: true }); return; } @@ -2960,7 +2960,7 @@ const VideoSourceConfig = ({ // 重置选择状态 setSelectedSources(new Set()); } catch (err) { - showAlert({ type: 'error', title: `${actionName}失败`, message: err instanceof Error ? err.message : '操作失败' }); + showAlert({ type: 'error', title: `${actionName}失败`, message: err instanceof Error ? err.message : '操作失败', showConfirm: true }); } setConfirmModal({ isOpen: false, title: '', message: '', onConfirm: () => { }, onCancel: () => { } }); }, diff --git a/src/components/DataMigration.tsx b/src/components/DataMigration.tsx index 7bc2b85..11cf18f 100644 --- a/src/components/DataMigration.tsx +++ b/src/components/DataMigration.tsx @@ -176,6 +176,7 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => { type: 'error', title: '错误', message: '请输入加密密码', + showConfirm: true }); return; } @@ -231,6 +232,7 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => { type: 'error', title: '导出失败', message: error instanceof Error ? error.message : '导出过程中发生错误', + showConfirm: true, }); } finally { setIsExporting(false); @@ -252,6 +254,7 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => { type: 'error', title: '错误', message: '请选择备份文件', + showConfirm: true }); return; } @@ -261,6 +264,7 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => { type: 'error', title: '错误', message: '请输入解密密码', + showConfirm: true }); return; } @@ -319,6 +323,7 @@ const DataMigration = ({ onRefreshConfig }: DataMigrationProps) => { type: 'error', title: '导入失败', message: error instanceof Error ? error.message : '导入过程中发生错误', + showConfirm: true }); } finally { setIsImporting(false);