fixed:修复弹窗提示无法关闭问题

This commit is contained in:
djteang 2025-09-16 10:17:10 +08:00
parent 7b73c7c71d
commit c1f86270ec
2 changed files with 14 additions and 9 deletions

View File

@ -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: () => { } });
},

View File

@ -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);